Game Development Reference
In-Depth Information
public var particlesPerExplode : This is the number of Particle instances that will be
created for each explosion.
And these are the private attributes:
private var drawingCanvas:Shape : The canvas where the particle look will be
constructed
private var point0:Point : A reusable Point instance for drawing operations
This class's public functions follow:
public function ParticleManager() : The constructor is an empty function.
public function createParticlePool(maxParticles:int):void : The
BlasterMines.as class will call this function before each new level to create the particle
pool. We will see this in action and discuss it more when we go through the
BlasterMines.as code.
public function createLevelParticles(spriteGlowFilter:GlowFilter,
levelColor:uint):void : This function is called by BlasterMines.as before each new
level. It creates the look of the particles to match the color on the Mine instances.
Here is the full source code for this class:
package com.efg.games.blastermines
{
import flash.display.BitmapData;
import com.efg.framework.BlitArrayAsset;
import com.efg.framework.BasicBiltArrayParticle;
import flash.display.BitmapData;
import flash.display.Shape;
import flash.geom.Point;
import flash.filters.GlowFilter;
public class ParticleManager {
public var particleBitmapData:BitmapData;
public var particleAnimationFrames:Array = [];
public var particles:Array = [];
public var particlePool:Array = [];
public var particleCount:int=0;
public var particlePoolCount:int=0;
public var tempParticle:BasicBiltArrayParticle
public var particlePoolMax:int = 500;
public var particlesPerExplode:int = particlePoolMax / 20;
private var drawingCanvas:Shape = new Shape();
private var point0:Point = new Point(0, 0);
public function ParticleManager() {}
public function createParticlePool(maxParticles:int):void {
particlePool = [];
Search WWH ::




Custom Search