Beispiel #1
0
 def __init__(self, grid_width, grid_height, mine_count, clock):
     Subject.__init__(self)
     random.seed()
     self.tiles = []
     self.game_symbols = []
     self.grid_width = grid_width
     self.grid_height = grid_height
     self.mine_count = mine_count
     self.game_timer = clock
     self.elapsed_time = 0
     self.moves = 0
     self.marked_tiles = 0
     self.game_screen = pygame.display.set_mode((100+self.grid_width*25, 100+self.grid_height*25))
     pygame.display.set_caption("Minesweeper")
     self.game_active = True
     self.timer_enabled = False
     self.font_medium = pygame.font.Font(None, 32)
     font_mediumlarge = pygame.font.Font(None, 35)
     font_large = pygame.font.Font(None, 72)
     self.game_symbols.append(self.font_medium.render(" 0", 1, Color.GREY))
     self.game_symbols.append(self.font_medium.render(" 1", 1, Color.BLUE))
     self.game_symbols.append(self.font_medium.render(" 2", 1, Color.GREEN))
     self.game_symbols.append(self.font_medium.render(" 3", 1, Color.RED))
     self.game_symbols.append(self.font_medium.render(" 4", 1, Color.PURPLE))
     self.game_symbols.append(self.font_medium.render(" 5", 1, Color.DARK_RED))
     self.game_symbols.append(self.font_medium.render(" 6", 1, Color.BLUE_GREY))
     self.game_symbols.append(self.font_medium.render(" 7", 1, Color.BLACK))
     self.game_symbols.append(self.font_medium.render(" 8", 1, Color.DARK_PURPLE))
     self.game_symbols.append(font_large.render("*", 1, Color.BLACK))
     self.game_symbols.append(font_mediumlarge.render(" l", 1, Color.BLACK))
     self.game_symbols.append(font_mediumlarge.render(" >", 1, Color.RED))
     self.init_grid()
     self.game_screen.fill(Color.GREY)
     self.draw_tiles()
Beispiel #2
0
 def __init__(self):
     Subject.__init__(self)
     self.buttons = []
     self.main_menu = pygame.display.set_mode((300, 300))
     pygame.display.set_caption("Minesweeper")
     self.font = pygame.font.Font(None, 32)
     self.buttons.append(Button((50, 50, 200, 50), Button.Type.PLAY, self.font.render("Start game", 1, Color.BLACK)))
     self.buttons.append(Button((50, 125, 200, 50), Button.Type.STATS, self.font.render("View statistics", 1, Color.BLACK)))
     self.buttons.append(Button((50, 200, 200, 50), Button.Type.QUIT, self.font.render("Exit game", 1, Color.BLACK)))
     self.draw()
Beispiel #3
0
 def __init__(self):
     Subject.__init__(self)
     self.buttons = []
     self.main_menu = pygame.display.set_mode((300, 300))
     pygame.display.set_caption("Minesweeper")
     self.font = pygame.font.Font(None, 32)
     self.buttons.append(
         Button((50, 50, 200, 50), Button.Type.PLAY,
                self.font.render("Start game", 1, Color.BLACK)))
     self.buttons.append(
         Button((50, 125, 200, 50), Button.Type.STATS,
                self.font.render("View statistics", 1, Color.BLACK)))
     self.buttons.append(
         Button((50, 200, 200, 50), Button.Type.QUIT,
                self.font.render("Exit game", 1, Color.BLACK)))
     self.draw()
Beispiel #4
0
 def __init__(self, grid_width, grid_height, mine_count, clock):
     Subject.__init__(self)
     random.seed()
     self.tiles = []
     self.game_symbols = []
     self.grid_width = grid_width
     self.grid_height = grid_height
     self.mine_count = mine_count
     self.game_timer = clock
     self.elapsed_time = 0
     self.moves = 0
     self.marked_tiles = 0
     self.game_screen = pygame.display.set_mode(
         (100 + self.grid_width * 25, 100 + self.grid_height * 25))
     pygame.display.set_caption("Minesweeper")
     self.game_active = True
     self.timer_enabled = False
     self.font_medium = pygame.font.Font(None, 32)
     font_mediumlarge = pygame.font.Font(None, 35)
     font_large = pygame.font.Font(None, 72)
     self.game_symbols.append(self.font_medium.render(" 0", 1, Color.GREY))
     self.game_symbols.append(self.font_medium.render(" 1", 1, Color.BLUE))
     self.game_symbols.append(self.font_medium.render(" 2", 1, Color.GREEN))
     self.game_symbols.append(self.font_medium.render(" 3", 1, Color.RED))
     self.game_symbols.append(self.font_medium.render(
         " 4", 1, Color.PURPLE))
     self.game_symbols.append(
         self.font_medium.render(" 5", 1, Color.DARK_RED))
     self.game_symbols.append(
         self.font_medium.render(" 6", 1, Color.BLUE_GREY))
     self.game_symbols.append(self.font_medium.render(" 7", 1, Color.BLACK))
     self.game_symbols.append(
         self.font_medium.render(" 8", 1, Color.DARK_PURPLE))
     self.game_symbols.append(font_large.render("*", 1, Color.BLACK))
     self.game_symbols.append(font_mediumlarge.render(" l", 1, Color.BLACK))
     self.game_symbols.append(font_mediumlarge.render(" >", 1, Color.RED))
     self.init_grid()
     self.game_screen.fill(Color.GREY)
     self.draw_tiles()
Beispiel #5
0
 def __init__(self):
     Subject.__init__(self)
     self.mouse_state_old = (0, 0, 0)
Beispiel #6
0
 def __init__(self):
     Subject.__init__(self)
     self.mouse_state_old = (0, 0, 0)