Game Development Reference
In-Depth Information
private var exhaustAnimationList:Array = [];
private var lastExhaustTime:int = 0;
private var exhaustDelay:int = 100+((obstacleSpeedMax * 10) - (10 * obstacleSpeed));
Figure 12-9 is another look at the Tunnel Panic game screen. This version now has the game
elements annotated.
Figure 12-9. The annotatedTunnel Panic game screen
Using dirty rect erase
A dirty rect erase is a technique used to update only the parts of a blit canvas that have changed, as
opposed to always clearing the entire canvas between each frame update. This can be a powerful
tool, but its use necessitates the blurring of the update and render functions for the particles.
We will have to do the erase of the particle's original location in the update function, but the blit of
the new location in the render function. Here is the update function code:
exhaustLength = exhaustParticles.length - 1;
canvasBitmapData.lock();
for (ctr = exhaustLength; ctr >= 0; ctr--) {
tempExhaustParticle = exhaustParticles[ctr];
//dirty rect blit erase
blitPoint.x = tempExhaustParticle.x;
blitPoint.y = tempExhaustParticle.y;
Search WWH ::




Custom Search