LoginLogin

Help with triggering sprite animations

Root / Programming Questions / [.]

ninja12Created:
Hi, I'm trying to trigger/activate a uv spanim animation loop for my enemy function. Whats the best practice for this. I notice spanim is not too friendly in loops. Thanks

Hi, I'm trying to trigger/activate a uv spanim animation loop for my enemy function. Whats the best practice for this. I notice spanim is not too friendly in loops. Thanks
SPANIM in a loop can work. You can check the animation status in the loop and, if no animation, SPANIM. Example:
LOOP
 IF !SPCHK(0) THEN SPANIM 0,”I”,4,1,4,2,4,3,4,4,1
ENDLOOP
You’ll have to check the return values for SPCHK for specific animation. This method also gets a bit trickier if using multiple types of animation on a single sprite, but you would modify the check a bit.

Ok I tried the above code to test and I'm getting the same results as before, the animation plays when I stop the program. It looks like the frame 1 is on loop. I have an idle animation and a walk animation, not sure how to trigger these animations when lets say move==true triggering the execution once. My enemy_move function holds the movement ai information. I'm working on the 3ds if that matters. Thanks