HTML and CSS Reference
In-Depth Information
▪
renderRocks()
▪
renderSaucers()
▪
renderSaucerMissiles()
▪
renderParticles()
checkCollisions()
Loopsthroughtheindividualgamedisplayobjectsandchecksthemforcollisions.Seethe
section
Applying Collision Detection
for a detailed discussion of this topic.
firePlayerMissile()
Createsa
playerMissile
objectatthecenteroftheplayershipandfiresitinthedirection
the player ship is facing.
fireSaucerMissile()
Creates a
saucerMissile
object at the center of the saucer and fires it in the direction of
the player ship.
playerDie()
Creates an explosion for the player by calling
createExplode()
, as well as changing the
game application state to
GAME_STATE_PLAYER_DIE
.
createExplode()
Accepts inthelocation fortheexplosiontostartandthenumberofparticles fortheexplo-
sion.
boundingBoxCollide()
Determines whether the rectangular box that encompasses an object's width and height is
overlapping the bounding box of another object. It takes in two logical display objects as
parametersandreturns
true
iftheyareoverlappingand
false
iftheyarenot.Seethesec-
tion
Applying Collision Detection
for details about this function.
splitRock()
Accepts in the scale and
x
and
y
starting points for two new rocks that will be created if a
large or medium rock is destroyed.