Game Development Reference
In-Depth Information
switchSystemState(STATE_SYSTEM_GAME_PLAY);
score = 0;
level = 0;
shield = 10;
gameOver = false;
playerExplosionParticles = [];
playerStarted = false;
customScoreBoardEventShield.value = shield.toString()
customScoreBoardEventScore.value = score.toString()
customScoreBoardEventLevel.value = level.toString()
dispatchEvent(customScoreBoardEventScore);
dispatchEvent(customScoreBoardEventShield);
dispatchEvent(customScoreBoardEventLevel);
}
This function is pretty simple, but we'd like to point out a few things. First, we use the
frameRateModifier value to set the stage.quality . This is a simple example of using the profiled
information to change the quality of the game for each user's machine. There are four settings for
the stage.Quality : LOW , MEDIUM , HIGH , and BEST . We have chosen to use MEDIUM unless the
setRendering function found that the frameRateModifier could be set to 2 for the user's machine.
Also notice that we have the first uses of the class level reusable score board update events in
this function.
Here is the newLevel function:
override public function newLevel():void {
stage.focus = this;
trace("new level");
mineManager.mines = [];
projectileManager.projectiles = [];
stage.focus = this;
level++;
if (level > maxLevel) {
level = 1;
}
levelColor = levelColors[level];
spriteGlowFilter = new GlowFilter(levelColor, .75, 2 , 2, 1.5, 2, false, false);
createLevelbackground();
mineManager.createLevelMines(spriteGlowFilter, level, levelColor);
particleManager.createLevelParticles(spriteGlowFilter,levelColor);
particleManager.createParticlePool(particleManager.particlePoolMax*
frameRateMultiplier);
canvasBitmapGlowFilter.color = levelColor;
canvasBitmap.filters = [canvasBitmapGlowFilter];
player.x = 400;
player.y = 400;
player.nextX = player.x;
player.nextY = player.y;
playerStarted = true;
Search WWH ::




Custom Search