Game Development Reference
In-Depth Information
We created similar events to these in Super Click. The real difference here is that we will be
sending the ScoreBoard class information about the number of ships the player has left in the fleet
with the CustomEventScoreBoard event.
Starting a new level
newLevel() is where we will update all the game level settings. Before we make any changes to
the settings. However, we must first initialize all the arrays that we will use to hold our game's
objects. We also need to reset incomingCount (so we can count the Enemy planes on this level)
and then update the level variable so that we can calculate the settings for this level correctly.
override public function newLevel():void {
explodeArray = [];
flakArray = [];
shotArray = [];
shipArray = [];
enemyArray = [];
bonusPlaneArray = [];
incomingCount = 0;
level++;
Here are the difficulty settings that described in Chapter 4; refer to that chapter for a full
description of how these variables will be used. We also describe them in context when we talk
about each function in the FlakCannon class. For now, just notice that we can alter the game play
for Flak Cannon in many ways using these variable settings.
numEnemies = (numEnemies > 100) ? 100
: level * 10 + (level*5);
enemyWaveDelay = (enemyWaveDelay < 20)
? 20
:60 - (level-1)*2;
enemyWaveMax = (enemyWaveMax > 8) ? 8 : 1 * level+1;
enemyWaveMultipleChance =(enemyWaveMultipleChance > 100)? 100
: 10*level;
enemySpeed = (enemySpeed > 8) ? 8 :2 + (.5*(level-1));
enemySideChance = (enemySideChance > 70) ? 70 : 10*(level-1);
enemySideFloor = (enemySideFloor > 300) ? 300
: 100 + 25*(level-1);
bonusPlaneDelay = (bonusPlaneDelay > 450) ? 450
: 350 + 10*(level-1);
bonusPlaneSpeed = (bonusPlaneSpeed > 12) ? 12
: 4 + (1*level);
bonusPlaneFrameCounter = 0;
enemyFrameCounter = enemyWaveDelay;
startShots = 30;
shots+=startShots;
scoreNeededForExtraShip = 10000;
baseEnemyScore = 100;
enemyHitBonus = 500;
baseBonusPlaneScore = 500;
maxBonusPlanes = 1;
maxVisibleShips = 3;
bonusPlaneMaxY =350;
shipYPadding = 5;
Search WWH ::




Custom Search