Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | mmarramarco | |
Old Version | Published before Godot 3 was released. |
I am currently learning Godot, and I am more precisely learning how the animation process works in this engine.
My problem is : I succeed in making a script animate my character, but if I do the same thing from a parent, it doesn’t work.
So this work in my AnimatedSprite object :
extends AnimatedSprite
func _ready():
set_process(true)
func _process(delta):
play("idle")
And if I do this in it’s parent, it doesn’t work and my player is static :
extends KinematicBody2D
onready var sprite = get_node("anim")
func _ready():
set_fixed_process(true)
func _process(delta):
sprite.play("idle")
I already check that every name are correct, I know the binding of the frame works (because the code at the top make my animation goes).
I just can’t get what I’am doing wrong, I am strongly suspecting the “get_node()” method. Before you ask, I alredy tried different path (such as the absolute path from the root).
Thanks for your time.