I will finish the rest of the project at home

This commit is contained in:
kdang
2026-01-16 09:36:38 -05:00
parent 267fffa9b0
commit 98f6f2716c
8 changed files with 32 additions and 24 deletions

View File

@@ -8,7 +8,7 @@ class CatcherPiece:
def play_turn(self, game):
fruit = game.get_agent_by_name("fruit")
if new_position == fruit.position:
if self.position == fruit.position:
game.state['Score'] += 1
class Catcher:
@@ -36,6 +36,14 @@ class Catcher:
if x + self.width < width:
self.position = (x+1, y)
self.update_piece_positions()
self.checkforfruitcollision(game)
def checkforfruitcollision(self, game):
for piece in self.pieces:
if piece.collision(game):
game.remove_agent(fruit)
game.state['Score'] += 1
def create_pieces(self, game):
x, y = self.position