This is completely different than anything we did in unit 1. When creating the nav game all the code feels connected as the code was broken up into asteroid, asteroid spawner, game, and spaceship. I think this is so much easier to follow as it was easy to figure out what each thing did. Also, this uses classes which we did not use in unit 1.

This commit is contained in:
jwberent
2025-11-13 17:08:26 -05:00
parent 6d50cc3a63
commit 8e766bb11d
7 changed files with 67 additions and 0 deletions

View File

@@ -2,3 +2,12 @@
# ------------
# By MWC Contributors
# This class implements a simple game where a spaceship avoids asteroids.
from retro.game import Game
from spaceship import Spaceship
from asteroid_spawner import AsteroidSpawner
board_size = (25, 25)
ship = Spaceship(board_size)
spawner = AsteroidSpawner()
game = Game([ship, spawner], {"score": 0,"lives":5}, board_size=board_size)
game.play()