Game Programming :: Resetting The Locations Of An Array Of Picture Boxes?
May 26, 2011
I have created this code to reset my picture boxes to default locations upon form load.
my sub:
Code:
Sub reset_Alien_locations()
Dim Xlocation As Integer = 26
For segmentIndex As Integer = 0 To AlienArray.Length - 114
[Code]...
I have this sub load up upon form_load event. Yet it doesn't do a thing! I want each picture box to appear on the same row, hence the y axis is set to 49. but I want my X-axis to be added by 30, so that there is a gap of 30 pixels between each picture box, hence the x point is: Xlocation = Xlocation + 30
View 2 Replies
ADVERTISEMENT
Jun 4, 2012
I am all new to Visual Basic 2008, I am trying to create a picture shuffle game, the problem is I cant seem to be able to move one picture from PictureBox1 to PictureBox2 onClick, here is a Code I written earlier:Sub ChangePicture(ByRef P1 As PictureBox, ByRef P2 As PictureBox)
[Code]...
View 1 Replies
May 24, 2011
I have made a For next loop with an array. I want all my picture boxes to follow each other within the loop. I have currently been using old code, but not in a loop or array format. The old code works. The array code only makes the 2nd picture box follow the FIRST one. It doesn't loop the rest. I have checked the code and cannot determine any mistakes, else I'm missing out on something I haven't been taught.[code]...
View 17 Replies
Dec 30, 2009
Ok, so I'm making a simple breakout game, using picture boxes as I didn't want to bother installing picture boxes.Every movement works perfectly fine; the pad moves correctly, the ball bounces right. Except when I move the pad while the ball is moving.If I move the pad while the ball is moving, the ball moves at the same speed as the pad, which is 10 times the speed of the ball.Well here's the movement code.
Code:
Public Sub Movement(ByVal Movement As String) ' Handles movement
If Not IsPlaying Then Exit Sub
[code]......
View 2 Replies
Dec 15, 2010
I am making a game where a car picture box has to follow a mouse. to start the game you click the car but when i click the car the car moves down away from the cursor. then it starts following the cursor but is still about 2 cm below the cursor and a little to the side.
[code]...
View 3 Replies
May 13, 2008
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]
View 3 Replies
Dec 19, 2009
Im New To VB and i was wondeing how do you make a picture box bounce from the sides of the form.
View 8 Replies
Feb 9, 2011
How do I keep my picture box from leaving the form screen and how do I make it 'bounce off the walls" when it hits one edge of the form?
View 4 Replies
Feb 19, 2009
I need to make a picturebox, panel animate from a small 25x 25 to 100x 100 in size but cant seem to set the properties right im using a for loop
-----------buttonclickevent------------
dim myx as new point
for i as integer 1 to 50
myx += 2
[code]....
and i get so many errors?
View 3 Replies
Jan 13, 2011
I have a picture box and I tell it to appear on a random location on another specified larger picture box.
here's my code:
Code:
Sub P2_AppleMove()
Dim P2ax As Integer = CInt(Int((P2Foodarea.Width * Rnd()))) ' sets the random area of the food
[Code]....
P2foodarea is a large picture box I created. I only want the apple to spawn on P2Foodarea, atm, it spawns on P1Foodarea which is very weird. P1foodarea is a whole other picture box. I even made new variables as you can see P2ax and P2ay, but it still doesn't spawn on P2Foodarea. I have even tried recreating a new picture box for P2foodarea
View 12 Replies
Jan 20, 2011
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?
View 5 Replies
May 1, 2010
I am trying to create a slot machine application. I wanted to make a handle like gui so here is what I have:
[URL]
What I want is to be able to let the user drag the red button till a certain point and when they let go of the mouse click the button moves back slowly to the top.Here is what I have so far (I tried my best) :
Private Sub picBall_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles picBall.Click
tmrOne.Enabled = True
tmrTwo.Enabled = True
[code].....
View 3 Replies
Aug 20, 2011
I have VS 2008 and use VB, not C#/C++ or whatever else. I'm trying to make a battleship game, and I've decided to use the only method I can think of to control the grid. A 2D boolean array for position marking. I have the array set up, and the grid set up in the design form, but I can't figure out with all my research how to link them together. I'm writing this program to shake off the rust before school starts again, and for fun. I took VB in school last year, a half year class, so I have a foundation, now I'm self-educating myself above and beyond the class. I've searched for a way to use a picture box array to use the coordinates of the ship to .Visible=True the picture boxes. I've been working on this for 2 days straight with no results. I just need a little nudge in the right direction. The exception I've been getting with my latest concoction of code is NullReferenceException was Unhandled. I think its referring to the fact that I have no idea how to link the picture boxes into the array. Here's my code, and I'll comment where the exception is thrown:
Private Sub cmdStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdStart.Click
'label for GoTo statements is Tryline:
[Code].....
View 14 Replies
Apr 20, 2008
i need to loop through 9 Buttons in a Tic Tac Toe program to reset my O&X's, rather than setting each button.text individually, how can i loop through these?
View 4 Replies
Apr 20, 2009
I have a multi-dimensional array storeHand(20,6) which stores 6 ints. The int at point 0 in each array represents a rank. So the array ends up looking like this:
(7, 0, 0, 3, 5, 7)
(6, 2, 3, 0, 6, 5)
(5, 0, 0, 0, 13, 4)
(8, 0, 0, 0, 0, 3)
(2, 0, 0, 0, 0, 1)
I want to re-order the array so that the higher the integer value at position 0 is, the higher it's position will be in the sortedHand(20,6) array. So as above, I'd want sortedHand(20, 6) to look like this at the end:
[Code]...
View 1 Replies
Jun 7, 2010
How do I put all my labels in my form in an array???
I have labels on my board game squares and I need them to be in an array.
View 3 Replies
Oct 6, 2011
I need an indexed set of picture boxes. The number, n, of these objects is determined at run-time.Migrating from VB6!! I had used the load command n times to create a control array from a "seed" picture box. In code the individual pictureboxes are accessed as formula(k), where formula was the name of the control array and k is an integer. Examples can be seen at url... the chemical formulae, Ni2+ etc., are draggable picture boxes (curve captions if you like), so that they can be placed wherever the user wants.How can I implement something similar in VB.NET?
View 9 Replies
May 4, 2008
The code below is the entire class that has the error in it... the errored code is highlighted in red. The error is,'ReDim' cannot change the number of dimensions of an array.
Code:
Public Class clsMap
Dim SR As System.IO.StreamReader
Public Width As Integer
Public Height As Integer
[code]....
View 1 Replies
Jan 23, 2010
I have some operations of Picture Boxes etc being performed. After the user finishes with the formatting, I want to give the user an option to print the work.But its the work is not done on the Rich Text Box but on picture boxes. I am not even sure, how many of the picture boxes would be there after the user finishes the job, since I have provided option for dynamically creating picture boxes as well.
View 3 Replies
Sep 30, 2009
Im working on a roguelike console RPG. For those of you that dont know, just google search it.What I need help with is that I have an string array called ArrMap(0 to 19) that holds the 20 rows of each map for display. I also have an array of the same size called VisibleMap that needs to hold which portions of the map are visible and which arent so that when the player switches screens [IE goes from map, to inventory] they can go back to the map and it will look the same. I was thinking of using an array, but if you can think of another way to do it, that's fine.Here are the subs that deal with the map reading and display, so you know how I have things set up at the moment.
Code:
Public Sub ReadMap(ByVal location As String)
Dim ioFile As New StreamReader(location)
Dim ioLine As String
Dim intX As Integer
[code].....
View 6 Replies
Jan 27, 2012
how i can make this code shorter:
Dim reminderday As Integer = 13
Select Case reminderday
Case 1
[Code]....
Maybe i should to somehow make an array list of all 30 Picture boxes?
View 3 Replies
Jan 27, 2010
when your resetting a form is it possible to deselect or not keep high lighted the item that was previously selected from the last entry. I know how to clear the text boxes but the items in the list boxes stay highlighted. Is it possible to get back to the initial setting of having nothing selected as when you first start debugging?
View 5 Replies
May 12, 2012
I want to get all picture box locations. I am remotly creating them so i couldent just get each one individualy.
View 2 Replies
Apr 2, 2008
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?
View 4 Replies
Oct 3, 2011
Im new to VB. how do I get to add the score.my code is
[Code]...
View 6 Replies
May 4, 2011
I have created a scrabble game that generates random letters. For the user to type in a word using the random letters they have to type it in a text box.
I want my program to prevent users from typing in letters that are not provided in the text box and to allow them to type in the random letters that are provided.
View 4 Replies
Feb 16, 2011
I'm trying to make a simple fruit machine game for windows mobile device.
I can create the game easily enough and flip through pictures in a picture box to display the correct symbol.. but what I'd like to do is do a proper spinning reel, but have no idea where to even start.
What I have is a list of images in an imagelist (or individual files) - what I'd like is them attached to each other and moving downwards, preferably as though it were going around a drum but just them moving would be a start.
View 7 Replies
Feb 1, 2010
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
View 2 Replies
Apr 18, 2012
On programming assignment without having any real experience in vb. I guess I don't understand subroutines that well. When the program runs it never goes to the computer's turn and does not update the users score either. This assignment is already in but would like to know what is going wrong. Using VB 2010, and this is windows application.
Code:
Public Class Form1
Dim Myturn As Integer
Dim Computerturn As Integer
[CODE]...
View 6 Replies
Apr 30, 2011
Upon changing the field size a game should restart. Upon trying to do so I see the previous grid (e.g. 10x10) displayed on top of the new one (e.g. 4x4). How would I prevent this and indeed start the game fresh?
View 10 Replies