Random sprites and their animations for each instance

Godot Version

Godot 4


I am assuming that it’s a bad idea to make a scene for each individual enemy sprite and then just drag them into my main scene randomly. Instead i had the idea of if i could possibly have one scene where i set up all their animations, sprites and NPC behavior (since each kind of enemy will behave the same AI, i just want them to look different) and then when i instantiate each enemy they will spawn with their random sprites and corresponding animations. But i have no idea how to do this. How would i go about doing it?

Sounds like you should create version as a resource that would contain the sprites/animations. Then wherever you are spawning the enemies you would just have an array of all the created enemies and pick one at random to spawn.
Good video on resource system: https://www.youtube.com/watch?v=4vAkTHeoORk

so i create one resource for each enemy type?

That’s what I would do.

Setup your enemy class so it extends the Resource class. Add all of your variables that you need to configure and create an instance for each enemy type.