Add features--multiple fruits

This commit is contained in:
Chris Proctor
2026-03-19 12:33:25 -04:00
parent 9276ed9aa0
commit 610ef88ece
5 changed files with 81 additions and 42 deletions

View File

@@ -3,6 +3,7 @@ from random import randint
class CatcherPiece:
character = "-"
color = "white_on_indigo"
z = 1
def __init__(self, position):
self.position = position
@@ -24,13 +25,13 @@ class Catcher:
x, y = self.position
width, height = game.board_size
if keystroke.name == "KEY_LEFT":
if 0 < x:
self.position = (x-1, y)
self.update_piece_positions()
new_x = max(0, x - 3)
self.position = (new_x, y)
self.update_piece_positions()
if keystroke.name == "KEY_RIGHT":
if x + self.width < width:
self.position = (x+1, y)
self.update_piece_positions()
new_x = min(width - self.width, x + 3)
self.position = (new_x, y)
self.update_piece_positions()
def create_pieces(self, game):
x, y = self.position