Click to See Complete Forum and Search --> : need help on moving picturebodx with up and down keys and so on and other stuff
XxEvilxX
Jan 19th, 2000, 12:19 PM
how cna i move a picture box if they press up it goes up and down and it goes down and also how can i make it where it wont go close to any lines like if it get to a line it wont go that way like on pac man and it wont go past the form also how cna i do all that please help me please
thanx
justin
Joacim Andersson
Jan 19th, 2000, 07:04 PM
Set the KeyPreview property of the Form to True. Then add code to the KeyDown event of the Form.
Select Case KeyCode
Case vbKeyUp
Picture1.Top = Picture1.Top - 15 'or whatever
Case vbKeyDown
Picture1.Top = Picture1.Top + 15
Case vbKeyLeft
Picture1.Left = Picture1.Left - 15
Case vbKeyRight
Picture1.Left = Picture1.Left + 15
End Select
Good luck!
------------------
Joacim Andersson
joacim@programmer.net
joacim@yellowblazer.com
www.YellowBlazer.com (http://www.YellowBlazer.com)
XxEvilxX
Jan 20th, 2000, 09:40 PM
and how do i do the other stuff
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.