generated from mwc/project_game
Checkpoint 2: Attaching the "asteroid" to the player if the player touches the "asteroid" This part was challenging as there were new commands I learned while trying to incorporate the retro lab componemets. I included the "asteroid sprawner" to get more than on "asteroid" on the screen. The next part is to end the game.
This commit is contained in:
@@ -5,6 +5,7 @@ class Player:
|
||||
def __init__(self, board_size):
|
||||
board_width, board_height = board_size
|
||||
self.position = (board_width // 2, board_height - 1)
|
||||
self.attached_apples = []
|
||||
|
||||
def handle_keystroke(self, keystroke, game):
|
||||
x, y = self.position
|
||||
@@ -22,7 +23,5 @@ class Player:
|
||||
new_position = (x, y + 1)
|
||||
|
||||
if game.on_board(new_position):
|
||||
if game.is_empty(new_position):
|
||||
self.position = new_position
|
||||
else:
|
||||
game.end()
|
||||
self.position = new_position
|
||||
#self.check_self_collision(game)
|
||||
Reference in New Issue
Block a user