Files
project_game/obstacle_spawner.py
mollychi 4f3655867f Im proud im understanding what im doing
Im stuck on testing my code
Im worried my code isnt doing what i want it to but i cant test it to see
2025-12-05 19:50:01 -05:00

16 lines
457 B
Python

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