Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

scrolling background

Tags:

flash

I'd like to get a better understanding of how Flash renders display objects, so I have a better idea of how to optimize my games.

I previously created a game that had a scrolling, repeating (and parallaxing) background. I tiled it and cached as bitmap, which was quite a pain when taking animating display objects in the background into consideration. Is there a better way to do this?

Another question is if I have a large bitmap (or vector art that I have cached as bitmap), is there any kind of performance hit if it is completely off screen? How about if it is partially on screen - does flash have to render the entire bitmap, or just what it sees on screen?

like image 402
Krishna Jain Avatar asked Sep 15 '26 01:09

Krishna Jain


1 Answers

If it's not within a scrollRect it's rendered, even if off-screen. It would perhaps be a good idea to have an ENTER_FRAME listener or something similar to detect when the clip reaches the stage width, then addChild another instance of your background to the end of the scrolling movieclip. Then, for performance, use scrollRect to only render what's on the stage at that current time.

like image 160
jpea Avatar answered Sep 17 '26 01:09

jpea



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!