Game Development Reference
In-Depth Information
autoShoot(step);
if (playerStarted) {
player.update(this.mouseX + canvasBitmap.scrollRect.x, this.mouseY + ~cc
canvasBitmap.scrollRect.y, 20,step);
}
for each (tempMine in mineManager.mines) {
tempMine.update(step);
tempMine.updateFrame(5);
}
particleManager.particleCount = particleManager.particles.length-1
for (var ctr:int = particleManager.particleCount; ctr >= 0; ctr--) {
tempParticle = particleManager.particles[ctr];
if (tempParticle.update(step)) { //return true if particle is to be removed
tempParticle.frame = 0;
particleManager.particlePool.push(tempParticle);
particleManager.particles.splice(ctr,1);
}
}
var projectileLength:int = projectileManager.projectiles.length - 1;
for (ctr=projectileLength;ctr>=0;ctr--) {
tempProjectile = projectileManager.projectiles[ctr];
if (tempProjectile.update(player.xMove, player.yMove,step)) {
// returns true if needs to be removed
tempProjectile.frame = 0;
projectileManager.projectilePool.push(tempProjectile);
projectileManager.projectiles.splice(ctr,1);
}else {
tempProjectile.updateFrame(1);
}
}
for (ctr = playerExplosionParticles.length-1; ctr >= 0; ctr--) {
tempParticle = playerExplosionParticles[ctr];
if (tempParticle.update()) { //return true if particle is to be removed
tempParticle=null
playerExplosionParticles.splice(ctr,1);
}
}
}
The update function cycles through all of our game objects and updates them as follows:
1.
The first thing update does is calculate the step value modifier for this frame tick. We
have discussed this in detail earlier in this chapter, but for clarification, the step is the
Search WWH ::




Custom Search