0 votes

As mentioned above, I am wondering if I should use:


every time I make a change in animation, or should I use:


to immediately switch into new one?
I have no idea if either of these two are bad habits, so would like to know some opinion on that.
As an example, is doing something like this correct for Godot?

if movement_dir != 0:
Godot version 3.4.4
in Engine by (12 points)

for this

if movement_dir != 0:

of course it is right

1 Answer

+2 votes

In my opinion, it depends on what your design plans for your game is.

  • If you plan to have a complex system around animations start and ends, I'd recommend keeping a distinction between finishing an animation and overriding an animation by playing a new without stopping the previous one.
  • If you plan to have a relatively simple system, I think either approach could work. In particular, if you plan to never to anything in response to an animation ending, you could get away with stopping the animation every time you play a new one.

Below are examples of situations where you probably want to avoid stopping the animation before playing a new one:

  • Having special animations that can only be played after a specific animation finishes (multi-jab attack by spamming the same button, like in Smash Bros., for example)
  • An animation you have might bet punished (super meter, coins, stun, etc.) if it finishes (timesout) without accomplishing anything (e.g., hitting something, landing somewhere, picking up something). So it would be important to distinguish the different between that animation during elapsing (finishing) and being overrided (or canceled) into another animation. In this example, suppose the animation that punishes you for failing to accomplish a goal before the animation ends allows specific animation to cancel it to avoid the punish. Maybe you could jump-cancel (play the jump animation without the original animation finishing) to avoid the punishment . In this case, if you decide to always stop an animation before playing a new one, you will need additional logic to support my above example.
by (518 points)

Excellent answer.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.