The below code limits movement to a single axis giving preference to the y axis. Arrange it with left and right first and you will give preference to the x axis.
; I make UP, DOWN, LEFT, RIGHT global variables that can be defined as any key.
;This is great as it allows for user defined keyboard set ups.
If keydown(UP) Then
; add code here to move object accordingly
ElseIf keydown(DOWN) Then
; add code here to move object accordingly
ElseIf keydown(LEFT) Then
; add code here to move object accordingly
ElseIf keydown(RIGHT) Then
; add code here to move object accordingly
EndIf
|