How can I modify the animation speed in an AnimatedSprite in Godot? C# user

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By martinlizo

Hi, I’m trying to modify the speed of an AnimatedSprite.

		AnimatedSprite sprite = (AnimatedSprite)GetNode("sprite_name");
	sprite.Play(animName, false);

That works well, but not this:

sprite.SpeedScale=0f;

I also tried this but it doesn’t work either

sprite.SetSpeedScale

Is there anyway to manually modify the speed of the sprite? It’s a very basic task in my opinion, it can’t be that hard…

:bust_in_silhouette: Reply From: Zylann

SpeedScale seems to be the property to use, I don’t know why it doesn’t work for you.
SetSpeedScale is the same as assigning SpeedScale (it’s just the internal setter used in the property).

You could also change Frames.SetAnimationSpeed("Anim Name", speed), but if you re-used the same SpriteFrames resource elsewhere (or duplicated the node) it will change it everywhere it’s used.

Note: setting SpeedScale will have no effect if the animation is not playing already. i.e doing SpeedScale = 1f will not start the animation, and 0f will not stop it.