add a alien target and a shooter to hit it

I am actually really proud that i was able to figure out how to make the alien move
in every direction randomly.
This commit is contained in:
tsmith37
2025-12-08 20:30:45 -05:00
parent d0c4bb8b26
commit 35ed9eb328
9 changed files with 130 additions and 16 deletions

View File

@@ -1,9 +1,14 @@
from retro.game import Game
from spaceship import Spaceship
from targets import Asteroid
# from asteroid_spawner import AsteroidSpawner
from targets import Alien
from shooter import Shooter
import random
board_size = (100, 25)
width, height = board_size
ship = Spaceship(board_size)
targets = Asteroid((board_size[0] // 2, 0))
game = Game([ship, targets], {"score": 0}, board_size=board_size, color="white_on_blue")
shooter = Shooter()
spawner = Alien((random.randint(0, width-1), random.randint(0, height-1)))
game = Game([ship, spawner, shooter], {"score": 0}, board_size=board_size, color="white_on_blue")
game.play()