I have a question about sprites in general. How does the computer know which sprite to use from the sprite sheet? For example, take the sprite.png file. How does the computer know which picture to use within the sprite sheet? I see that in the PlayerEntity.cpp class, the different render options depend on whether the player is living or dead and so forth. I think in the sf::IntRect parameters you're telling the computer where to pick the picture from? Like when the player dies you pick the sprite feet that are 3 over the width and 2 down the height (since the computer's dimensions draw positive downward)?
void PlayerEntity::render(sf::RenderWindow* app)
{
sprite.setPosition(x, y);
if (playerStatus == playerStatusDead)
{
...............
// feet
sprite.setTextureRect(sf::IntRect(3 * width, 2 * height, width, height));
app->draw(sprite);
..................
}
Where did the sprite object come from though? I couldn't find it in the header or class file and I think that's what has me confused.
Also, did you use any references for making sprites and sprite sheets in GIMP? I've seen some videos on YouTube about basic sprite drawing, but I haven't figured out how to make the sprite sheet and get the computer to load it properly.
Anyway, sorry if my questions are really noob. The new changes look great!!
P.S. The green jelly things are intense.