HTML and CSS Reference
In-Depth Information
}
}
Thisisthestatefunctionthatiscalledoneachframetickduringthe
GAME_STATE_PLAYER_DIE
state. First, it checks to see that there are no longer any particles on the screen. This ensures
thatthegamewillnotenduntiltheplayershiphasfinishedexploding.Wealsochecktomake
sure that all the player's missiles have finished their lives. We do this so that we can check
forcollisionsbetweenthe
playerMissiles
andforcollisionsof
rocks
against
saucers
.This
way the player might earn an extra ship before
playerShips--
is called.
When the
particles
and
missiles
have all left the game screen, we subtract
1
from the
playerShips
variable and then switch to
GAME_STATE_GAME_OVER
if the
playerShips
num-
ber is less than
1
.