HTML and CSS Reference
In-Depth Information
var titleStarted = false;
var gameOverStarted = false;
Game environment variables
These variables set up the necessary defaults for a new game. We will discuss the
extraShipAtEach and extraShipsEarned in the section, “Awarding the Player Extra
Ships” on page 416 :
var score = 0;
var level = 0;
var extraShipAtEach = 10000;
var extraShipsEarned = 0;
var playerShips = 3;
Playfield variables
These variables set up the maximum and minimum x and y coordinates for the
game stage:
var xMin = 0;
var xMax = 400;
var yMin = 0;
var yMax = 400;
Score value variables
These variables set the score value for each of the objects the player can destroy:
var bigRockScore = 50;
var medRockScore = 75;
var smlRockScore = 100;
var saucerScore = 300;
Rock size constants
These variables set up some human-readable values for the three rock sizes, al-
lowing us to simply use the constant instead of a literal value. We can then change
the literal value if needed:
Logical display objects
These variables set up the single player object and arrays to hold the various other
logical display objects for our game. See the upcoming sections “The player Ob-
ject” and “Arrays of Logical Display Objects” on page 412 for further details on
var player = {};
var rocks = [];
var saucers = [];
var playerMissiles = [];
var particles = []
var saucerMissiles = [];
Search WWH ::

Custom Search