generated from mwc/project_game
Add features--multiple fruits
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user