i am trying to create a videogame but im having trouble moving a picture.

what im trying to do is move a picture called mario left, right, down, up...
im trying to use the arrow keys...

i dont have much experience either. everytime i press the up key the picture goes randomly to a certain spot. Everytime i press it it goes to the same spot >.>

help me~

Private Sub picmario_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyRight
'this will move mario right
picmario.Move picmario.Left - -50
Case vbKeyLeft
'this will move mario left
picmario.Move picmario.Left - 50
End Select

Select Case KeyCode
Case vbKeyUp
picmario.Move picmario.Top - 50
End Select
End Sub

also the left and right arrow keys work.....but not the up and down...

if possible can u help me doing the keyascii way?

Why two select statements? Where is vbKeyDown? Then, when intellisence comes up for your vbKeyUp, why are you trying to set the left property and not the top property, which if you have read the intellisence is the next arguement...

Good Luck

i dont need help guys i was able to figre it out:D

i did:

Private Sub picmario_KeyPress(KeyAscii As Integer)
'this will allow the user to use various keys to
'move mario
'this will move the mario up using the 8 key
If KeyAscii = 56 Then
picmario.Top = picmario.Top - 100
End If
'this will move mario down using the 2 key
If KeyAscii = 50 Then
picmario.Top = picmario.Top + 100
End If
'this will move mario left using the 4 key
If KeyAscii = 52 Then
picmario.Left = picmario.Left - 100
End If
'this will move mario right using the 6 key
If KeyAscii = 54 Then
picmario.Left = picmario.Left + 100
End If
End Sub


------
i made it so complex for myself before >,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.