I'm making a game with pictureboxes. Basically, the idea is, I can drop food with the e button, and I dynamically create a picturebox with this code:
Well, I want to walk over it and hit e, and make it go invisible. What I tried doing was doing this in keydown:
And that doesn't work. Any ideas?
Code:
Dim food As New PictureBox
Me.Controls.Add(poop1)
food.Width = 32
food.Height = 32
food.Image = My.Resources.poop
food.Top = character.Top
food.Left = character.Left
food.Parent = background
food.BackColor = Color.Transparent
food.BringToFront()
food.SendToBack()
Code:
If e.keycode = Keys.E Then
If food.Top = character.Top and food.Left = character.Left Then
food.Visible = False
End If
End If