Faking Display tree (Sprite) parent child relationships with rasters (BitmapData) in ActionScript 3
Posted
by
Arthur Wulf White
on Game Development
See other posts from Game Development
or by Arthur Wulf White
Published on 2012-09-26T22:39:07Z
Indexed on
2012/09/27
3:49 UTC
Read the original article
Hit count: 229
I am working with Rasters (bitmapData) and blliting (copypixels) in a 2d-game in actionscript 3. I like how you can move a sprite and it moves all it's children, and you can simultaneously move the children creating an interesting visual effect. I do not want to use rotation or scaling however cause I do not know how that can be done without hampering with performance. So I'm not simulating Sprite parent-child behavior and sticking to the movement on the (x, y) axis.
What I am planning to do is create a class called RasterContainer which extends bitmapData that has a vector of children of type Raster(extending bitmapData), now I am planning to implement recursive rendering in RasterContainer, that basically copyPixels every child, only changing their (x, y) offset to reflect their parent's offset. My question is, has this been implemented in an existing framework? Is this a good plan? Do I expect a serious performance hit for using recursive methods this way?
© Game Development or respective owner