© Graeme Stuart 2017

Graeme Stuart, Introducing JavaScript Game Development , https://doi.org/10.1007/978-1-4842-3252-1_13

13. Death or Glory

Graeme Stuart

(1)Market Harborough, Leicestershire, UK

Our game is nearly finished. In this chapter we’ll add the finishing touches. We’ll add a “game over” state that will end the game when our health reduces to zero. We’ll then add the ability to restart the game without reloading the page. Finally, we’ll add levels that will allow us to play the game continuously, with increasing difficulty and an increasing score multiplier.

Copy your code into a new folder for the final time. Save a copy of your exercise12.html file and rename it to exercise13.html.

Game Over

When the ship runs out of health, nothing happens. ...

Get Introducing JavaScript Game Development : Build a 2D Game from the Ground Up now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.