Moving Diagonally

Blitz3D Forums/Blitz3D Beginners Area/Moving Diagonally

Hello hello,

I was wondering how one would get a sprite to move diagonally. I tried doing a "If keydown(up) and keydown(right) then..." type thing, but that doesn't seem to work.

Right now it's just one large if statement determining what direction you're pressing and will later include a "fire" button as well as a "bomb" button.

While Not KeyDown(1)

If KeyDown(up) Then
	ship_y = ship_y - ship_speed
	DrawImage gfxship,ship_x,ship_y
ElseIf KeyDown(Left) Then
	ship_x = ship_x - ship_speed
	DrawImage gfxship,ship_x,ship_y
ElseIf KeyDown(Right) Then
	ship_x = ship_x + ship_speed
	DrawImage gfxship,ship_x,ship_y
ElseIf KeyDown(down) Then
	ship_y = ship_y + ship_speed
	DrawImage gfxship,ship_x,ship_y
Else
	DrawImage gfxship,ship_x,ship_y
EndIf

Flip
Cls

Wend


Thanks!