Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am using the flash flixel engine, and have a sprite sheet of a spaceship from top-down view. The sprite sheet includes a bunch of different states and animation frames. Problem is that I have drawn them all facing upwards (north), and my maths is all done assuming the sprites face to the right (east).

In flixel v2.5 is there a way to rotate the sprite graphics without affecting the "angle" property of the FlxSprite that is using the graphics? I was thinking along the lines of a pre-process, as I initialise everything. I don't really want to fix all the graphics, or hack into my maths at this point. This also might come in handy later.

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

If you really want to do this in code (instead of converting the sprite-sheets you have), I suggest you use the BitmapData:draw method to draw an existing BitmapData object (your Sprite) into another. When using the draw method you can also supply a transform matrix to use, so basically you do the following:

  • Create a new BitmapData object with the same size as your sprite (actually, width becomes height and height becomes width).
  • Copy your sprite using a 90 degree rotation matrix
  • Use the new BitmapData object for the graphics in Flixel...
share|improve this answer
    
How would I use the generated graphics in flixel, when the loadGraphic method takes a Class, not any form of Bitmap? –  Adam Harte Apr 25 '11 at 21:37
1  
@TandemAdam by setting the pixels property of your FlxSprite. You can even use the loadGraphic method and then perform the steps I mentioned in my answer on the pixels property. –  bummzack Apr 25 '11 at 21:51
    
btw. pixels is the whole graphic as BitmapData object. –  bummzack Apr 25 '11 at 21:54
add comment

Look at the command line tool for ImageMagick. It allows you to do batch processing on images, including transforms such as rotation. It's also useful for generating simple spritesheets (not the "packed" kind, but the kind where each the image is cut up into frames of equal width and height).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.