Files
project_game/manager.py
2026-01-09 09:49:15 -05:00

17 lines
445 B
Python

from fruit import Fruit, SHAPE_DEFINITIONS
from random import choice
from retro.errors import AgentNotFoundByName
class FruitManager:
display = False
def play_turn(self, game):
try:
game.get_agent_by_name("fruit")
except AgentNotFoundByName:
self.create_piece(game)
def create_piece(self, game):
fruit = Fruit((14, 1), game, choice(SHAPE_DEFINITIONS))
game.add_agent(fruit)