generated from mwc/project_game
I'm proud of making the circles fall from the top one at a time. I was stuck on making the circle fall.
18 lines
485 B
Python
18 lines
485 B
Python
from random import randint
|
|
from circle import Circle
|
|
|
|
class CircleSpawner:
|
|
display = False
|
|
|
|
def play_turn(self, game):
|
|
width, height = game.board_size
|
|
game.state['score'] += 1
|
|
if self.should_spawn_circle(game.turn_number):
|
|
x= randint(0, width - 1)
|
|
new_circle= Circle((x,0))
|
|
game.add_agent(new_circle)
|
|
|
|
def should_spawn_circle(self, turn_number):
|
|
return randint(0, 200) < turn_number
|
|
|
|
|