We need to tell the HUD
class to show the restart and main menu buttons once the player runs out of health. Open GameScene.swift
and add a new function to the GameScene
class named gameOver
, as shown here:
func gameOver() { // Show the restart and main menu buttons: hud.showButtons() }
That is all for now; we will add to the gameOver
function in the next chapter, when we implement a high score system.