Can someone write me a godot scene, where animation plays, when the button is clicked?
How to make an animation per button-click
Well, I would highly recommend going through some Godot tutorials and other learning material, as getting help without knowing how it works isn't that helpful in the long run, but to answer your question: You just need to connect the pressed
signal from a Button node to a script, and then in that script have the function tell an AnimationPlayer node to play. Something like this (untested, super simple example):
extends Node
func _ready():
get_node("Button_Here").connect("pressed", self, "on_button_pressed")
func on_button_pressed():
get_node("AnimationPlayer_Here").play("Animation_Name_Here")
do you recommend a tutorial? I don't know where to start
I would recommend reading through the Step-by-step section of the Godot documentation if you already have some programming and game development experience, as it can help get you up to speed on Godot specific things and how common stuff is done in Godot.
I have heard that GDQuest, HeartBeast, KidsCanCode, and other popular Godot tutorial makers are great for beginners. I have not personally gone through much of their material, but I've been using Godot for years now, so I'm not sure what beginner material to recommend other than I have heard good things about the makers I mentioned. Others may have better recommendations.