My comment about 16ms (60fps) and 33ms (30fps) is referring to the code in your enterFrame loop, or really, any code anywhere that is run. If you have some code that eats cpu cycles, are you subtracting from the 16ms you have left to do stuff before the next frame is rendered.
Basically, if you want to maintain 60fps, your code can not execute longer than it takes the next frame to get here. If it does, it causes the frame rate to drop because one of your frames took, say… 70ms instead of 16ms.
Time and print your enter frame loop. Here is an example of what might happen:
16ms --good, still at 60fps
16ms --same
16ms
70ms --Arg, enterFrame took up 4 frames instead! (70/16) so now you have lost 4 frames and the game has choppy animation
16ms – back to 60fps
50ms – enterFrame took up 3 frames!
24ms – took an extra 1 frame!
16ms – back on track
This is, of course, if you use frame based animation. Time based animation still has the same problem though, the animation looks jerky or images jump from location A to B and do not animate smoothly.
I am always open to new ideas. In my case, I need to check for collisions every frame AND move objects manually. I use transition.to to offload images from my enterFrame loop if I can.
How would you implement something that would run at 60fps, have custom animations where you move stuff per frame, check for collisions each frame, and NOT have any or very little code run in enterFrame?
Are custom timers more efficient? Say, timer.performWithDelay(16,doStuff) ?
Why would that be more efficient, the code run in doStuff still has to be faster than 16ms or you lose a frame. [import]uid: 8541 topic_id: 2726 reply_id: 8258[/import]