def __init__(self, nextScene, teamColor): """ @param nextScene: The scene which should come after this win screen @param teamColor: The color of the winning team @summary: Initializes win screen for the winning team """ Scene.__init__(self) self.nextScene = nextScene self.frame = Frame() text = "!!! Congratulations !!!\n" text += "\n" text += "The " + teamColor + " team has won" labelText = Label(text) labelText.rect.center = (self.frame.rect.width / 2, self.frame.rect.height / 2) buttonBack = Button("Back", self.runNextScene) buttonBack.rect.size = (128, 32) buttonBack.rect.centerx = self.frame.rect.width / 2 buttonBack.rect.bottom = self.frame.rect.height - 32 self.frame.addWidget(labelText) self.frame.addWidget(buttonBack) self.victory_sound = load_sound("victory.ogg") self.victory_sound.play()
def __init__(self): Scene.__init__(self) self.THRESHOLD = 5 self.text = str() self.lines = list()
def __init__(self, previousScene): """ @param previousScene: The scene which should come after this help @summary: Initializes a help frame """ Scene.__init__(self) self.previousScene = previousScene self.frame = Frame() text = "Welcome to gravity snails\n" text += "=========================\n" text += "\n" text += "You can shoot the snails and the terrain beneath them\n" text += "Snails die if they touch the salt\nor when they are out of hitpoints\n" text += "\nCONTROLS\n=========================\n\n" text += "LEFT MOUSE BUTTON:\nplace snails in the screen\n\n" text += "ARROW KEYS:\nmove and target\n\n" text += "SPACE BAR:\nfire the active weapon\n\n" text += "RIGHT MOUSE BUTTON:\nswitch weapon\n\n" text += "\n" labelText = Label(text) labelText.centerLines = False labelText.rect.center = (self.frame.rect.width / 2, self.frame.rect.height / 2) self.frame.addWidget(labelText) buttonBack = Button("Back", self.runPreviousScene) buttonBack.rect.size = (128, 32) buttonBack.rect.centerx = self.frame.rect.width / 2 buttonBack.rect.bottom = self.frame.rect.height - 32 self.frame.addWidget(buttonBack)
def __init__(self, game, flappy_engine): Scene.__init__(self, game) self.flappy_engine = flappy_engine self.image_loader = ImageLoader() self.initialize_bg(game.screen) self.initialize_pipes() self.initialize_pipes() self.initialize_score()
def __init__(self): """ @summary: Initializes a main menu """ Scene.__init__(self) self.helpMenu = HelpMenu(self) self.menu = Menu() self.menu.addWidget(Button("Start", self.runGame)) self.menu.addWidget(Button("Settings", self.runSettingsMenu)) self.menu.addWidget(Button("Help", self.runHelpMenu)) self.menu.addWidget(Button("Quit", self.quitGame))
def __init__(self, parentScene): """ Initialize the Settingsmenu @param parentScene: The scene he should go back to when the settings are adjusted """ Scene.__init__(self) self.parentScene = parentScene self.frame = Menu() self.sliderPlayers = Slider(2, 4, Settings.GAME_PLAYERS, "Players: ") self.sliderSnails = Slider(2, 10, Settings.GAME_SNAILS, "Snails: ") self.sliderSnailsHp = Slider(1, 150, Settings.GAME_SNAILS_HP, "Hitpoints: ", 10) self.sliderStartTime = Slider(10, 90, Settings.TIMER_STARTTIME, "Turntime: ", 10) self.sliderBreakTime = Slider(1,10, Settings.TIMER_BREAKTIME, "Breaktime: ") self.frame.addWidget(self.sliderPlayers) self.frame.addWidget(self.sliderSnails) self.frame.addWidget(self.sliderSnailsHp) self.frame.addWidget(self.sliderStartTime) self.frame.addWidget(self.sliderBreakTime) self.frame.addWidget(Button("Ok",self.applySettings))
def build_scene(): scene = Scene() tower_1 = Cuboid(100, 300, 100, start_point=[-200, -50, 150], color=(128, 110, 74)) sphere_1 = Spheroid(100, 100, 100, start_point=[100, 100, 100], resolution=20) scene.add_object(tower_1) scene.add_object(sphere_1) return scene
def __init__(self, game): Scene.__init__(self, game) self.initialize_bg(game.screen) self.initialize_menu()
def __init__(self): Scene.__init__(self) self._players = [] pass
def Draw(self, screen): self._map.Draw(screen) Scene.Draw(self, screen)
def Update(self, screen, events): Scene.Update(self, screen, events) for event in pygame.event.get(): if event.type == pygame.KEYDOWN: self.onEvent("New")
def __init__(self): Scene.__init__(self) self._players = [] self._map = map.Map("img.png") pass