Game Development Reference
In-Depth Information
public var projectilePool
: This one contains an array of the
projectiles
in the pool.
public var projectile Count
: This class-level variable will hold the length of the
projectiles
array.
public var projectile PoolCount
: This class-level variable will hold the length of the
projectilePool
array.
public var tempProjectile:BasicBiltArrayProjectile
: This reusable class-level
Projectile
instance for loops through array the
Projectile
arrays.
public var projectilePoolMax
: This attribute holds the total number of
projectiles
that can be on the screen at a single time.
The private attributes are
private var drawingCanvas:Shape
: The canvas where the
projectile
look will be
constructed
private var point0:Point
: A reusable
point
instance for drawing operations
And these are the public functions:
public function Projectile Manager()
: The constructor is an empty function.
public function createProjectilePool(maxParticles:int):void
: The
BlasterMines.as
class will call this function before in its
init
function to create the
projectile
pool. We will see this in action and discuss it more when we go through the
BlasterMines.as
code.
public function createProjectilePool(maxProjectiles:int):void
: This function is
called by
BlasterMines.as
before
init
. It creates the look of the projectiles.
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.BasicBiltArrayProjectile;
import flash.display.BitmapData;
import flash.display.Shape;
import flash.geom.Point;
import flash.filters.GlowFilter;
public class ProjectileManager {
public var projectileBitmapData:BitmapData = new BitmapData(8, 8, true, 0x00000000);
public var projectileAnimationFrames:Array = [];
public var projectiles:Array=[];
public var lastProjectileShot:Number = 0;
public var projectileCount:int;
public var tempProjectile:BasicBiltArrayProjectile;
public var projectilePool:Array = [];
public var projectilePoolCount:int;
private var drawingCanvas:Shape = new Shape();
private var point0:Point = new Point(0, 0);