Hello! :DI have a Question regarding using Sprites for animation. I have heard that libraries such as Thor have good Animation handling and if you tell me it would be best to use it, I will do so. However, because I want to learn, I dont want to simply go down the easiest path. So I hope you can answer me this.
Let's say I want to make a charakter walk to the right and having his Sprite change accordingly to make an animation of the character walking. The way I see it there are three methods to achieve this:
1st Method: Have lots of differend Images (e.g. Character1.png, Character2.png,....) and Change the Sprite of the character continuously from the beginning image to the ending image and repeat.
2nd Method:
Have one huge Image that contains all of the Characters poses needed for the animation and just have his sprite be a small rectangle that envelops one of these poses. So all you need to change for the animation is the position of the rectangle while the image/texture can stay the same. This sounds a lot smarter than the first version.
3rd Method:
Have many different images like in Method 1, but also create many sprites ready. Each of the Sprites contains one Image of the Characters Walking Process, So you simply have to tell the Gamewindow to draw a different Sprite each Time.
I hope to have managed to explain clearly what I mean, because I fear it's not very understandable. So the tl.dr is:
1) One Sprite, many Images. Keep loading different Images as Texture into the one sprite.
2) One Sprite, one Image. Just change the position of the rectangle and thus change how the sprite looks.
3) Many Sprites, each with their own image/texture. Display a different sprite each time.
Instinctively, it sounds like Method 2 is the smartest by far, because it doesnt need too much space for all the Sprites or computation time for reloading Images. But I would be really glad over a definite answer.
Cheers, Sinclaire