HTML and CSS Reference
In-Depth Information
Rock size constants
These variables set up some human-readable values for the three rock sizes, allowing us
to simply use the constant instead ofa literal value. We can then change the literal value if
needed:
const
const
ROCK_SCALE_LARGE
=
1
;
const
const
ROCK_SCALE_MEDIUM
=
2
;
const
const
ROCK_SCALE_SMALL
=
3
;
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 Object
and
Arrays of
Logical Display Objects
for further details about each:
var
var
player
=
{};
var
var
rocks
=
[];
var
var
saucers
=
[];
var
var
playerMissiles
=
[];
var
var
particles
=
[]
var
var
saucerMissiles
=
[];
Level-specific variables
The level-specific variables handle the difficulty settings when the game level increases.
See the section
Level Knobs
for more details about how these are used:
var
var
levelRockMaxSpeedAdjust
=
1
;
var
var
levelSaucerMax
=
1
;
var
var
levelSaucerOccurrenceRate
=
25
var
var
levelSaucerSpeed
=
1
;
var
var
levelSaucerFireDelay
=
300
;
var
var
levelSaucerFireRate
=
30
;
var
var
levelSaucerMissileSpeed
=
1
;