Jump to content
Xtreme .Net Talk

jusanthermemory

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by jusanthermemory

  1. I used the first code you provided. that should be what I need but its still not quite working right. I have this right now. Me.Controls.Remove(ball1) ball1.Dispose() EDIT: didnt quite explain what wasnt working... heh well the image dissapears and looks to have gone away but the boundaries for it are still there. when I move over that spot the collision detection kicks in even though the object is supposedly gone. is there something I need to put into the dispose parenthesis or am I writing it wrong? im not familiar with it
  2. is there a way to completly remove a picturebox from a form while its running? Im making a game and its drawing pictures and when a button is clicked I need it to completly delete the pictureboxes. im using visual basic .net any help is greatly appreciated.
  3. at the very top I declared my array as a picture box Dim pictureArray(100) As PictureBox then in the timer I have the array collision which is the code you gave me For I As Integer = 0 To pictureArray.Length - 1 'Test for collision If player.Bounds.IntersectsWith(pictureArray(I).Bounds) Then 'Do things here. i Is the index of the picture with which we collided. MessageBox.Show("Holy Crap! I hit pictureArray(" & I.ToString() & ")") End If Next in the function that draws the array I have this code: ReDim Preserve pictureArray(pictureArray.Length) pictureArray(pictureArray.Length - 1) = New PictureBox 'location of picturebox pictureArray(pictureArray.Length - 1).Left = 114 + locationleft pictureArray(pictureArray.Length - 1).Top = 25 + locationtop 'width and height of picturebox pictureArray(pictureArray.Length - 1).Width = 9 pictureArray(pictureArray.Length - 1).Height = 9 'image for picturebox pictureArray(pictureArray.Length - 1).Image = Image.FromFile("ball.jpg") Me.Controls.Add(pictureArray(pictureArray.Length - 1)) thanks again for your help
  4. ' Loop through pics For I As Integer = 0 To PictureArray.Length - 1 'Test for collision If Player.Bounds.InstersectsWith(pictureArray(i).Bounds) Then 'Do things here. i Is the index of the picture with which we collided. MessageBox.Show("Holy Crap! I hit pictureArray(" & i.ToString() & ")") End If Next I forgot to mention that I have the array counting down from 100. so I get the error when I run the program. I tried to change some of the things around but I still get errors when I move my picture (the one im controlling not the one that is in the array). when I do this: For I As Integer = PictureArray.Length - 1 to 100 'Test for collision If Player.Bounds.InstersectsWith(pictureArray(i).Bounds) Then 'Do things here. i Is the index of the picture with which we collided. MessageBox.Show("Holy Crap! I hit pictureArray(" & i.ToString() & ")") End If Next I don't get an error but the collision doesnt work at all. thanks for your help
  5. im trying to set up a collision between a picturebox and an array of pictures but I can only get the collision to work with the newest picture in the array. how would I go about getting the collision to work with every image in the array. heres my collision at the moment: If player.Bounds.IntersectsWith(pictureArray(pictureArray.Length - 1).Bounds) Then End If I think I need to loop it but im having trouble coming up with a way to add this to a loop. thanks for any help
  6. I'm sry but I don't really understand how to use that code. If you dont mind could you please give me a sample of how to use it? thanks for your help and sry its taken so long to reply
  7. Im trying to get my collision detection to work and the picture boxes move in certain directions when they hit each other. Is there anyway to change this code so that It specifies a certain side? If Me.linkviewer.Bounds.IntersectsWith(enemyviewer.Bounds) Then Me.linkviewer.Left = Me.linkviewer.Left + 100 Me.enemyviewer.Left = Me.enemyviewer.Left - 100 End If so if linkviewer hit enemyviewer on the right, linkviewer would go left and enemyviewer would go right and vice versa. same for top Thanks for any help
×
×
  • Create New...