Godot: Rename the method stop() to pause() in AnimatedSprite.

Created on 7 Aug 2019  路  9Comments  路  Source: godotengine/godot

Usually the word stop is used when you wanna pause something and when you continue with it, it will start from the beginning. Instead the word pause is used when you wanna continue with the thing from where you left it. You can read more here if it's not clear:
https://www.differencebetween.com/difference-between-pause-and-vs-stop/

Right now, the method stop() in AnimatedSprite is working as a pause (it is even stated in the documentation saying it doesn't reset the frame counter), so what i propose is to change the name of the method stop() to pause.

https://docs.godotengine.org/en/3.1/classes/class_animatedsprite.html#class-animatedsprite-method-stop

In case you wanna keep the method stop, then after the pause, you should set the frame of the animation to zero, but for that we could open another issue.

archived breaks compat discussion enhancement core

Most helpful comment

This should be consistent with AnimationPlayer. It has void stop ( bool reset=true ), so stop(false) is a pause and continuing is done with play() (with the default arguments).

Worth noting that you can specify the initial position/time in AudioStreamPlayer2D.play(from_position) and Timer.start(time_sec)', so maybeAnimatedSprite.play()andAnimationPlayer.play()` could use a similar argument?

All 9 comments

I agree, stop should set it back to the beginning. Although, I would imagine this would break compatibility. Perhaps a boolean parameter can be added to stop which defaults to false, meaning it will stop animation but not reset the frame. That way it will work the same and not break compatibility. It will still "pause", but if you want to stop the animation and reset to the beginning, you can do something like: stop(true) which would reset the to the beginning.

Or maybe you can supply a frame number to stop and -1 would keep it on the current frame.

This should be consistent with AnimationPlayer. It has void stop ( bool reset=true ), so stop(false) is a pause and continuing is done with play() (with the default arguments).

Worth noting that you can specify the initial position/time in AudioStreamPlayer2D.play(from_position) and Timer.start(time_sec)', so maybeAnimatedSprite.play()andAnimationPlayer.play()` could use a similar argument?

the parameter for stop (bool reset = true) makes the stop/pause issue objective
if you need stop functionality, set it to true and it'll reset

this is good i think.

Having stop() and pause() is self-explanatory as this is widely spread knowledge in many other areas of living.
stop(bool) is something the user has to learn. "What's that supposed to mean, a stop, but not really?"
4.0 is breaking compatibility in many areas, if we have a chance to make GDscript more intuitive and self-explanatory, this is it.

Just wanted to comment, the documentation might be wrong (well I guess it is right, but the overall effect is wrong). Stop acts as a pause, but when you play(), the frame resets to zero.

AnimatedSprite::play() calls AnimatedSprite::set_animation(), which in turn resets the frame to zero.

I am still very confused can someone write out an example for a novice. where and how do you set the parameter stop (bool reset = true)

Similarly, AnimatedSprite3D also uses the name stop() and mentions that it doesn't reset the frame counter: https://docs.godotengine.org/en/3.2/classes/class_animatedsprite3d.html#class-animatedsprite3d-method-stop

Closing, as this renaming request is now tracked in #16863.

Note there is also this proposal for further discussion:
https://github.com/godotengine/godot-proposals/issues/287

Was this page helpful?
0 / 5 - 0 ratings