Jump to content
  • Advertisement
Sign in to follow this  
The Lion King

Flipping a Sprite

This topic is 5476 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How do you flip a sprite using D3DXSprite. Rotation is another thing but flipping is totally different. If I have a character facing left hand side ... and I want to flip him facing right hand side. How will I do that? When using rotation at 180 degrees the character turns upside down. Any help or clues ... plz?

Share this post


Link to post
Share on other sites
Advertisement
I'm not familiar with DirectX (I'm an OpenGL man myself) but this should work on any API:

Scale in x or y by a negative factor (scaling both by a negative factor is equivalent to a 180 degree rotation). Scaling in x by -1 will flip horizontally, scaling in y by -1 will give a vertical flip. Factors other than one will stretch.

Share this post


Link to post
Share on other sites
Quote:
Original post by LucidIon
I'm not familiar with DirectX (I'm an OpenGL man myself) but this should work on any API:

Scale in x or y by a negative factor (scaling both by a negative factor is equivalent to a 180 degree rotation). Scaling in x by -1 will flip horizontally, scaling in y by -1 will give a vertical flip. Factors other than one will stretch.

Hey thaks ... great trick ... why didnt't I think of that ... I will try it as soon as I reach home ... thanks :) and will rate you if it works :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!