Skip to content
Discussion options

You must be logged in to vote

I managed to learn how to do it by using autoloads and a dictionary to store the node names and their related animations. For those who are very fresh beginners to godot like me, I created a ChickenManager autoload script, which can be generalised to an animation manager later:

ChickenManager.gd:

extends Node

var chickens: Dictionary = {}  # Store chickens by name

func register_chicken(name: String, chicken):
	chickens[name] = chicken

func unregister_chicken(name: String):
	if name in chickens:
		chickens.erase(name)

func animate(char_name: String, animation_name: String):
	if char_name in chickens:
		chickens[char_name].play_animation(animation_name)

and added this script to my chic…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Harushii18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant