#How to exit the attack animation and return to idle and run
11 messages · Page 1 of 1 (latest)
Current animation:
Current Code:
Derek_2.gd
Derek_3.gd
I even tried adding a timer to stop the attack animation and return to normal. But it didn't work. Note godot I'm using is 3.5.3
*I wanted to use the latest versions, but my teacher wanted everyone to use that version *
Have you tried creating a function to invoke your animation player corresponding to each animation sequence?
func do_run():
animation_mode.travel("Run")
func do_walk():
animation_mode.travel("Walk")
func do_idle():
animation_mode.travel("Idle")
Then at the end of the Player/Functions call method track call your function.
It might also be worth taking a look at the AnimatedSprite object.
https://docs.godotengine.org/en/3.5/classes/class_animatedsprite.html
Those have a signal, called "animation_finished()", that is called at the end of an animation cycle.
Inherits: Node2D< CanvasItem< Node< Object Sprite node that contains multiple textures as frames to play for animation. Description: AnimatedSprite is similar to the Sprite node, except it carries ...
ohh thanks a lot man !!! I'll do everything you said !!
You might want to take a look at this section of your code too:
animation_mode.travel("Run")
else:
animation_mode.travel("Walk")
else:
animation_mode.travel("Idle")```
The if/else/else needs to read if/elif/else.
https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_basics.html
if bool_thing1:
...
elif bool_thing2:
...
else:
...
GDScript is a high-level, object-oriented, imperative, and gradually typed programming language built for Godot. It uses an indentation-based syntax similar to languages like Python. Its goal is to...