Quantcast
Viewing all articles
Browse latest Browse all 6

Using Arrow Keys

In the game I'm coding, the user controls his "cycle" with the A,S,D, and W keys. I wanted to use the arrow keys, but I could not get the program to acknowledge them.

My current code looks like this, but I would like to replace the letter keys with the arrow keys:

Sub MoveCycle
key= GraphicsWindow.LastKey
If (key= "D") Then
delY=0
delX= 12
ElseIf (key= "S") Then
delY=12
delX=0
EndIf
EndSub

The actual code continues with the other two keys, and adresses the direction of the "cycle", but I didn't think they were necessary to mention. I think my problem is that I don't know how to address the arrow keys so the the program will know what I'm taking about. I tried using "Up" and "UpKey" instead of "W", but that rendered my cycle motionless. Any help would be greatly appreciated.

Note: I have done some more research, and it says Down, Up, Right, and Left should work. Should they be in quotation marks around the like the letter keys (e.g. "W")? I feel like this has something to do with my problem.


Viewing all articles
Browse latest Browse all 6

Trending Articles