Game Development Reference
In-Depth Information
This format makes it very easy to create settings where a limit is set that if reached, defaults to a
set value. We do this so that the game maxes out at a certain difficulty level.
Now we are ready to starting turning the settings!
numEnemies : This setting is used to set the number of enemies that will appear on any
given level, with a maximum of 100. The first level would have 15, the next 30, then 45,
and so on.
numEnemies =(numEnemies > 100) ? 100 :level * 10 + (level*5);
enemyWaveDelay : This setting is used to set the time for the game to wait before another
enemy shows up on the screen. The shorter the wait, the harder the game. The
minimum is 20 frames. The first level is 60 frames, then 58, then 56, and so on.
enemyWaveDelay =(enemyWaveDelay < 20)? 20:60 - (level-1)*2;
enemyWaveMax : The maximum number of planes that will appear in each wave at the
same time. The maximum set here is 8. We start with 2, then got to 3, 4, and so on. In
the following code, we multiply by 1. Why? We don't have to do it, but that number is
really just a placeholder. You could significantly increase the number of enemy planes
per wave by tweaking this value.
enemyWaveMax =(enemyWaveMax > 8) ? 8:1 * level+1;
enemyWaveMultipleChance : This is the percentage chance that planes will arrive in
multiple waves. There is a 10 percent increase in chance per level passed, starting at 10
percent.
enemyWaveMultipleChance =(enemyWaveMultipleChance > 100)? 100:10*level;
enemySpeed : This defines the flight speed of enemy planes and is calculated in pixels per
frame. We start at 2, then go to 2.5, 3, 3.5, and so.
enemySpeed =(enemySpeed > 8) ? 8:2 + (.5*(level-1));
enemySideChance : This is the percentage chance that enemy planes will come from the
side of the screen. There is a 10 percent increase in chance per level passed, starting at
0 (so the first level will have no planes coming in from the sides).
enemySideChance =(enemySideChance > 70)? 70:10*(level-1);
enemySideFloor : This is the closet position to the player's ships that enemy planes can
enter the screen, from the side (lower levels are harder).
enemySideFloor =(enemySideFloor > 300)? 300:100 + 25*(level-1);
bonusPlaneDelay : This one defines the time (in frames) to wait before sending a bonus
plane onto the screen.
bonusPlaneDelay =(bonusPlaneDelay > 450)? 450:350 + 10*(level-1);
Search WWH ::




Custom Search