SFML rotation of sprite with small steps

Hello everyone. I want to rotate a sprite with small step sizes.

I do not want to write directly as:

 
sprite.setRotation(90);


I want to do it with 1 degree increment in every step. Therefore, the sprite should not be seen as just 90 degree rotation. It should be seen as continuous change in rotation.

How do I implement that?
Utku wrote:
Hello everyone. I want to rotate a sprite with small step sizes.

I do not want to write directly as:

sprite.setRotation(90);

I want to do it with 1 degree increment in every step. Therefore, the sprite should not be seen as just 90 degree rotation. It should be seen as continuous change in rotation.

How do I implement that?

I've never used SFML, but what's wrong with sprite.setRotation(1); ?
Last edited on
I guess what I would do would be to look up how to setup a timer event using SFML, make that timer fire - say 20 times a second, and attach an event handler to that timer to bump the rotation by +1 degree each time it is called.

@MikeyBoy,

sprite.setRotation(1); rotates only 1 degree. It happens only one time.


So... do it as many times as you need. What's the problem?
It should be seen as continuous change in rotation.

Every game frame update you call the sprite's rotation member function to change its orientation. If your frame rate is enough to be seen as continuous motion, the sprite will appear to be in continual rotation.

Your frame rate and the apparent speed of the sprite's rotation will dictate the degree of change from frame to frame.
Topic archived. No new replies allowed.