def main(): #global donePlaying #global titleScreen #global howToPlay #global mainGame #global gameOver #global creditScreen #global startMenu #global menu #global clearSprites while Globals.donePlaying != True: print Globals.donePlaying if Globals.titleScreen == True: Title.title() elif Globals.howToPlay == True: Instructions.instructions() elif Globals.mainGame == True: Game.game() elif Globals.pauseMenu == True: PauseMenu.pausemenu() elif Globals.gameOver == True: GameOver.gameover() elif Globals.creditScreen == True: Credits.credits() elif Globals.winScreen == True: Win.win()
def _show_credits( self ): self.last_pos_container_9000 = xbmc.getInfoLabel( "Container(9000).Position" ) self.action = None try: import Credits self._close_script() Credits.show_credits( self.last_pos_container_9000 ) del Credits except: print_exc()
def _show_credits(self): self.last_pos_container_9000 = xbmc.getInfoLabel( "Container(9000).Position") self.action = None try: import Credits self._close_script() Credits.show_credits(self.last_pos_container_9000) del Credits except: print_exc()
def __init__(self): self.window_width = 800 self.window_height = 600 self.window = pygame.display.set_mode( (self.window_width, self.window_height)) self.running = True self.top_color = (255, 225, 200) self.bottom_color = (50, 0, 50) self.clock = pygame.time.Clock() self.audio_manager = AudioManager.AudioManager() self.part_sys = ParticleSystem.ParticleSystem(self.top_color, self.bottom_color) self.top_player = Player.Player(self.window_width // 2 - 12, -50, self.part_sys, self.audio_manager) self.bottom_player = Player.Player(self.window_width // 2 - 12, self.window_height, self.part_sys, self.audio_manager) self.immovable_num = 3 self.level_num = -1 self.max_level_num = 5 self.level = Level.Level() self.camera = Camera.Camera(self.window) self.game_state = GameState.MENU self.credits = Credits.Credits(self.window_width, self.window_height, self.top_color) self.menu = Menu.Menu(self.window_width, self.window_height, self.bottom_color, self.top_color) self.next_state = None self.transitioning = False self.animator = Animator.Animator() pygame.display.set_caption("Laws of Reflection") self.bottom_player.inverse() self.next_level()
import pygame from Credits import * from Menu import * from Options import * from Starmap import * ''' ''' (screen, world) = init() launch = True menu = Menu() starmap = StarMap() credits = Credits() options = Options() #world = GameWorld(screen) t1 = 0 t0 = 0 config = ConfigParser.RawConfigParser() config.read('settings.cfg') menu.setSound(config.getint('settings', 'volume')) menu.setMusic(config.getint('settings', 'music')) starmap_timer = time.clock() starmap_active = False pygame.mouse.set_visible(False) # pygame.transform.set_smoothscale_backend("MMX") menu.music.play(-1) while launch:
def runStoryMode(self, peach): while not self.__completed: for event in pygame.event.get(): if event.type == pygame.QUIT: self.__completed = True if event.type == pygame.KEYDOWN: if event.key == pygame.K_q: self.__completed = True # fills screen blue only in select rectangular area (sky) self.__screen.fill((110, 193, 248), rect=(0, 0, 640, 384)) # fills screen green only in select rectangular area (grass/ground) self.__screen.fill((0, 155, 0), rect=(0, 384, 640, 96)) self.findInput() # Causes the sprite's x coordinate to change accordingly peach.__x += self.__moveX # if sprite hits edge of screen, it will stop there if peach.__x <= 0: peach.__x = 0 if peach.__x >= 620: peach.__x = 620 # writes the super princess peach logo self.renderLogo() self.renderCastleRects() startingPointsX = [] # while peach is before the first castle the sign will show for x in range(100): startingPointsX.append(x) startingPointsY = [355] if peach.__x in startingPointsX and peach.__y in startingPointsY: self.renderSpeechBubble() self.renderBowser() self.renderMario() self.writeMessage1() self.writeMessage2() self.renderGround() self.renderCastle() # associates the sprite with the image in updateSprite() peach.updateSprite(peach) # self.__FPS stands for frames per second self.__clock.tick(self.__FPS) pygame.display.update() # stops all music from playing pygame.mixer.music.stop() if self.__state == 2: # You won playCredits = Credits.Credits() playCredits.runCredits() else: # you lost, game over playGameOver = GameOver.GameOver() playGameOver.runGameOver()
def menu(): continueGame = Button((255, 255, 255), "Buttons/ContinueButton.png", (0, 200)) newGame = Button((255, 255, 255), "Buttons/NewGameButton.png", (0, 250)) instructions = Button((255, 255, 255), "Buttons/InstructionButton.png", (200, 200)) sentences = Button((255, 255, 255), "Buttons/SentencesButton.png", (200, 250), (100, 40)) customizations = Button((255, 255, 255), "Buttons/CustomizationsButton.png", (400, 200)) credits = Button((255, 255, 255), "Buttons/creditsButton.png", (400, 250)) quit = Button((255, 255, 255), "Buttons/QuitButton.png", (200, 450)) jetpackMode = False jetpack = Button((255, 255, 255), "res/testButton.png", (450, 450), (50, 50)) twoPlayerMode = False twoPlayer = Button((255, 255, 255), "res/testButton.png", (0, 450), (50, 50)) Tester.restart() state = 0 while state == 0: screen.fill([255, 255, 255]) screen.blit(background, backgroundRect) screen.blit(continueGame.image, continueGame) screen.blit(newGame.image, newGame) screen.blit(instructions.image, instructions) screen.blit(sentences.image, sentences) screen.blit(customizations.image, customizations) screen.blit(credits.image, credits) screen.blit(jetpack.image, jetpack) screen.blit(twoPlayer.image, twoPlayer) screen.blit(quit.image, quit) pygame.display.update() for event in pygame.event.get(): if event.type == QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE): sys.exit("quit game") if event.type == MOUSEBUTTONDOWN: loc = pygame.mouse.get_pos() if (continueGame.clicked(loc[0], loc[1])): Tester.setBoatImage(Customizations.getSelectedBoat()) Tester.resume() elif (newGame.clicked(loc[0], loc[1])): Tester.setSentenceFile(SentenceSelector.getSelected()) Tester.restart() Tester.setBoatImage(Customizations.getSelectedBoat()) Tester.resume() elif (instructions.clicked(loc[0], loc[1])): print("instruction menu") Instructions.load() elif (sentences.clicked(loc[0], loc[1])): SentenceSelector.load() pass elif (customizations.clicked(loc[0], loc[1])): Customizations.load() pass elif (credits.clicked(loc[0], loc[1])): Credits.load() pass elif (jetpack.clicked(loc[0], loc[1])): jetpackMode = not jetpackMode print "Jetpack mode: " + str(jetpackMode) Tester.setJetpackMode(jetpackMode) elif (twoPlayer.clicked(loc[0], loc[1])): twoPlayerMode = not twoPlayerMode print "Two player mode: " + str(twoPlayerMode) Tester.setTwoPlayerMode(twoPlayerMode) elif (quit.clicked(loc[0], loc[1])): return