Ari

Ari

  • NA
  • 8
  • 50.9k

Rotating a sprite on the fly (without XNA)

Dec 26 2011 5:29 PM
Hey, I'm developing a very small computer game for my niece, and I've decided to go ahead and do this without XNA (the game is incredibly simple, I feel xna won't be overly useful). 

I have a sprite which I want to be able to move in any direction. The movement actions will be done with the mouse: for example, the user clicks a position on the form, and the sprite moves to that position.

Now the problem I'm facing, is that I need to be able to rotate the sprite on the fly: for example, the sprite is travelling in a certain direction, when the user suddenly clicks in the opposite direction, the sprite would have to turn around and then travel in that direction. What is the most efficient way of accomplishing the rotating action? (Assume I have the appropriate graphics and sprites within my resources).

Cheers.

Answers (1)