I would like to use Bitmaps in my Actionscript games.
For me this represents a large change in my workflow as I have always used Vector but Bitmaps are really so much faster to render in certain circumstances. As far as I can see, 90% of all my game assets can be bitmaps.
Firstly, are there any good tools for working with Vector to BitmapData? Libraries or OpenSource utilities?
I know you can just draw to a BitmapData, and I do that, but what about Animations? What about a MovieClip of a laughing cow? How can I render that MovieClip at runtime to some kind of Bitmap version?
But more complex than that… What about situations where you do not have the MovieClip in a raw form?
Imagine 10000 cogs turning at the same rate which is generated with code. This is hard work for the processor, so drawing it to a Bitmap for the duration of 1 revolution, would replace 10000 cogs with a SpriteSheet. I could destroy the cogs, and keep the SpriteSheet.
Can anyone offer me any resources or google keywords I can search for, not sure of the technique but it seems to make sense? Especially with Starling….. My Vectors are going to have to become SpriteSheets at some point.
Thanks.
The basic process of converting a movie clip to a sprite sheet is this:
5 loop through each frame of the clip, and call bitmapData.draw() on each frame. Be sure to offset the matrix of the draw command on each frame by the width of one sprite frame.
The end result will be a single bitmapdata object with each frame rendered to it.
From there you can follow this tutorial on blitting.
http://www.8bitrocket.com/2008/07/02/tutorial-as3-the-basics-of-tile-sheet-animation-or-blitting/