Game Development Reference
In-Depth Information
tempMine.dy = Math.sin(6.28 * ((Math.random() * 360) - 90) / 360.0);
if (level % 2 == 0) {
tempMine.y = 700
}else {
tempMine.y = 100
}
tempMine.x = 100;
tempMine.nextX = tempMine.x;
tempMine.nextY = tempMine.y;
tempMine.frame = int((Math.random() * 359)) ;
tempMine.animationList = mineAnimationFrames;
tempMine.bitmapData = tempMine.animationList[tempMine.frame];
tempMine.speed = (Math.random()*1)+2+level;
mines.push(tempMine);
}
}
}
}
Designing the ParticleManager class
The ParticleManager class will contain the design of the particles for Mine instance explosions. It
will institute an object pool for memory optimization. We will present the basic outline of the class
here, and the detailed discussion will be presented as we proceed through the BlasterMines.as
class. Particles will be instances of the BasicBlitArrayParticle class. Their look will be unique
per level to match the color of the Mine instances that the player must destroy.
The package location is com.efg.games.blastermines .
The public attributes for this class are as follows:
public var particleBitmapData:BitmapData : This is the BitmapData look for the
Particle s. These will be a unique color on each level to match the color of the Mines .
public var particleAnimationFrames : Particle s will fade out as their life expires. The
fade animation frames will be stored in this array. It will be created with the
BlitArrayAsset class.
public var particles:Array : This array contains the current active Particle s.
public var particlePool : This attribute contains an array of the Particle s in the pool.
public var particleCount : This class-level variable will hold the length of the
particles array.
public var particlePoolCount : This class-level variable will hold the length of the
particlePool array.
public var tempParticle:BasicBiltArrayParticle : This reusable class-level Particle
instance for loops through array the Particle arrays.
public var particlePoolMax : This attribute stores the total number of Particle
instances that can be on the screen at a single time.
Search WWH ::




Custom Search