I have literally thousands of spritesheets with sprites of monsters to animate.

Every spritesheet has the same structure (1 row x 20 cols), e.g. animation of left walk is starts at column no. 0 of spritesheet and finishes at column no. 3, animation of walk in the right direction starts at column no. 4 and ends at column no. 7 etc.

In the tutorials that I have seen, I would need to animate every monster manually, as far as I understand:

Would I really need to repeat this animation process thousands of times for every monster / spritesheet?
What is the proper way to automate this in Godot?
Why almost every tutor on YouTube is suggesting to use AnimationTree or AnimationPlayer, when it seems to be not extensible solution in the long run, having the reasons mentioned above in mind?

  • xyz replied to this.

    Darqon Would I really need to repeat this animation process thousands of times for every monster / spritesheet?

    Of course not, it'd be insane 🙂. Godot's scenes are typically used for this. Build each distinct type of character/monster as a scene, and then instantiate the scene as many times as needed.

      xyz Thanks for answer.

      Do you know where can I find tutorials on this topic or can you provide more details on how to generate thousands scenes from thousands of sprites?

      Is there something like a template scene?

      I guess I would need to write some script that would generate these scenes from list of paths to the spritesheet files that I have using some template scene?

      • xyz replied to this.

        Darqon You should look into any tutorial that explains the basics of Godot's scenes. The section on scenes in official docs is also a good place to start. Scenes are one of the key features in Godot and are extremely useful for variety of things. In fact most of the game architecture in Godot boils down to scene organization. The name 'scene' is a bit misleading. Any entity in the game can be a scene: the whole level, a house in that level, an enemy, the boss, a bullet, etc...

        In your case you'd make a scene in the editor that represents a monster. This scene can contain a sprite node and a script with some properties and methods that lets you configure which type of monster this is and accordingly sets up the proper sprite sheet. Note that you only need to build scene once if all monsters are similar and vary only in appearance. Now you can instantiate (spawn) this monster scene via the script in the main scene as many times as you need.

        What I do for my custom spritesheets is I put them on a Sprite3D (not AnimatedSprite3D) driven by a script and an AnimationPlayer. The script handles the x coord (which for my sheets is perspective, value of 1 to 8), and the AnimationPlayer handles the y coord (the pose itself, animating the property frame_coords:y).
        All my custom sheets have the same layout concept as yours do, so I can reuse the animations for many spritesheets since they are animating to a value and not a specific image. I made my AnimationPlayer a scene that just targets Sprite3D and the script that drives x coord just attached to the Sprite3D node, so you just instance the AnimationPlayer scene onto your various NPC scenes or whatever else you can use those same driven sprite values for.
        If you are having trouble I can send some images to better help explain if needed.

        Edit: You can also not use an instanced AnimationPlayer, and just save the animation library and load it to each AnimationPlayer