def __init__(self, sound=False, option=0): state.State.__init__(self) if not sound: globes.play_music("title.ogg") if (Options.BACKGROUND is None): Options.BACKGROUND = pygame.image.load("bg/titlescreen.png")\ .convert() self.option = option self.blink = 0 # cycle through 0-9, display if < 7 self.confirmation = False # if asking for action confirmation self.confirmed = 0 # 0: no, 1: yes if (len(Options.TEXT) == 0): Options.TEXT = [ globes.Globals.FONT.render("Clear High Scores", True, globes.BLACK), globes.Globals.FONT.render("Setup Joystick", True, globes.BLACK), globes.Globals.FONT.render("Volume & Brightness", True, globes.BLACK), globes.Globals.FONT.render("Return to Menu", True, globes.BLACK) ] if Options.LEFT_MARGIN is None: Options.LEFT_MARGIN = 2 * globes.Globals.WIDTH / 3 if Options.HEIGHTS is None: Options.HEIGHTS = [ (globes.Globals.HEIGHT / 2 - globes.Globals.HEIGHT / 8), globes.Globals.HEIGHT / 2 - globes.Globals.HEIGHT / 16, globes.Globals.HEIGHT / 2, globes.Globals.HEIGHT / 2 + globes.Globals.HEIGHT / 16, (globes.Globals.HEIGHT / 2 + globes.Globals.HEIGHT / 8) ]
def event(self, event): if event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE: globes.Globals.RUNNING = False if event.type == pygame.KEYDOWN and event.key == pygame.K_UP: self.option = (self.option - 1) % self.num_options if event.type == pygame.KEYDOWN and event.key == pygame.K_DOWN: self.option = (self.option + 1) % self.num_options if event.type == pygame.KEYDOWN and \ (event.key == pygame.K_SPACE or event.key == pygame.K_RETURN): if self.option == 0: globes.stop_music() globes.play_music("angryTwain.ogg") globes.Globals.GAME = game.Game() globes.Globals.LVLS_UNLOCKED = 1 globes.Globals.STATE = cutscene1.Hack() elif self.option == 1: globes.stop_music() globes.Globals.STATE = score.Score() elif self.option == 2: globes.Globals.STATE = options.Options(True) elif self.option == 3: globes.Globals.RUNNING = False elif self.option == 4: globes.stop_music() globes.play_music("game.ogg") if globes.Globals.MINIGAME is not None: globes.Globals.STATE = globes.Globals.MINIGAME else: globes.Globals.STATE = globes.Globals.GAME
def __init__(self, score): state.State.__init__(self) self.font = pygame.font.Font(None, 50) globes.Globals.SCREEN.fill(globes.Globals.WHITE) globes.play_music("highscore.ogg") # Font variables self.blink = 0 self.y_lvl = 200 surf = self.font.render("WWWWWWWWWW", True, globes.Globals.BLACK) self.x_start = globes.hcenter(surf) - 5 self.letter_width = int(surf.get_width() / 10) if EndGame.UNDERSCORE is None: EndGame.UNDERSCORE = self.font.render("_", True, globes.Globals.BLACK) if EndGame.BACKGROUND is None: EndGame.BACKGROUND = pygame.image.load("bg/scroll.png").convert() highscore = pygame.image.load("imgs/highscore.png").convert_alpha() EndGame.BACKGROUND.blit(highscore, (0, 0)) if EndGame.LETTERS is None: EndGame.LETTERS = [ ' ', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', ' I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ] self.score = int(score) # indices used to reference indices of LETTERS self.name_list = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # index (0-9) of letter in name being edited self.name_index = 0
def __init__(self, sound=False): """ @param sound True if title music is already playing """ state.State.__init__(self) if not sound: globes.play_music("title.ogg") if (Menu.BACKGROUND is None): Menu.BACKGROUND = pygame.image.load("bg/titlescreen.png").convert() self.option = 0 self.blink = 0 # cycle through 0-9, display if < 7 if (len(Menu.TEXT) == 0): Menu.TEXT = [ globes.Globals.FONT.render("New Game", True, globes.BLACK), globes.Globals.FONT.render("High Scores", True, globes.BLACK), globes.Globals.FONT.render("Options", True, globes.BLACK), globes.Globals.FONT.render("Quit", True, globes.BLACK), globes.Globals.FONT.render("Continue Game", True, globes.BLACK) ] if Menu.LEFT_MARGIN is None: Menu.LEFT_MARGIN = 2 * globes.Globals.WIDTH / 3 if Menu.HEIGHTS is None: Menu.HEIGHTS = [ (globes.Globals.HEIGHT / 2 - globes.Globals.HEIGHT / 8), (globes.Globals.HEIGHT / 2 - globes.Globals.HEIGHT / 16), (globes.Globals.HEIGHT / 2), (globes.Globals.HEIGHT / 2 + globes.Globals.HEIGHT / 16), (globes.Globals.HEIGHT / 2 - 3 * globes.Globals.HEIGHT / 16) ] self.num_options = 4 if globes.Globals.GAME is not None: self.num_options = 5 self.option = 4
def __init__(self, sound=False): state.State.__init__(self) if not sound: G.play_music("title.ogg") if (Volume.BACKGROUND is None): self.build_bg() Volume.NOTCH = pygame.image.load("bg/notch.png")\ .convert_alpha() self.option = True # True for volume, False for brightness
def event(self, event): if (event.type == pygame.KEYDOWN): globes.stop_music() globes.play_music("game.ogg") score = globes.Globals.GAME.score timeremaining = globes.Globals.GAME.timeremaining lives = globes.Globals.GAME.lives globes.Globals.STATE = gameover.GameOver(score, timeremaining, lives) globes.Globals.GAME.initialize_lvl(0)
def __init__(self, music=False): state.State.__init__(self) if Score.BACKGROUND is None: Score.BACKGROUND = pygame.image.load("bg/scroll.png").convert() highscore = pygame.image.load("imgs/highscore.png").convert_alpha() Score.BACKGROUND.blit(highscore, (0, 0)) if not music: globes.play_music("highscore.ogg") globes.Globals.SCREEN.fill(pygame.color.Color("black")) self.blit_scores()
def __init__(self): state.State.__init__(self) globes.play_music("title.ogg") self.color = pygame.color.Color("black") self.time = 0.25 self.posx = 0 self.posy = 0 self.velocity = 0 self.direction = 0 # (1 for down, -1 for up) self.width = 0 self.height = 0 if Title.IMAGE is None: Title.IMAGE = \ pygame.image.load("bg/titlescreen.png").convert() globes.Globals.SCREEN.fill(pygame.color.Color("black"))