Hey everybody, this question goes out to anybody who’s good with BitmapData and Blitting.
Right now i’m writing a Blitting engine for my toolbox, and an earlier version had each character sprite contained an array of BitmapData objects which represented each “frame” of a character’s animation.
The version I’m working on right now instead just has each character store a reference to a SpriteSheet that contains all the graphics for its animation states, and an array of Rectangle objects which I’m using to clip sections of the SpriteSheet when I copyPixels() to the main bitmap object. The reasoning behind this is that if I have four or five of the same enemy on screen at once, I am saving memory using a single SpriteSheet for all of them instead of having them all contain cached bitmapData’s of their animation states.
This works fine, but am I really saving much on memory doing it this way? The main problem I have with this system is that when I wanted to flip a sprite horizontally or vertically, I have to use BitmapData.draw() with a matrix as part of my screen update function, which is going to be executing in my gameLoop very quickly. So is the CPU going to be strained by these calculations to the point where saving memory on my sprites is not worth it?
hope that makes sense, glad for any input the kirupians might have for me
–EP