generated from mwc/project_game
27 lines
675 B
Python
27 lines
675 B
Python
# mine.py
|
|
# ------------
|
|
# By Cory
|
|
# This module defines a mine agent class. It ends the game if enter is pressed while the cursor is over it.
|
|
class Mine:
|
|
character = '_'
|
|
|
|
def __init__(self, position):
|
|
self.position = position
|
|
|
|
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()
|
|
|
|
def hide(self):
|
|
self.display = False
|
|
|
|
def name_me(self, named):
|
|
self.name = named
|
|
|
|
def check_neighbors(self,game):
|
|
pass
|
|
|
|
def reveal():
|
|
pass |