def __init__(self, start_time): pygame.key.set_repeat() # Stores 1 dimensional list of each block self.block_list = [] self.width = pygame.display.Info().current_w self.height = pygame.display.Info().current_h self.start_time = start_time self.font = pygame.font.Font("8bitfont.ttf", 25) self.large_font = pygame.font.Font("8bitfont.ttf", 60) self.game_over_text = pygame.image.load("images/gameover.png").convert_alpha() self.game_over_state = False self.victory_state = False self.buttons = {} self.buttons['Main Menu'] = Gui.StandardButton((400, 350, 60, 30), 'Main Menu', center_x=True, font_size=40) self.buttons['Main Menu'].visible = False self.buttons['Leaderboards'] = Gui.StandardButton((400, 420, 60, 30), 'Add to leaderboards', center_x=True, font_size=40) self.buttons['Leaderboards'].visible = False # Draw all the blocks on the screen self.draw_blocks() self.lives = 3 self.score = 0 # Initialises the Paddle and ball classes ready to use in the game self.paddle = Entities.Paddle() self.ball = Entities.Ball(self.paddle.rect.x + self.paddle.rect.width / 2 - 10, self.paddle.rect.y - 20) # Load audio self.block_hit_sound = pygame.mixer.Sound("sounds/hit.wav") self.game_over_sound = pygame.mixer.Sound("sounds/game_over.wav") self.gametime = 0 self.time_in_play_store = 0 self.time_in_play = 0 self.gold_block_exists = False self.time_store = 0 self.running = False self.new_game = True self.speed_up_1 = False self.speed_up_2 = False # Is also a subclass of Scene so it needs to be initialized super().__init__()