Files
project_game/proposal.md/asteroid_spawner.py
tsmith37 35ed9eb328 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.
2025-12-08 20:30:45 -05:00

15 lines
456 B
Python

from random import randint
from asteroid import Asteroid
class AsteroidSpawner:
display = False
def play_turn(self, game):
width, height = game.board_size
game.state['score'] += 1
if self.should_spawn_asteroid(game.turn_number):
asteroid = Asteroid((randint(0, width - 1), 0))
game.add_agent(asteroid)
def should_spawn_asteroid(self, turn_number):
return randint(0, 1000) < turn_number