🐍 PyQuest🏰 Game: Haunted Mansion · ❀️ Step 4: Three Lives
⭐ 0 XP🐍 Python is waking up…

Step 4: Three Lives ❀️

Games get exciting when you can lose. Let's add lives! ❀️❀️❀️

It's the score trick from the quiz show, running backwards:

lives = 3               # at the very top

lives = lives - 1       # ouch, that hurt
print(f"πŸ’” Lives left: {lives}")

And then, after something bad happens, check if it's over:

if lives == 0:
    print("πŸ’€ GAME OVER. The mansion keeps you forever.")

Suddenly every choice has weight. Walk into the cobwebs? That's a life. Poke the ghost? That's a life. 😬

Pro tip: put a lives check near the end of your program, so no matter which path they took, the game can declare game over.

Your mission

Keep your story and add:

  1. lives = 3 at the top
  2. At least two bad choices that do lives = lives - 1
  3. Tell them how many lives are left after each one
  4. A if lives == 0: game-over message near the end

Be mean. It's more fun that way. 😈

Your code

Press β–Ά Run to see what your code does!