We are going to start adding a spritesheet that will display the number of lives you have left:
And writing the corresponding component:
When the player runs out of lives, it will call this.engine.loadLevel to reload the level. In a full game, you would load a different level containing a game over screen or the main menu.
We will also need to add a collision event to playerShip:
And finally add the livesIndicator to the level:
Deploy your game again and you will see that you can die under the blast of alien spaceships. Yay!
The game is almost done, keep reading part 7 of this tutorial to add the enemy spawner and the score!