Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions santoriniGame/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,25 @@ def draw(self, win: pygame.SurfaceType, valid_moves=None):
# Draw the square border
pygame.draw.rect(win, GREY, (x, y, SQUARE_SIZE, SQUARE_SIZE), 2)

# Draw the level number on each tile
level_text = self.font.render(str(self.tile_levels[row][col]), True, (0, 0, 0))
win.blit(level_text, (x + 5, y + 5)) # Position the text in the top left of each tile
if self.tile_levels[row][col] >= 1:
pygame.draw.rect(win, WHITE, (x + SQUARE_SIZE // 20, y + SQUARE_SIZE // 20,
18 * SQUARE_SIZE // 20, 18 * SQUARE_SIZE // 20))
pygame.draw.rect(win, BLACK, (x + SQUARE_SIZE // 20, y + SQUARE_SIZE // 20,
18 * SQUARE_SIZE // 20, 18 * SQUARE_SIZE // 20), width=SQUARE_SIZE//40)
if self.tile_levels[row][col] >= 2:
pygame.draw.rect(win, WHITE, (x + SQUARE_SIZE // 10, y + SQUARE_SIZE // 10,
8 * SQUARE_SIZE // 10, 8 * SQUARE_SIZE // 10))
pygame.draw.rect(win, BLACK, (x + SQUARE_SIZE // 10, y + SQUARE_SIZE // 10,
8 * SQUARE_SIZE // 10, 8 * SQUARE_SIZE // 10),
width=SQUARE_SIZE // 40)
if self.tile_levels[row][col] >= 3:
pygame.draw.circle(win, WHITE, (x + SQUARE_SIZE // 2, y + SQUARE_SIZE // 2),
SQUARE_SIZE // 3)
pygame.draw.circle(win, BLACK, (x + SQUARE_SIZE // 2, y + SQUARE_SIZE // 2),
SQUARE_SIZE // 3, width=SQUARE_SIZE//40)
if self.tile_levels[row][col] >= 4:
pygame.draw.circle(win, BLUE, (x + SQUARE_SIZE // 2, y + SQUARE_SIZE // 2),
SQUARE_SIZE // 3)

# Highlight valid moves
if valid_moves and (row, col) in valid_moves:
Expand Down
5 changes: 4 additions & 1 deletion santoriniGame/pieces.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ def calc_pos(self):
self.y = SQUARE_SIZE * self.row + SQUARE_SIZE // 2

def draw(self, win: pygame.SurfaceType):
radius = SQUARE_SIZE//2 - self.PADDING
radius = SQUARE_SIZE // 4 - self.PADDING
width = SQUARE_SIZE // 40
pygame.draw.circle(win, self.color, (self.x, self.y), radius)
pygame.draw.circle(win, BLACK, (self.x, self.y), radius, width)


def move(self, row: int, col: int, level: int):
self.row = row
Expand Down