Jump to content
  • Advertisement
Sign in to follow this  
JasonBradley

Reflect group of textures representing parts of character over a specified axis?

This topic is 2603 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

I have a character that's made up of multiple Texture2D objects. I have all the animations finished for when the character is facing left, and the animations will look exactly the same, but mirrored when he is facing to the right. I'd rather not have to go through all of the mins, maxes, angles, etc and change them accordingly. Would there be an easy way to just flip everything over a given axis vs the middle of the texture as SpriteEffects.FlipHorizontally does it? I've tried to mess with the GetData and SetData methods to figure out how they work in order to combine all of the textures into one and then using SpriteEffects.FlipHorizontally in the SpriteBatch method in order to flip it, but I can't quite get those to work right as I can't find a good example that can easily be changed over to XNA 4.0. All of the good examples I've found are in XNA 3.0 or XNA 3.1.

If someone wants to just look at my source in order to help me out then here's a link :
http://dl.dropbox.co...raftSource2.zip

Thanks in advance to anybody that can help.

Share this post


Link to post
Share on other sites
Advertisement
Alright, so I've gone through setting up when the begin and end spritebatch methods are called so I can avoid any errors of one being called twice before the other. I've got the scale matrix being passed in for both directions with the first parameter set to either -1 or 1 accordingly. Then I start it and it does absolutely nothing different from what it did before I used the scaling matrix. I know the begin method that uses the rotation matrix is being called because I haven't gotten an error yet, as it should give if that hasn't been called. I'm going to try searching up some examples of the scaling matrix being used and if I still can't get it to work then I'll try using a reflection matrix. I'm completely new to using matrices in this, but so far I've only seen them being used in examples in 3D environments. Since my game is all 2D, do these still work?

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!