LoginLogin
Might make SBS readonly: thread

[Actually I figured it out before posting] Need help STOPPING a sprite animation, not its ability to be animated

Root / Programming Questions / [.]

randoCreated:
Hey, so I’m like programming or something and I’m trying to animate my player sprite so it looks like it’s walking. I’ve got something like this:
DEF P_ANIM SX,SY’SX and SY are circle pad coordinates
 IF SX>0 && (SPCHK(0)!=#CHKI || P[4]<0) THEN’P[4] represents the player’s x-velocity component
  SPANIM 0,”I”,”@P_RIGHT_WALK”
 ELSEIF SX<0 && (SPCHK(0)!=#CHKI || P[4]>0) THEN
  SPANIM 0,”I”,”@P_LEFT_WALK”
 ELSEIF SX==0 && SPCHK(0)==#CHKI THEN
  SPSTOP 0’!!!
 ENDIF
END

@P_RIGHT_WALK
‘Unimportant animation stuff :)
The big problem I see is with SPSTOP. It seems to put the sprite in a state of not being animated at all until SPSTART is called, even if I call SPANIM in order to start the animation again. The question is, is there a way to stop an animation without changing the sprite’s ability to be animated? And as I just figured out, there is, and tbh it’s kind of not very intuitive, at least the way I see it. But it is possible and makes sense.
SPSTOP 0 -> SPCHR 0,496
Instead of calling SPSTOP, I just had to use a different sprite function to set that specific trait of the sprite to a resting state. In this case, since I was animating the sprite’s definition number, I just reset that to the “not walking” sprite. And now it works how I want it to. My last question is what are some practical applications of SPSTOP? I can think of maybe a few situations where it might be useful, such as in an interactive cutscene where you want to stop everything until the player presses a button or something, but other than that I can’t think of anything.

My last question is what are some practical applications of SPSTOP? I can think of maybe a few situations where it might be useful, such as in an interactive cutscene where you want to stop everything until the player presses a button or something, but other than that I can’t think of anything.
The best application I can think of is a pause menu. If you set the sprite’s animation loop to 0, it will animate indefinitely. This looks pretty choppy if your pause menu overlays the screen. You could include a conditional animation stop in a sprite function (that is called every frame in the main loop), but it would be much more simple/cleaner to use SPSTOP. Edit: in one of my wip games that I might not continue, there is a “time stop” spell that stops the animation and movement of all sprites. That’s a neat application too.