Files
project_game/circle.py
juddin2 8769519960 I made sure my circles are falling continously and as the player doges the score increases.
I'm proud of making the circles fall from the top one at a time.
I was stuck on making the circle fall.
2025-12-04 21:14:43 -05:00

27 lines
788 B
Python

from random import randint
class Circle:
name= "circle"
character = 'O'
def __init__(self, position):
self.position = position
def play_turn(self, game):
width, height = game.board_size
fall_speed = game.state.get("fall_speed", 1)
x, y = self.position
player = game.get_agent_by_name('player')
new_position = (x, y + 1)
if new_position == player.position:
game.end()
return
if y >= height - 1:
game.state["score"] += 1
if game.state["fall_speed"] < 5:
game.state["fall_speed"] += 1
self.position = (randint(0, width - 1), 0)
else:
self.position = new_position