VS 2008 - Minigame - Game That Lets The User Move A Picturebox Around With Arrowkeys
Nov 21, 2009
I've made a small game that lets the user move a picturebox around with arrowkeys. The monster picturebox is moved towards the player and keeps growing while you are "alive". If it touches you, you lose.
How to improve my code. Im the worst ever at OOP programming. The main reason is i dont understand how i can pass variables between subs/functions e.t.c. I've read up on overloading operators but i dont feel that i can grasp it. If someone has any comments or any simple examples on improving my ability i wouldnt mind hearing them ^^
This is what i have now. Attached project (with "graphics") without .exe files and all code is also below. Also an image of what it looks like below.
I am extremely new to VB but i have most of the basics down fairly well. I can create buttons and move objects with arrow keys, for example. I am using VB Express Edition 2008. What I am trying to do is make a very basic game. So far it was going great until a little problem stumped me [see title to see where i am going with this]. Before i added buttons onto the form i was able to move my little circle man with the arrow keys up, down, left and right. When i added buttons it no longer allowed me to do such things. Now moving the arrow keys only allows me to select buttons without the mouse. It is really frustrating because i have been working very hard on this and a problem this small could ruin everything! ;)
I was wondering if there is a way to move objects with arrow keys and use buttons on the same form and if so, how do you do it?
I am trying to make a game which basiclly lets you shoot ducks. i have a picture as a background (set as form image) i then have picturebox's with ducks flying flying around you shoot them the disapear etc.
My problem is the image. i have a picture of a duck and a blue square round it. and i would liketo make it transparant because birds dont fly with blue squares.
Below is an image to illistrate my problem
I have tried adding transparent background, transparant key etc
how to make a collision between the player object and the wall which is a picturebox
i can move the player object (which is also a picture box) with the arrow keys and i've made it move inside the form border, but the porblem is how to make it stop when it touches the wall (picture box) if im moving left and the left border of the player touched the right border of the wall then it should stop and only the up, down and right keys will be working!!!
How to add a control like picturebox programatically and Allow user to move it with mouse? on google but cant find anything. Thats why I am here. In my application user creates a picturebox and a label at runtime by selecting a file from drag drop. User can create as many files he wants. But the problem is that I dont know that how to move both picturebox and label to change their location in a flowlayoutpanel which contains these controls with mouse. I know that how to add a control like picturebox programatically but dont know how to move it. I add picturebox by:
dim picturebox as new picturebox flowlayoutpanel1.controls.add(picturebox)
How to move a card in a solitaire game using vb.net 2008?is there anyone who can help me out here?its just that im a beginner and i want to know more about vb.net when it comes to games specillay in cards like solitaire...
im trying to make a game in visual basic in which your character can move around, jump, and kill things. I can get the picture box with the character to move and everything is fine. but i did run into one problem. when the character moves over a tree (or something) you can see the gray backround of the character as i made in paint. how do i make the backround of the picturebox transparent?
Basically I need to make a program that lets a user browse and choose a folder, then I need a box that the user can then select the files to work with, then with the selected files I need to put them into a zip file. I'm trying to use a list view box but having all kinds of problems using the data in it.
So basically i need to make a loop that only lets the user click it ten times then gives the answer to them.i was gonna use a DO loop that looks like this so far.
Dim counter as integer counter = 0 Do until counter = 10 loop
and after that i'm kinda lost on what to do, i know that its needs to be if you click btnenter 10 times give the right answer and then your done.
i am making a game in which the file stream gets a certain file(lets say a.txt) and it reads it, if it has certain values stored in the file it returns boolean(this is a function), then a sub procedure writes to the file using a streamwriter and a filestream using the same file. I am having problems, sometimes visual basic says that another process is using the file, this is before i closed the filestreams and the streamwriter or streamreader, then it gives me errors when i close the files, it tells me that it can't access a file that is already closed, i thought the filestream gets the file and lets the streamreader or streamwriter read or write to the filefound out the problem?
I have to create an application that lets a user enter as much grades he wants. The grades are between 0 and 100 and they can't be negative. Whenever the user type -1, the application is done and it shows the average of the grades, the lowest and the highest grades.I absolutly have no idea where to start but i must be using loop/do/while.
Form 1. I have 1 picturebox with image how to make when they move the mouse to the picturebox to show in right or left a new window (to read from form2) and when they moveout the mouse from the picturebox auto to close the window
Hey I am making a GDI++ game in vb.net. Now what I want is the monster(picturebox) to go after the player(picturebox). There Are No Vertical Walls. Only The Edge of map barriers. For example to get to the player the AI would have to go to the end of the ledge and either jump off and fall to the lower ledge or take the ladder down. There is no jumping, only falling and going up and down ladders and across the horizontal ledges. So How Can I make this pathfinding system?
Ok, so I have a new challenge for the D.I.C. Heads. I'm making a simple little game using VB controls. I know it's not the best idea in the world but it'll have to do for now!
Here is whats happening. I've created a class that inherits the PictureBox control that I want to use to place my game pieces on the playing field.
Dim pbArmyUnit(0) As ArmyUnit ' ArmyUnit is a Class that inherits Picturebox now I create the playing pieces at runtime as needed and append them to the array. Player currently buys the units and places them on the playing field.
[Code]...
On a side note how can I look at a stack of pictureboxes all created at runtime to determine whats at a particular location? Example. I move my army unit over top of the picturebox that shows my forest. How can I tell what picturebox I just moved on top of? does that make sense? I don't need code for this just directions on looking at the right info so I can figure it out.
I am creating my terrain at runtime as well since it's randomly generated. and I'm basically making an array of 192 pictureboxes with the appropriate terrain image as well as some other modifiers. Just like with my armies above I've inherited picturebox and created a terrain class array, this way I'm able to add my movement modifiers etc, directly to the picturebox I place on the screen. It's these pieces of terrain that I want to be able to check before allowing the unit to move into them! to get movement costs etc.
I am trying to do a game application similar to chess, where i need to move the game peaces(graphics) over another graphics which is the game board. using the mouse. How can I do multiple layers of graphics and control their movement(without using direct x, i know nothing about it)? Note: I have visual basic 2010 express, windows xp home
I have just a few questions about the listview control,how do messegebox sub items lets say row2 col 2 and why cant (at run time) I select items in col 2 but only col 1.
I am creating a user tool for a game I am playing (NOT a hacking tool, it simply shows information about my own character). I have a template of what I need to do with the data I recieve, here is the code, it is coded in PHP
Ok, I understand PHP a bit (As you know one programming language you can understand just about any) and this is what I have created from this
Dim Style As Decimal Dim Rank, RRank As Decimal Dim Gender, RGender As Decimal Dim Aura, RAura As Decimal
[CODE]...
As you can see, it is receiving a single piece of data from a remote SQL server, I then need to run this data through the above calculations (Seen in the PHP file) although the answers I'm getting are incorrect.
Here are some simple instructions I got in what goes on between values:
Is it possible to declare a variable using the text of, lets say a string, as the name?If u dont get it im looking for something like;Dim Var + string1 As PictureBox..In the code "Var" is the start of the name and "string1" is the end of it so if string1 was "Hello", the picturebox would have been named VarHello.
I have an application where I have different picture boxes which the user can drag and move.I also have different empty pictureboxes.
What I want to do:I want to let the user be able to drag a picturebox to one of the empty pictureboxes. Also, If the user drags a picturebox to an invalid place (outside the bounds of any of the empty pictureboxes), the dragged picture box should return to its previous location.
So what I currently have is the usual drag-drop code and on the MouseUp event, I run this code (currently only checking for one empty picturebox):
If Not pbEmpty1.Bounds.Contains(Me.PointToClient(pbRemote.Location)) Then pbRemote.Location = OldLocation End If (pbEmpty1 = Empty picturebox, pbRemote = picturebox that is dragged)
But it doesn't work, it doesn't care if the picturebox is inside the bounds of the empty picturebox or not, it still returns to its previous location...
im currently making(or trying) Turbo Tanks from vb Express edition 2005 and I cant get my tank to move a full 360. I can only make it move 90degrees make a object move 360 and btw is it possible to actually make this game from VB 2005 [URL]
I'm trying to export a listbox (lets call it Listbox1) to excel 2007 and I'm having some trouble with it. Listbox1 contains just one column of items but the list itself is able to contain more 30 items.I have this script and it does something but, the most important thing doesn't show up: The list as in listbox1...
'Dim oExcel As Object 'Dim oBook As Object 'Dim oSheet As Object
Here's my situation: I'm tryring to build a very simpe minigame in which the player has to pursuit and catch certain figures on the screen. This figures are currently showed as images on PictureBox wich i pass ByRef to some classes where the movement subrutines are. I have all the graphics in PNG, with transparent background, format and they look fine on the background, but when 2 or more of this figures are over the same place on the screen every PictureBox covers the underlying figure, so all i can see is one figure over the background.I was wondering if theres a way to solve this... Maybe using more powerfull libraries or something like that.
I have been working on an rpg for a while now and iv been experimenting with different ways to get the background to move with the character. I dont have any directx experience at all so im trying to stay away from using it so my question is, if i design a 2d background in photoshop is there any way id be able to insert the entire picture in a picture box and have the character always remain in the center of the screen as the background follows him. my one idea is to make the background image bigger than the picture box and have the picture box some how follow the character.
I want a picbox to move across a screen then back to where it started (for a space invader game:
the following code is what I have for this task.
Code: Private Sub AlienMovement_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AlienMovement.Tick If Alien1.Location.X > 20 Then
[Code]....
I can't make it < because thats not logical, can't make it = becasue that doesn't work, can't make it > becasue then it will only bounce back once. Is there another variable I could use?
Well I am trying to make a 2 player game but both players can't move at once unless they tap the keys (can't hold the key down or the other person can't move). How would I fix this as well as being able to go diagonally.Would this work?:Declare a bool value for each keypress below the public class thingy. Then use keyup to turn the bool off and keydown makes it go on. Then for the first player and second player I check if they are on and if they are than go to that direction...I think I would need a timer for that part but I dunno...