Hi all,
I am starting a project and am having problems with sprite movements using the keyboard.
My human sprite has a left walking movement and a right one
6 each way on a sprite sheet.
I can get it moving Left & Right, but I want to limit the animation
when no left and right arrows are not being pressed, but in the code below I get no animation at all.
What am I doing wrong, any idea's please.
// check for Left Arrow input
Lkey=GetRawKeyPressed(37) ` Left arrow
if Lkey=1 then
PlaySprite ( Pirate_Sprite, 10, 1, 1, 6 ) //6 animations Left
Pirate_Direction = 1
// check for Right Arrow input
Rkey=GetRawKeyPressed(39) ` Right arrow
if Rkey=1 then
PlaySprite ( Pirate_Sprite, 10, 1, 7, 12 ) //6 animations Right
Pirate_Direction = 2
Lkey=GetRawKeyPressed(37) ` Left arrow
Rkey=GetRawKeyPressed(39) ` Right arrow
if (Lkey=0 and Rkey=0) and (Pirate_Direction = 1) then
PlaySprite ( Pirate_Sprite, 10, 1, 1, 3 )
Lkey=GetRawKeyPressed(37) ` Left arrow
Rkey=GetRawKeyPressed(39) ` Right arrow
if (Lkey=0 and Rkey=0) and Pirate_Direction = 2 then
PlaySprite ( Pirate_Sprite, 10, 1, 7, 9 )
Many Thanks