HTML and CSS Reference
In-Depth Information
gameStatePlayerDie()
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
GAME_STATE_PLAYER_START state.
gameStateGameOver()
gameStateGameOver()
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:
resetPlayer()
Resets the player to the center of the game screen and readies it for game play.
checkForExtraShip()
checkForExtraShip()
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.
checkForEndOfLevel()
checkForEndOfLevel()
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.
fillBackground()
fillBackground()
Fills the canvas with the background color on each frame tick.
setTextStyle()
Sets the base text style before text is written to the game screen.
renderScoreBoard()
renderScoreBoard()
Iscalled oneachframetick.Itdisplaystheupdatedscore,numberofshipsremaining, and
the current FPS for the game.
checkKeys()
Checks the keyPressList array and then modifies the player ship attributes based on the
values found to be true .
Search WWH ::




Custom Search