I have a character sprite that I need to rotate to face up, left, right, and down. The way I'm currently rotating it is like this:
(SpriteX is a wrapper class I made around an sf::Sprite, and these are some rotation methods)
void SpriteX::rotate(float degrees)
{
sprite.SetCenter(get_width()/2, get_height()/2);
sprite.Rotate(degrees);
sprite.SetCenter(0, 0);
}
void SpriteX::set_rotation(float degrees)
{
sprite.SetCenter(get_width()/2, get_height()/2);
sprite.SetRotation(degrees);
sprite.SetCenter(0, 0);
}
The sprite still rotates around its top left corner, how do I make it rotate around it's center
just for the scope of the rotation method? I still want to position the sprite based on its top left corner.
Will I just have to make 4 separate image files?
Any help is appreciated!