def on_show(self): """Create the 'next' button.""" super().on_show() self.buttons.append( ViewButton(self, WIDTH - 110, HEIGHT - 40, 'back', MultiplayerMenu)) self.buttons.append( ViewButton(self, WIDTH - 40, HEIGHT - 40, 'next', MultiplayerHelpTwo))
def on_show(self): """Create the buttons.""" super().on_show() self.buttons.append( ViewButton(self, WIDTH / 2 - 35, HEIGHT / 2 - 50, 'two_player', lambda: MultiplayerGame(2))) self.buttons.append( ViewButton(self, WIDTH / 2 + 35, HEIGHT / 2 - 50, 'three_player', lambda: MultiplayerGame(3))) self.buttons.append( ViewButton(self, WIDTH / 2 - 35, HEIGHT / 2 - 120, 'help', MultiplayerHelpOne)) self.buttons.append( ViewButton(self, WIDTH / 2 + 35, HEIGHT / 2 - 120, 'home', Menu))
def on_show(self): """Create buttons and image.""" super().on_show() self.buttons.append( ViewButton(self, WIDTH - 110, HEIGHT - 40, 'back', MultiplayerHelpOne)) self.buttons.append( ViewButton(self, WIDTH - 40, HEIGHT - 40, 'next', MultiplayerMenu)) x_scale = WIDTH / 1280 y_scale = HEIGHT / 640 scale = min((x_scale, y_scale)) self.main = arcade.Sprite(ASSETS + 'multiplayer_help.png', scale=scale, center_x=WIDTH / 2, center_y=HEIGHT / 2)
def on_update(self, timedelta: float): """Switch to the next frame.""" super().on_update(timedelta) self.time_till_change -= timedelta if self.time_till_change <= 0 and not self.done: try: self.texture, self.time_till_change = next(self.textures) except StopIteration: self.done = True self.buttons = [] self.on_top = [] self.buttons.append( ViewButton(self, WIDTH / 2 - 35, HEIGHT / 2, 'home', Menu)) self.buttons.append( ViewButton(self, WIDTH / 2 + 35, HEIGHT / 2, 'play', Game))
def on_show(self): """Create displays for all the achievements.""" super().on_show() achievements = get_achievements() x = WIDTH / 2 - 140 y = HEIGHT / 2 + 175 for row in achievements: for data in row: x += 70 self.buttons.append( Achievement(self, x, y, data['type'], data['level'], data['name'], data['description'], data['achieved'])) y -= 70 x = WIDTH / 2 - 140 awards = get_awards() x = WIDTH / 2 - 140 for n, award in enumerate(awards): x += 70 self.buttons.append( Award(self, x, y, n, award['name'], award['description'], award['achieved'])) if not (n + 1) % 3: y -= 70 x = WIDTH / 2 - 140 self.buttons.append( ViewButton(self, WIDTH / 2, HEIGHT / 2 - 260, 'home', Menu))
def __init__(self): """Create the buttons.""" super().__init__() sfx_vol = get_sfx_volume() x = WIDTH / 2 y = HEIGHT / 2 + 32.5 self.sfx_slider = Slider(self, x, y, sfx_vol, self.set_sfx) self.buttons.append(self.sfx_slider) music_vol = get_music_volume() y -= 70 self.music_slider = Slider(self, x, y, music_vol, self.set_music) self.buttons.append(self.music_slider) y -= 55 self.buttons.append(ViewButton(self, x, y, 'home', Menu))
def on_show(self): """Create the buttons.""" super().on_show() buttons = { 'multiplayer': MultiplayerMenu, 'play': Game, 'help': Tutorial, 'about': About, 'achievements': Achievements, 'settings': Settings } x = WIDTH / 2 - 70 y = HEIGHT / 2 - 50 for n, name in enumerate(buttons): self.buttons.append(ViewButton(self, x, y, name, buttons[name])) x += 70 if n % 3 == 2: x = WIDTH / 2 - 70 y -= 70 self.buttons.append( IconButton(self, x + 70, y, 'quit', self.window.close)) if music.track != 'menu': music.switch_track('menu')
def on_show(self): """Create back button.""" super().on_show() self.buttons.append( ViewButton(self, WIDTH / 2, HEIGHT / 2 - 150, 'home', Menu))