Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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
@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

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

Your Answer


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.