Author |
Message |
Darkmantis
![](http://compsci.ca/v3/uploads/user_avatars/26883420945d0bc0dc57ea.jpg)
|
Posted: Tue Dec 06, 2005 6:07 pm Post subject: I need help |
|
|
How make stuff move around using the arrow keys? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
pavol
|
Posted: Wed Dec 07, 2005 10:21 am Post subject: (No subject) |
|
|
lets say your 'stuff' is a shape called shpBox. in the form_keydown procedure. you could use some code like this:
code: | Select Case vbKeyCode
Case vbKeyUp
For i = 1 To 100
For j = 1 To 1000000
shpBox.Top = shpBox.Top - 100
Next j
Next i
End Select |
the for loop just simply moves the object but the part that makes shpBox move up using the arrow key is select case vbkeycode case vbkeyup. vbkeyup is used for the up arrow key, vbkeydown for the down arrow key and so on.
hope this helps |
|
|
|
|
![](images/spacer.gif) |
Darkmantis
![](http://compsci.ca/v3/uploads/user_avatars/26883420945d0bc0dc57ea.jpg)
|
Posted: Wed Dec 07, 2005 12:03 pm Post subject: (No subject) |
|
|
umm when I press any key the object goes up, how do I make it just move up with the up arrow key? |
|
|
|
|
![](images/spacer.gif) |
pavol
|
Posted: Thu Dec 08, 2005 10:13 am Post subject: (No subject) |
|
|
forgot to include that part
to make it go up you use the code shpBox.Top = shpBox.Top - 100(or whatever speed you choose), down would be shpBox.Top = shpBox.Top +100, left : shpBox.Left = shpBox.Left -100, and right : shpBox.Left = shpBox.Left +100 |
|
|
|
|
![](images/spacer.gif) |
Darkmantis
![](http://compsci.ca/v3/uploads/user_avatars/26883420945d0bc0dc57ea.jpg)
|
Posted: Thu Dec 08, 2005 12:44 pm Post subject: (No subject) |
|
|
ok thx a lot |
|
|
|
|
![](images/spacer.gif) |
|