First off, the function in question.
bool Animation::loadFrames()
{
sf::Texture frame[frameCount];
std::string pathToFrame;
for(int i = 1; i < frameCount; i++)
{
pathToFrame = pathToAnimation + i + ".jpg";
if(!frame[i].loadFromFile(pathToFrame)) return false;
}
return true;
}
The line that's giving me trouble is
pathToFrame = pathToAnimation + i + ".jpg";
pathToAnimation is another std::string, frameCount is an int. I want to somehow make one string that looks like: "./Assets/Sprites/Player/Stand/1.jpg"
I know why my code doesn't work, I just don't know what the correct code would be.
spriteWidth = imageWidth / frames;, then you just blit the current frame (the animation).