SFML community forums
Help => General => Topic started by: Chunker120 on May 12, 2013, 04:44:07 pm
-
I have an animation in a top-down perspective, but I want the sprite to get flipped horizontal if the player faces east. The sprite class doesn't by default have any methods that would help me achieve that, so how would I go around flipping a sprite horizontally?
-
sprite.scale(-1,1);
:)
-
probably rotating (http://www.sfml-dev.org/documentation/2.0/classsf_1_1Transformable.php#af8a5ffddc0d93f238fee3bf8efe1ebda) sprite would be easiest
edit: nvm scaling is even easier then rotating :P
-
edit: nvm scaling is even easier then rotating :P
The operations are not equivalent. Rotating by 180° won't give you the mirror image (the sprite looks upside down). The alternative to scaling is to set the texture rect using a negative width.
By the way, this has been asked many times, please use the forum search before posting.