I made everything spawn on turn 1 using the

Spawner class. When you press enter, you're told
if the space is clear or is a mine, in which
case you lose. Next step is to reveal the numbers.
This commit is contained in:
Cory
2024-05-18 21:59:57 -04:00
parent cb8b28b68c
commit 71e22504ab
9 changed files with 57 additions and 17 deletions

View File

@@ -6,12 +6,12 @@ class Cursor:
name = "cursor"
character = 'O'
def __init__(self, board_size):
board_width, board_height = board_size
self.position = (board_width // 2, board_height - 1)
def __init__(self, position):
self.position = position
def handle_keystroke(self, keystroke, game):
x, y = self.position
if keystroke.name in ("KEY_LEFT", "KEY_RIGHT", "KEY_UP", "KEY_DOWN"):
if keystroke.name == "KEY_LEFT":
new_position = (x - 1, y)
@@ -24,4 +24,4 @@ class Cursor:
if game.on_board(new_position):
if game.is_empty(new_position):
self.position = new_position
game.log(self.position)
game.log("The cursor is at " + str(self.position))