LoginLogin

SPANIM Help

Root / Programming Questions / [.]

user_413xCreated:
Hey, guys. I would appreciate some help on getting my sprites animated with the SPANIM instruction. Basically I just want to know how to make it so I can press down on the D-pad and my character does a walking animation while moving. My code looks like this so far: [ SPSET 0,500:SPOFS 0,X,Y B=BUTTON() IF B AND #DOWN THEN Y=Y+1: SPANIM 0,60,48,144,60,64,144 ] However, when I use the SPANIM, my sprite gets stuck on the first frame rather than looping through the second one. I can't seem to figure out how to fix this so any feedback would be greatly appreciated. Thanks!

It keeps starting the animation, so you might want to change the code so that SPANIM only gets run once.

Forum protip: wrap your source code in code tags. (Quote my post to see the formatting source.) Secondly, you can make multiple-line IF statements in SB, so no more having to put it all on one line.
SPSET 0,500:SPOFS 0,X,Y
B=BUTTON()
IF B AND #DOWN THEN
 Y=Y+1
 SPANIM 0,60,48,144,60,64,144
ENDIF