Moving Diagonally

Blitz3D Forums/Blitz3D Beginners Area/Moving Diagonally

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

It works also on that way:


Graphics3D 640,480

cam = CreateCamera()
MoveEntity cam,0,0,-5

sp = CreateSprite()
RotateSprite sp,20

While Not KeyDown(1)

If KeyDown(200) And KeyDown(205) Then
;this statement first, otherweise each of those two
; would be catched either by
; If KeyDown(200)... or
; If KeyDown(205)...
MoveEntity sp,.1,.1,0

ElseIf KeyDown(200) Then ; up
MoveEntity sp,0,.1,0
ElseIf KeyDown(203) Then ;left
MoveEntity sp,-.1,0,0


ElseIf KeyDown(205) Then ;right
MoveEntity sp,.1,0,0

ElseIf KeyDown(208) Then ;down
MoveEntity sp,0,-.1,0
EndIf

RenderWorld
Text 10,10, "UP : " +Str$(KeyDown(200))
Text 10,30, "RIGHT : " +Str$(KeyDown(205))
Text 10,50, "DOWN : " +Str$(KeyDown(208))
Text 10,70, "LEFT : " +Str$(KeyDown(203))


Flip

Wend
End