[RESOLVED] [HELP] Optimising scrolling
For those of you that have checked out the Alpha version of my current project, Christmas Cannon, you may have noticed that in levels ‘Fire Hoops 2’, and ‘Brickwall’, there is some noticeable slowdown. I’m dropping 5 frames just from scrolling the level!
I’ve done some testing on the matter, and I’ve come to the following conclusions:
- Levels containing more than 10 mc’s with moderately detailed vector art cause the slowdown (no frame drop with non-detailed mc’s)
- Things such as checking for collisions and all other functions are NOT causing the slowdown. I came o this conclusion by running the game with no scrolling, and it didn’t drop a frame.
The code that I have in place to scroll the level is pretty simple (not CPU intensive at all). Basically, I have every on-screen item that needs to be scrolled in an mc on the root named ‘world’. To create levels, I’m simply attaching the individual mc’s into this container clip, and scrolling the world itself (not individual items one at a time).
I cannot cacheAsBitmap this main container clip and use scrollRect, because the game includes scaling.
I hope I’ve described the situation well enough for you guys to understand me clearly. If you can suggest a better way to scroll the world, or can give me some advice to optimise code I’d love to hear from you. :)
Cheers,
Viza.