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.

2 Answers
2

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).

How would I use the generated graphics in flixel, when the loadGraphic method takes a Class, not any form of Bitmap?
–
Adam HarteApr 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.
–
bummzackApr 25 '11 at 21:51

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).