generated from mwc/project_game
Got it to end if the enter (return) key is used.
This commit is contained in:
Binary file not shown.
9
mine.py
9
mine.py
@@ -8,7 +8,8 @@ class Mine:
|
||||
def __init__(self, position):
|
||||
self.position = position
|
||||
|
||||
def play_turn(self, game):
|
||||
if not game.is_empty(self.position):
|
||||
game.log("You hit a mine at " + str(self.position) + ".")
|
||||
game.end()
|
||||
def handle_keystroke(self, keystroke, game):
|
||||
if keystroke.name in ("KEY_ENTER"):
|
||||
if not game.is_empty(self.position):
|
||||
game.log("You hit a mine at " + str(self.position) + ".")
|
||||
game.end()
|
||||
Reference in New Issue
Block a user