Topic was automatically imported from the old Question2Answer platform.
Asked By
sihela
so i have two animation in one scene but i cannot change animation to another animation
i mean i want when a button (screen) pressed the want to be changed to another animation
here is my code
extends TextureButton
onready var anim = get_node("AnimationPlayer")
##i connected to button node (presssed)##
func _on_TextureButton_pressed():
anim.current_animation("starting")
If you don’t understand sorry i am very poor at explanation.if you have a question tell me
the function current_animation returns the current animation but if you want to start a animation use anim.play(animation name: string)
Hey mdubalsl i have done it what you said but unfortunately it doesn’t work
here’s the code again!,
extends TextureButton
onready var anim = get_node("AnimationPlayer")
##i connected to button node (presssed)##
func _on_TextureButton_pressed():
anim.play("starting")
sihela | 2020-08-29 05:51
The code now appears correct, your problem is likely elsewhere. Signal is not connected to that function, no animation keyframes, etc.
avencherus | 2020-08-29 09:59
hey avencherus sorry for late response and also i am extremely sorry i check the signal it but it connect and i again reconnect it but the answer is no. i have done research about it and found something weird .you know when Godot is opening a console will also opened so ummmmm when i run (game) i can see ERROR: Node not found: AnimationPlayer.
in the console but i can seeAnimationPlayer on the project is this a bug or something?
sihela | 2020-09-02 12:03
If you believe it to be a bug, then consider submitting a bug report with a minimal project showing the problem: Issues · godotengine/godot · GitHub