Game Development Reference
In-Depth Information
tempParticle.lifeDelayCount=0;
tempParticle.x=xval;
tempParticle.y = yval;
tempParticle.nextX=xval;
tempParticle.nextY=yval;
tempParticle.speed = (Math.random() * 3) + 1;
tempParticle.frame = 0;
tempParticle.animationList = particleManager.particleAnimationFrames;
tempParticle.bitmapData = tempParticle.animationList[tempParticle.frame];
var randInt:int = int(Math.random() * 359);
tempParticle.dx = rotationVectorList[randInt].x;
tempParticle.dy = rotationVectorList[randInt].y;
tempParticle.lifeDelay = int(Math.random() * 10);
particleManager.particles.push(tempParticle);
}
}
}
The createPlayerExplode function creates an explosion using Particle s from the particlePool
(if enough are left in the pool).
private function createPlayerExplode(xval:Number,yval:Number,parts:int):void {
for (var explodeCtr:int=0;explodeCtr<parts;explodeCtr++) {
var tempParticle:BasicBiltArrayParticle = new BasicBiltArrayParticle(0,799,0,799);
tempParticle.lifeDelayCount=0;
tempParticle.x=xval;
tempParticle.y = yval;
tempParticle.nextX=xval;
tempParticle.nextY=yval;
tempParticle.speed = (Math.random() * 10) + 1;
tempParticle.frame = 0;
tempParticle.animationList = projectileManager.projectileAnimationFrames;
tempParticle.bitmapData = tempParticle.animationList[tempParticle.frame];
var randInt:int = int(Math.random() * 359);
tempParticle.dx = rotationVectorList[randInt].x;
tempParticle.dy = rotationVectorList[randInt].y;
tempParticle.lifeDelay = int(Math.random() * 5);
playerExplosionParticles.push(tempParticle);
}
}
The createPlayerExplode function creates an explosion where the player ship used to be. We
use the first frame of the projectileAnimation array of BitmapData instances. Instead of
creating a new particle, we use a Projectile BitmapData because it is already the same color
as the player.
Search WWH ::




Custom Search