SFML community forums
Help => Graphics => Topic started by: jyugrace on April 27, 2014, 09:33:20 am
-
In my program I'm moving a sprite using the .setPosition in a while loop. In the loop, each iteration redraws the sprite at a new position and then clears the previous iteration .draw, which effectively animates the movement of the sprite across the program. But is there a better way to move around sprites? I really feel like there must be something better. Any tips would be greatly appreciated, thanks!
-
sf::Sprite has a move-function (http://www.sfml-dev.org/documentation/2.1/classsf_1_1Transformable.php#a86b461d6a941ad390c2ad8b6a4a20391), which moves your sprite by the given value in pixels.
Read the documentation, it helps a lot.
-
You clear, you update, you draw. What exactly do you think is wrong in this approach? That's what everybody does ;)