HTML and CSS Reference
Listing 7.19. game.js—HUD updating
As your HUD updates a player's score, it increments and checks to see if they've earned
an extra life. At each update, the score text is completely replaced in the DOM, whereas an
extra life tacks on a new life image. Each time a UFO dies, Hud.update.level() fires
to see if you need to adjust the UFO's speed. If you need to make a UFO speed adjustment,
its timer must be stopped, then started again with a fresh timer.