Hi Null Pointer, and thanks for your interest in this project !
How does the computer know which sprite to use from the sprite sheet?
Well... It doesn't know :-)
You have to select the right rectangle.
In this example:
sprite.setTextureRect(sf::IntRect(3 * width, 2 * height, width, height));The variables "width" and "height" represents the width and height of a frame (64 x 96, in this case, I believe...).
So the texture rectangle represents the 4th frame of the third line. (it's according to your understanding)
In GIMP (or others softwares), you can configure and display the grid, so you can see all the "frames" of the sprite.
I save as PNG file with transparent background.
I use the pencil object with a size of 1 pixel, and "hard" eraser, to prevent anti-aliasing while drawing.
There are some tutorials for doing sprites and tiles, but I'm really not an artist (someone will help me with the graphics, there will be an update in this way soon).
Where did the sprite object come from though?
It comes from the SpriteEntity class. You know about OOP ?
Here the hierarchy for the PlayerEntity:
GameEntity (base object, with some "physics" and it records himself to the entity manager)
|
V
SpriteEntity (add the sprite (we must attach a texture), frame concept, and rendering)
|
V
CollidingSpriteEntity (add box collision)
|
V
BaseCreatureEntity (add "game specifics" data - like HP, states, etc...)
|
V
PlayerEntity (add methods to pass it the inputs, proper rendering because it's more complex as the others sprite, etc...)
The new changes look great!!
P.S. The green jelly things are intense.
Thanks !
I don't know when I'll do a new release, I'm working on the integration of the new graphics, I'll implement some new contents, etc... But I frequently update my Git, as you've seen.