I did not realize this had to be three submissions. My first progress was the add lives to the asteroid game.

For this feature, I added a health system so the player has three
lives instead of losing instantly. In nav_game.py, I added "health": 3
to the game state, and in spaceship.py I created a take_damage method
that subtracts one life when the ship is hit. If the player's health
reaches zero, the game ends. This change is important because it
makes the game less punishing, gives the player more chances to
recover from mistakes, and makes gameplay feel more balanced and fun.
This commit is contained in:
angelotr
2025-12-08 23:39:17 -05:00
parent 3816c0bac0
commit 47a9e1abe3
9 changed files with 179 additions and 0 deletions

23
nav_game.py Normal file
View File

@@ -0,0 +1,23 @@
# nav_game.py
# ------------
# By MWC Contributors
# This class implements a simple game where a spaceship avoids asteroids.
from spaceship import Spaceship
from asteroid import Asteroid
from retro.game import Game
from spaceship import Spaceship
from asteroid_spawner import AsteroidSpawner
board_size = (25, 25)
ship = Spaceship(board_size)
spawner = AsteroidSpawner()
#adds health to the game
state = {
"score":0,
"health":3 #3 lives
}
game = Game([ship, spawner], state, board_size=board_size)
game.play()