HTML and CSS Reference
Starts up an explosion at the location where the player ship was when it was hit by
a rock, saucer, or saucer missile. When the explosion is complete (all particles in the
explosion have exhausted their individual life values), it sets the move to the
Displays the “Game Over” screen and starts a new game when the space bar is pressed.
Game application functions
Aside from the game application state functions, there are a number of functions we need for
the game to run. Each state function will call these functions as needed:
Resets the player to the center of the game screen and readies it for game play.
Checks to see whether the player should be awarded an extra ship. See the section Award-
ing the Player Extra Ships for details about this algorithm.
Checks to see whether all the rocks have been destroyed on a given level and, if so, starts
up a new level. See the section Level and Game End for details about this algorithm.
Fills the canvas with the background color on each frame tick.
Sets the base text style before text is written to the game screen.
Iscalled oneachframetick.Itdisplaystheupdatedscore,numberofshipsremaining, and
the current FPS for the game.
Checks the keyPressList array and then modifies the player ship attributes based on the
values found to be true .