Game Development Reference
In-Depth Information
public function ProjectileManager() {}
public function createProjectiles(spriteGlowFilter:GlowFilter):void {
//projectile look
var tempBlitArrayAsset:BlitArrayAsset = new BlitArrayAsset();
drawingCanvas.graphics.clear();
drawingCanvas.graphics.lineStyle(1, 0xffffff);
drawingCanvas.graphics.drawRect(3, 3, 2, 2);
projectileBitmapData.draw(drawingCanvas);
projectileBitmapData.applyFilter(projectileBitmapData,
projectileBitmapData.rect, point0, spriteGlowFilter);
tempBlitArrayAsset= new BlitArrayAsset();
projectileAnimationFrames=tempBlitArrayAsset.createRotationBlitArrayFromBD
(projectileBitmapData, 10,0);
}
public function createProjectilePool(maxProjectiles:int):void {
for (var projectileCtr:int = 0; projectileCtr < maxProjectiles; projectileCtr++) {
var tempProjectile:BasicBiltArrayProjectile=new BasicBiltArrayProjectile
(0,799,0,799);
tempProjectile.animationList=projectileAnimationFrames;
tempProjectile.bitmapData = tempProjectile.animationList[0];
projectilePool.push(tempProjectile);
}
}
}
}
The ProjectileManager class completes the manager classes. Now, we will take a look at the final
custom class for our gameāthe Mine class.
Designing the Mine class
The
Mine
class is an extension of the
BasicBlitArrayObject
class with an
update
function
customized to implement the step modifier from the time-based step timer. The class is so simple
we will just show the code here and describe the
update
function when we get to the
BlasterMines
update function.
This is the package location:
com.efg.games.blastermines
.
Here is the complete code for the class:
package com.efg.games.blastermines
{
import com.efg.framework.BasicBlitArrayObject;