Example #1
0
    def world_beat(self):
        high_score = read_high_scores()

        if self.player.score < high_score[self.world_number]:
            world_end_dictionary = {
                HIGH_SCORE: ['High Score For This World: ' + str(high_score[self.world_number]), 'You would need to score ' + str(high_score[self.world_number] - self.player.score) + ' more to beat it!'],
                NEXT_WORLD: ['Continue', 'On to the Next World!']
            }

        elif self.player.score == high_score[self.world_number]:
            world_end_dictionary = {
                HIGH_SCORE: ['High Score For This World: ' + str(high_score[self.world_number]), 'You Tied the High Score!'],
                NEXT_WORLD: ['Continue', 'On to the Next World!']
            }

        else:
            world_end_dictionary = {
                HIGH_SCORE: ['High Score For This World: ' + str(high_score[self.world_number]), 'You Beat the High Score!'],
                NEXT_WORLD: ['Continue', 'On to the Next World!']
            }

            high_score[self.world_number] = self.player.score
            write_high_scores(high_score)

        utility.dim(128, FILL_COLOR)

        # Show world defeated menu
        menu.Menu(self.screen,
                  self.music_list[self.world_number],
                  self.screen.convert(),
                  [0, SCREEN_HEIGHT / 3, SCREEN_WIDTH, SCREEN_HEIGHT],
                  ['World Defeated!', 64, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 4],
                  world_end_dictionary).show()
         
        utility.fade_music()
Example #2
0
    def boss_text(self):
        utility.fade_music()
        utility.play_music(self.boss_fight_music, True)

        # Display boss text
        display_stage = text.Text(FONT_PATH, 64, FONT_COLOR, 'Boss Fight!', 90)
        display_stage.position = vector.Vector2d((SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2))
        display_stage.set_alignment(CENTER_MIDDLE)
        self.text_group.add(display_stage)
Example #3
0
    def boss_text(self):
        utility.fade_music()
        utility.play_music(self.boss_fight_music, True)

        # Display boss text
        display_stage = text.Text(FONT_PATH, 64, FONT_COLOR, 'Boss Fight!', 90)
        display_stage.position = vector.Vector2d(
            (SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2))
        display_stage.set_alignment(CENTER_MIDDLE)
        self.text_group.add(display_stage)
Example #4
0
    def game_beat(self):
        high_score = read_high_scores()

        if self.player.score < high_score[self.world_number]:
            world_end_dictionary = {
                HIGH_SCORE: [
                    'High Score For This World: ' +
                    str(high_score[self.world_number]),
                    'You would need to score ' +
                    str(high_score[self.world_number] - self.player.score) +
                    ' more to beat it!'
                ],
                NEXT_WORLD: ['Credits', 'On to the Credits!']
            }

        elif self.player.score == high_score[self.world_number]:
            world_end_dictionary = {
                HIGH_SCORE: [
                    'High Score For This World: ' +
                    str(high_score[self.world_number]),
                    'You Tied the High Score!'
                ],
                NEXT_WORLD: ['Credits', 'On to the Credits!']
            }

        else:
            world_end_dictionary = {
                HIGH_SCORE: [
                    'High Score For This World: ' +
                    str(high_score[self.world_number]),
                    'You Beat the High Score!'
                ],
                NEXT_WORLD: ['Credits', 'On to the Credits!']
            }

            high_score[self.world_number] = self.player.score
            write_high_scores(high_score)

        utility.dim(128, FILL_COLOR)

        world_end_menu = menu.Menu(
            self.screen, self.music_list[self.world_number],
            self.screen.convert(),
            [0, SCREEN_HEIGHT / 3, SCREEN_WIDTH, SCREEN_HEIGHT],
            ['Congratulations!', 64, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 4],
            world_end_dictionary)

        world_end_menu.show()

        utility.fade_music()
        credits.Credits(self.screen, self.music_list[MENU_MUSIC])

        self.done = True
Example #5
0
    def world_beat(self):
        high_score = read_high_scores()

        if self.player.score < high_score[self.world_number]:
            world_end_dictionary = {
                HIGH_SCORE: [
                    'High Score For This World: ' +
                    str(high_score[self.world_number]),
                    'You would need to score ' +
                    str(high_score[self.world_number] - self.player.score) +
                    ' more to beat it!'
                ],
                NEXT_WORLD: ['Continue', 'On to the Next World!']
            }

        elif self.player.score == high_score[self.world_number]:
            world_end_dictionary = {
                HIGH_SCORE: [
                    'High Score For This World: ' +
                    str(high_score[self.world_number]),
                    'You Tied the High Score!'
                ],
                NEXT_WORLD: ['Continue', 'On to the Next World!']
            }

        else:
            world_end_dictionary = {
                HIGH_SCORE: [
                    'High Score For This World: ' +
                    str(high_score[self.world_number]),
                    'You Beat the High Score!'
                ],
                NEXT_WORLD: ['Continue', 'On to the Next World!']
            }

            high_score[self.world_number] = self.player.score
            write_high_scores(high_score)

        utility.dim(128, FILL_COLOR)

        # Show world defeated menu
        menu.Menu(self.screen, self.music_list[self.world_number],
                  self.screen.convert(),
                  [0, SCREEN_HEIGHT / 3, SCREEN_WIDTH, SCREEN_HEIGHT],
                  ['World Defeated!', 64, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 4],
                  world_end_dictionary).show()

        utility.fade_music()
Example #6
0
    def give_bonus(self):
        increment_bonus = self.player.lives * 50

        if self.bonus == -1:
            self.boss_fight = False
            self.bonus = 0
            self.bonus_text = text.Text(FONT_PATH, 64, FONT_COLOR,
                                        'Bonus Points!')
            self.bonus_text.position = vector.Vector2d(
                (SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 - 50))
            self.bonus_text.set_alignment(CENTER_MIDDLE)
            self.text_group.add(self.bonus_text)

            self.bonus_amount = text.Text(FONT_PATH, 48, FONT_COLOR)
            self.bonus_amount.position = vector.Vector2d(
                (SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 + 50))
            self.bonus_amount.set_alignment(CENTER_MIDDLE)
            self.text_group.add(self.bonus_amount)

        if self.bonus < self.player.lives * 5000 - increment_bonus:
            self.bonus += increment_bonus
            self.bonus_amount.set_text(self.bonus)

        else:
            self.bonus_amount.set_text(self.player.lives * 5000)

            if self.level < MAX_LEVEL:
                self.bonus_text.set_timer(FRAMES_PER_SECOND)
                self.bonus_amount.set_timer(FRAMES_PER_SECOND)

            self.bonus = -1
            self.after_bonus_pause = 1.1 * FRAMES_PER_SECOND

            if self.level < MAX_LEVEL:
                self.level += 1

            self.boss_fight = False
            utility.fade_music()
            utility.play_music(self.music, True)

        utility.play_sound(self.bonus_tally_sound, BAAKE_CHANNEL)
        self.player.increment_score_no_text(increment_bonus)
        self.pause_spawning = 1.5 * FRAMES_PER_SECOND
Example #7
0
    def load_level(self):
        if self.done:
            return

        utility.fade_music()
        utility.play_music(self.music, True)
        self.stage = 0
        self.pause_spawning = 3 * FRAMES_PER_SECOND
        self.player.bullet_bonus = 0
        self.player.reflect_bonus = 0

        self.powerup_group.empty()
        self.enemy_group.empty()
        self.effects_group.empty()

        # Display Level text
        display_name = text.Text(FONT_PATH, 64, FONT_COLOR, self.world_name,
                                 90)
        display_name.set_alignment(CENTER_MIDDLE)
        display_name.position = vector.Vector2d(
            (SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2))
        self.group_list[TEXT_GROUP].add(display_name)

        display_level = text.Text(FONT_PATH, 32, FONT_COLOR,
                                  'Level ' + str(self.level + 1), 90)
        display_level.position = vector.Vector2d(
            (SCREEN_WIDTH / 2, SCREEN_HEIGHT * (2.0 / 3.0)))
        display_level.set_alignment(CENTER_MIDDLE)
        self.group_list[TEXT_GROUP].add(display_level)

        # Reset all information for the new level
        self.enemy_list = []
        self.load_stage()

        utility.play_sound(self.get_ready_sound, OW_CHANNEL)

        temp_image = text.TextSurface(FONT_PATH, 36, FONT_COLOR,
                                      'Get Ready...').image
        help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                            2 * FRAMES_PER_SECOND)
        help_bubble.offset = vector.Vector2d(0.0, -100.0)
        self.effects_group.add(help_bubble)
Example #8
0
    def give_bonus(self):
        increment_bonus = self.player.lives * 50

        if self.bonus == -1:
            self.boss_fight = False
            self.bonus = 0
            self.bonus_text = text.Text(FONT_PATH, 64, FONT_COLOR, 'Bonus Points!')
            self.bonus_text.position = vector.Vector2d((SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 - 50))
            self.bonus_text.set_alignment(CENTER_MIDDLE)
            self.text_group.add(self.bonus_text)

            self.bonus_amount = text.Text(FONT_PATH, 48, FONT_COLOR)
            self.bonus_amount.position = vector.Vector2d((SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 + 50))
            self.bonus_amount.set_alignment(CENTER_MIDDLE)
            self.text_group.add(self.bonus_amount)

        if self.bonus < self.player.lives * 5000 - increment_bonus:
            self.bonus += increment_bonus
            self.bonus_amount.set_text(self.bonus)

        else:
            self.bonus_amount.set_text(self.player.lives * 5000)

            if self.level < MAX_LEVEL:
                self.bonus_text.set_timer(FRAMES_PER_SECOND)
                self.bonus_amount.set_timer(FRAMES_PER_SECOND)

            self.bonus = -1
            self.after_bonus_pause = 1.1 * FRAMES_PER_SECOND

            if self.level < MAX_LEVEL:
                self.level += 1

            self.boss_fight = False
            utility.fade_music()
            utility.play_music(self.music, True)

        utility.play_sound(self.bonus_tally_sound, BAAKE_CHANNEL)
        self.player.increment_score_no_text(increment_bonus)
        self.pause_spawning = 1.5 * FRAMES_PER_SECOND
Example #9
0
    def game_beat(self):
        high_score = read_high_scores()

        if self.player.score < high_score[self.world_number]:
            world_end_dictionary = {
                HIGH_SCORE: ['High Score For This World: ' + str(high_score[self.world_number]), 'You would need to score ' + str(high_score[self.world_number] - self.player.score) + ' more to beat it!'],
                NEXT_WORLD: ['Credits', 'On to the Credits!']
            }

        elif self.player.score == high_score[self.world_number]:
            world_end_dictionary = {
                HIGH_SCORE: ['High Score For This World: ' + str(high_score[self.world_number]), 'You Tied the High Score!'],
                NEXT_WORLD: ['Credits', 'On to the Credits!']
            }

        else:
            world_end_dictionary = {
                HIGH_SCORE: ['High Score For This World: ' + str(high_score[self.world_number]), 'You Beat the High Score!'],
                NEXT_WORLD: ['Credits', 'On to the Credits!']
            }

            high_score[self.world_number] = self.player.score
            write_high_scores(high_score)

        utility.dim(128, FILL_COLOR)

        world_end_menu = menu.Menu(self.screen,
                                   self.music_list[self.world_number],
                                   self.screen.convert(),
                                   [0, SCREEN_HEIGHT / 3, SCREEN_WIDTH, SCREEN_HEIGHT],
                                   ['Congratulations!', 64, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 4],
                                   world_end_dictionary)

        world_end_menu.show()

        utility.fade_music()
        credits.Credits(self.screen, self.music_list[MENU_MUSIC])
        
        self.done = True
Example #10
0
    def load_level(self):
        if self.done:
            return

        utility.fade_music()
        utility.play_music(self.music, True)
        self.stage = 0
        self.pause_spawning = 3 * FRAMES_PER_SECOND
        self.player.bullet_bonus = 0
        self.player.reflect_bonus = 0

        self.powerup_group.empty()
        self.enemy_group.empty()
        self.effects_group.empty()

        # Display Level text
        display_name = text.Text(FONT_PATH, 64, FONT_COLOR, self.world_name, 90)
        display_name.set_alignment(CENTER_MIDDLE)
        display_name.position = vector.Vector2d((SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2))
        self.group_list[TEXT_GROUP].add(display_name)

        display_level = text.Text(FONT_PATH, 32, FONT_COLOR, 'Level ' + str(self.level + 1), 90)
        display_level.position = vector.Vector2d((SCREEN_WIDTH / 2, SCREEN_HEIGHT * (2.0 / 3.0)))
        display_level.set_alignment(CENTER_MIDDLE)
        self.group_list[TEXT_GROUP].add(display_level)

        # Reset all information for the new level
        self.enemy_list = []
        self.load_stage()

        utility.play_sound(self.get_ready_sound, OW_CHANNEL)

        temp_image = text.TextSurface(FONT_PATH, 36, FONT_COLOR, 'Get Ready...').image
        help_bubble = infobubble.InfoBubble(temp_image, self.player, 2 * FRAMES_PER_SECOND)
        help_bubble.offset = vector.Vector2d(0.0, -100.0)
        self.effects_group.add(help_bubble)
    def update(self):
        if self.boss_dead:
            self.time_after_boss += 1

        if self.default_spawn_rate:
            if not self.moono_spawn_rate:
                self.moono_spawn_rate = self.default_spawn_rate
                self.spawn_moono()

            self.moono_spawn_rate -= 1

        if self.new_moono.health <= 0:
            self.moono_dead = True

        if self.current_step == 0:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'Welcome to the tutorial!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.current_step += 1
            self.timer = 0
            
        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 1:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'Use your mouse to move.').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 5 * FRAMES_PER_SECOND and self.current_step == 2:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'Notice the stars that you shoot?').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 3:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'When moving you shoot stars.').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 4:
            self.spawn_moono('balloon')
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'Oh no! Its a Moono!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1
        
        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 5:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'Attack with your stars!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 6:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'Moonos hurt you when they touch you.').image
            self.timer -= 1
            self.moono_dead = False
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 7:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'Did you get the Balloon?').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 8:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'Collect balloons for bonus points!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 9:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'Balloons always help you get more points.').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 10:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'Points are important!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 11:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'Every 50,000 points you get an extra life!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 12:
            self.spawn_baake()
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Oh bother! It's Baake.").image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 13:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Baakes don't hurt you...").image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 14:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, '...but they do love to get in the way!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 15:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'Its usually best to stay away from Baake.').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 16:
            self.spawn_moono('reflect')
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'Blast, another Moono!').image
            self.moono_dead = False
            self.timer-= 1
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 17:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'Did you pickup that powerup gem?').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 18:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'Gems change how you attack.').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 19:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "These effects don't last long...").image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 20:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, '...but they do stack!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 21:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'So pick up as many as you can!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 22:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'It is important to make use of gems').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 23:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'They can really help you out!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 24:
            self.default_spawn_rate = 2.5 * FRAMES_PER_SECOND
            self.mass_attack = True
            self.timer = 0
            self.current_step +=1

        if self.current_step == 25:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "They're attacking en masse!").image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 26:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'Try moving slowly towards them.').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 27:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'You can better control your shots.').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 28:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'This can really increase your chances!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1


        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 29:
            self.spawn_boss()
            self.boss_fight = True
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'Oh no! Its a boss!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 30:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'Kill the moonos that spawn.').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 31:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'Some of them will drop a nova.').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer == 3 * FRAMES_PER_SECOND and self.current_step == 32:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'Use the nova when the boss is near').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1

        if self.timer == 3 * FRAMES_PER_SECOND and self.current_step == 33:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'Only novas can hurt bosses!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step +=1
        
        if self.time_after_boss == 1 * FRAMES_PER_SECOND:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, 'Congratulations!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)

        if self.time_after_boss == 3 * FRAMES_PER_SECOND:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR, "Looks like you're ready for a real challenge!").image
            help_bubble = infobubble.InfoBubble(temp_image, self.player, 2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)

        if self.moono_dead or self.mass_attack:
            self.timer += 1

        if self.time_after_boss == 5 * FRAMES_PER_SECOND:
            utility.fade_music()
            return True
Example #12
0
    if menu_result == START_GAME:
        last_highlighted = settings_list[WORLD_UNLOCKED]
        world_result = menu.Menu(
            screen, music_list[MENU_MUSIC], new_scene, menu_bounds,
            ('Choose a World', 96, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 4),
            world_menu_dictionary, last_highlighted).show()

        if world_result == TUTORIAL:
            game.Game(screen, 0, music_list).run()

        elif world_result == EXIT_OPTIONS:
            world_result = False

        elif world_result is not False:
            utility.fade_music()
            utility.play_music(music_list[world_result - 1], True)
            game.Game(screen, world_result - 1, music_list).run()

    elif menu_result == OPTION_MENU:
        option_result = True
        last_highlighted = 0
        while option_result:
            option_result = menu.Menu(
                screen, music_list[MENU_MUSIC], new_scene, menu_bounds,
                ('Options', 96, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 4),
                option_menu_dictionary, last_highlighted).show()

            if option_result == SOUND_MENU:
                sound_result = True
                last_highlighted = 0
Example #13
0
    def handle_events(self):
        for event in pygame.event.get():
            if (event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE) or (event.type == pygame.MOUSEBUTTONDOWN and event.button == 3) or (event.type == pygame.ACTIVEEVENT and event.gain == 0):
                utility.dim(128, FILL_COLOR)

                # Grab a copy of the screen to show behind the menu
                screen_grab = self.screen.copy()
                pause_menu_running = True
                
                while pause_menu_running:
                    pause_menu = menu.Menu(self.screen,
                                           self.music_list[self.world_number],
                                           screen_grab,
                                           [0, SCREEN_HEIGHT / 3, SCREEN_WIDTH, SCREEN_HEIGHT],
                                           ['Pause', 128, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 4],
                                           pause_menu_dictionary)

                    menu_result = pause_menu.show()
    
                    if menu_result == OPTION_MENU:
                        option_result = True
                        last_highlighted = 0

                        while option_result:
    
                            option_menu_dictionary = {
                                SOUND_MENU: ['Sound Options', 'Change Sound Options'],
                                DISPLAY_MENU: ['Video Options', 'Change Video Options'],
                                CHANGE_SENSITIVITY: ['Mouse Sensitivity: ' + prettyprint.mouse_sensitivity(settings_list[SENSITIVITY]), 'Change Mouse Sensitivity'],
                                EXIT_OPTIONS: ['Back', 'Go Back to the Main Menu']
                            }
    
                            sensitivity_menu_dictionary = {
                                0: ['Very Low', 'Change Sensitivity to Very Low'],
                                1: ['Low', 'Change Sensitivity to Low'],
                                2: ['Normal', 'Change Sensitivity to Normal'],
                                3: ['High', 'Change Sensitivity to High'],
                                4: ['Very High', 'Change Sensitivity to Very High']
                            }
                            
                            sound_menu_dictionary = {
                                TOGGLE_SFX: ['Sound Effects: ' + prettyprint.on(settings_list[SFX]), 'Turn ' + prettyprint.on(not settings_list[SFX]) + ' Sound Effects'],
                                TOGGLE_MUSIC: ['Music: ' + prettyprint.on(settings_list[MUSIC]), 'Turn ' + prettyprint.on(not settings_list[MUSIC]) + ' Music'],
                                EXIT_OPTIONS: ['Back', 'Go Back to the Option Menu']
                            }
                            
                            display_menu_dictionary = {
                                TOGGLE_PARTICLES: ['Particles: ' + prettyprint.able(settings_list[PARTICLES]), 'Turn ' + prettyprint.on(not settings_list[PARTICLES]) + ' Particle Effects'],
                                TOGGLE_FULLSCREEN: ['Video Mode: ' + prettyprint.screen_mode(settings_list[SETTING_FULLSCREEN]), 'Switch To ' + prettyprint.screen_mode(not settings_list[SETTING_FULLSCREEN]) + ' Mode'],
                                EXIT_OPTIONS: ['Back', 'Go Back to the Main Menu']
                            }
    
                            option_result = menu.Menu(self.screen,
                                                      self.music_list[self.world_number],
                                                      screen_grab,
                                                      [0, SCREEN_HEIGHT / 3, SCREEN_WIDTH, SCREEN_HEIGHT],
                                                      ['Options', 96,SCREEN_WIDTH / 2, SCREEN_HEIGHT / 4],
                                                      option_menu_dictionary,
                                                      last_highlighted).show()
                            
                            if option_result == SOUND_MENU:
                                sound_result = True
                                last_highlighted = 0

                                while sound_result:
                                    sound_menu = menu.Menu(self.screen,
                                                           self.music_list[self.world_number],
                                                           screen_grab,
                                                           [0, SCREEN_HEIGHT / 3, SCREEN_WIDTH, SCREEN_HEIGHT],
                                                           ['Sound Options', 96,SCREEN_WIDTH / 2, SCREEN_HEIGHT / 4],
                                                           sound_menu_dictionary,
                                                           last_highlighted)

                                    sound_result = sound_menu.show()
                                    
                                    if sound_result == TOGGLE_SFX:
                                        settings_list[SFX] = not settings_list[SFX]
                                        last_highlighted = 0
                                    
                                    elif sound_result == TOGGLE_MUSIC:
                                        settings_list[MUSIC] = not settings_list[MUSIC]

                                        if not settings_list[MUSIC]:
                                            pygame.mixer.Channel(MUSIC_CHANNEL).stop()

                                        last_highlighted = 1
                                        
                                    elif sound_result == EXIT_OPTIONS:
                                        sound_result = False
                                        
                                    sound_menu_dictionary = {
                                        TOGGLE_SFX: ['Sound Effects: ' + prettyprint.on(settings_list[SFX]), 'Turn ' + prettyprint.on(not settings_list[SFX]) + ' Sound Effects'],
                                        TOGGLE_MUSIC: ['Music: ' + prettyprint.on(settings_list[MUSIC]), 'Turn ' + prettyprint.on(not settings_list[MUSIC]) + ' Music'],
                                        EXIT_OPTIONS: ['Back', 'Go Back to the Option Menu']
                                    }
                                        
                            if option_result == DISPLAY_MENU:
                                display_result = True
                                last_highlighted = 0

                                while display_result:
                                    
                                    display_menu = menu.Menu(self.screen,
                                                             self.music_list[self.world_number],
                                                             screen_grab,
                                                             [0, SCREEN_HEIGHT / 3, SCREEN_WIDTH, SCREEN_HEIGHT],
                                                             ['Video Options', 96,SCREEN_WIDTH / 2, SCREEN_HEIGHT / 4],
                                                             display_menu_dictionary,
                                                             last_highlighted)

                                    display_result = display_menu.show()
                            
                                    if display_result == TOGGLE_PARTICLES:
                                        settings_list[PARTICLES] = not settings_list[PARTICLES]
                                        last_highlighted = 0
                                        
                                    elif display_result == TOGGLE_FULLSCREEN:
                                        settings_list[SETTING_FULLSCREEN] = not settings_list[SETTING_FULLSCREEN]
                                        last_highlighted = 1
                                        pygame.mixer.quit()
                                        pygame.mixer.init()
                                        
                                        if settings_list[SETTING_FULLSCREEN]:
                                            utility.set_fullscreen()
                                        else:
                                            utility.set_fullscreen(False)
                                            
                                        pygame.mouse.set_visible(False)
                                        
                                    elif display_result == EXIT_OPTIONS:
                                        display_result = False
                                        
                                    display_menu_dictionary = {
                                        TOGGLE_PARTICLES: ['Particles: ' + prettyprint.able(settings_list[PARTICLES]), 'Turn ' + prettyprint.on(not settings_list[PARTICLES]) + ' Particle Effects'],
                                        TOGGLE_FULLSCREEN: ['Video Mode: ' + prettyprint.screen_mode(settings_list[SETTING_FULLSCREEN]), 'Switch To ' + prettyprint.screen_mode(not settings_list[SETTING_FULLSCREEN]) + ' Mode'],
                                        EXIT_OPTIONS: ['Back', 'Go Back to the Main Menu']
                                    }
                            
                            elif option_result == EXIT_OPTIONS:
                                option_result = False
                            
                            elif option_result == CHANGE_SENSITIVITY:
                                sensitivity_result = True
                                last_highlighted = 0

                                while sensitivity_result:
                                    sensitivity_menu = menu.Menu(self.screen,
                                                                 self.music_list[self.world_number],
                                                                 screen_grab,
                                                                 [0, SCREEN_HEIGHT / 3, SCREEN_WIDTH, SCREEN_HEIGHT],
                                                                 ['Mouse Sensitivity', 96,SCREEN_WIDTH / 2, SCREEN_HEIGHT / 4],
                                                                 sensitivity_menu_dictionary,
                                                                 last_highlighted)

                                    sensitivity_result = sensitivity_menu.show()
                                    mouse_sensitivities = [0.5, 0.75, 1, 1.25, 1.5]
                                    settings_list[SENSITIVITY] = mouse_sensitivities[sensitivity_result]

                                    if sensitivity_result > 0:
                                        sensitivity_result = False
                                
                    elif menu_result == RESUME_GAME or menu_result == False:
                        pause_menu_running = False
                        pygame.mouse.get_rel()
    
                    elif menu_result == EXIT_GAME:
                        utility.fade_music()
                        utility.play_music(self.music_list[MENU_MUSIC], True)
                        self.done = True
                        pause_menu_running = False
                                       
            elif event.type == pygame.MOUSEMOTION and self.player.lives:
                mouse_input = [pygame.mouse.get_pos()[0] - 512.0, pygame.mouse.get_pos()[1] - 384.0]

                if mouse_input[0] != 0 and mouse_input[1] != 0:
                    self.player.fire()
                    self.player.velocity = (self.player.velocity + mouse_input) / 1.5 * settings_list[SENSITIVITY]
Example #14
0
    def update(self):
        if self.boss_dead:
            self.time_after_boss += 1

        if self.default_spawn_rate:
            if not self.moono_spawn_rate:
                self.moono_spawn_rate = self.default_spawn_rate
                self.spawn_moono()

            self.moono_spawn_rate -= 1

        if self.new_moono.health <= 0:
            self.moono_dead = True

        if self.current_step == 0:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR,
                                          'Welcome to the tutorial!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.current_step += 1
            self.timer = 0

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 1:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR,
                                          'Use your mouse to move.').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 5 * FRAMES_PER_SECOND and self.current_step == 2:
            temp_image = text.TextSurface(
                FONT_PATH, 30, FONT_COLOR,
                'Notice the stars that you shoot?').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 3:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR,
                                          'When moving you shoot stars.').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 4:
            self.spawn_moono('balloon')
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR,
                                          'Oh no! Its a Moono!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 5:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR,
                                          'Attack with your stars!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 6:
            temp_image = text.TextSurface(
                FONT_PATH, 30, FONT_COLOR,
                'Moonos hurt you when they touch you.').image
            self.timer -= 1
            self.moono_dead = False
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 7:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR,
                                          'Did you get the Balloon?').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 8:
            temp_image = text.TextSurface(
                FONT_PATH, 30, FONT_COLOR,
                'Collect balloons for bonus points!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 9:
            temp_image = text.TextSurface(
                FONT_PATH, 30, FONT_COLOR,
                'Balloons always help you get more points.').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 10:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR,
                                          'Points are important!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 11:
            temp_image = text.TextSurface(
                FONT_PATH, 30, FONT_COLOR,
                'Every 50,000 points you get an extra life!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 12:
            self.spawn_baake()
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR,
                                          "Oh bother! It's Baake.").image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 13:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR,
                                          "Baakes don't hurt you...").image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 14:
            temp_image = text.TextSurface(
                FONT_PATH, 30, FONT_COLOR,
                '...but they do love to get in the way!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 15:
            temp_image = text.TextSurface(
                FONT_PATH, 30, FONT_COLOR,
                'Its usually best to stay away from Baake.').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 16:
            self.spawn_moono('reflect')
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR,
                                          'Blast, another Moono!').image
            self.moono_dead = False
            self.timer -= 1
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 17:
            temp_image = text.TextSurface(
                FONT_PATH, 30, FONT_COLOR,
                'Did you pickup that powerup gem?').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 18:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR,
                                          'Gems change how you attack.').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 19:
            temp_image = text.TextSurface(
                FONT_PATH, 30, FONT_COLOR,
                "These effects don't last long...").image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 20:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR,
                                          '...but they do stack!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 21:
            temp_image = text.TextSurface(
                FONT_PATH, 30, FONT_COLOR,
                'So pick up as many as you can!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 22:
            temp_image = text.TextSurface(
                FONT_PATH, 30, FONT_COLOR,
                'It is important to make use of gems').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 23:
            temp_image = text.TextSurface(
                FONT_PATH, 30, FONT_COLOR,
                'They can really help you out!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 24:
            self.default_spawn_rate = 2.5 * FRAMES_PER_SECOND
            self.mass_attack = True
            self.timer = 0
            self.current_step += 1

        if self.current_step == 25:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR,
                                          "They're attacking en masse!").image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 26:
            temp_image = text.TextSurface(
                FONT_PATH, 30, FONT_COLOR,
                'Try moving slowly towards them.').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 27:
            temp_image = text.TextSurface(
                FONT_PATH, 30, FONT_COLOR,
                'You can better control your shots.').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 28:
            temp_image = text.TextSurface(
                FONT_PATH, 30, FONT_COLOR,
                'This can really increase your chances!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                3 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 4 * FRAMES_PER_SECOND and self.current_step == 29:
            self.spawn_boss()
            self.boss_fight = True
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR,
                                          'Oh no! Its a boss!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 30:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR,
                                          'Kill the moonos that spawn.').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer >= 3 * FRAMES_PER_SECOND and self.current_step == 31:
            temp_image = text.TextSurface(
                FONT_PATH, 30, FONT_COLOR,
                'Some of them will drop a nova.').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer == 3 * FRAMES_PER_SECOND and self.current_step == 32:
            temp_image = text.TextSurface(
                FONT_PATH, 30, FONT_COLOR,
                'Use the nova when the boss is near').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.timer == 3 * FRAMES_PER_SECOND and self.current_step == 33:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR,
                                          'Only novas can hurt bosses!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)
            self.timer = 0
            self.current_step += 1

        if self.time_after_boss == 1 * FRAMES_PER_SECOND:
            temp_image = text.TextSurface(FONT_PATH, 30, FONT_COLOR,
                                          'Congratulations!').image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)

        if self.time_after_boss == 3 * FRAMES_PER_SECOND:
            temp_image = text.TextSurface(
                FONT_PATH, 30, FONT_COLOR,
                "Looks like you're ready for a real challenge!").image
            help_bubble = infobubble.InfoBubble(temp_image, self.player,
                                                2 * FRAMES_PER_SECOND)
            help_bubble.set_offset(vector.Vector2d(0.0, -100.0))
            self.text_group.add(help_bubble)

        if self.moono_dead or self.mass_attack:
            self.timer += 1

        if self.time_after_boss == 5 * FRAMES_PER_SECOND:
            utility.fade_music()
            return True
Example #15
0
    def handle_events(self):
        for event in pygame.event.get():
            if (event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE
                ) or (event.type == pygame.MOUSEBUTTONDOWN and event.button
                      == 3) or (event.type == pygame.ACTIVEEVENT
                                and event.gain == 0):
                utility.dim(128, FILL_COLOR)

                # Grab a copy of the screen to show behind the menu
                screen_grab = self.screen.copy()
                pause_menu_running = True

                while pause_menu_running:
                    pause_menu = menu.Menu(
                        self.screen, self.music_list[self.world_number],
                        screen_grab,
                        [0, SCREEN_HEIGHT / 3, SCREEN_WIDTH, SCREEN_HEIGHT],
                        ['Pause', 128, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 4],
                        pause_menu_dictionary)

                    menu_result = pause_menu.show()

                    if menu_result == OPTION_MENU:
                        option_result = True
                        last_highlighted = 0

                        while option_result:

                            option_menu_dictionary = {
                                SOUND_MENU:
                                ['Sound Options', 'Change Sound Options'],
                                DISPLAY_MENU:
                                ['Video Options', 'Change Video Options'],
                                CHANGE_SENSITIVITY: [
                                    'Mouse Sensitivity: ' +
                                    prettyprint.mouse_sensitivity(
                                        settings_list[SENSITIVITY]),
                                    'Change Mouse Sensitivity'
                                ],
                                EXIT_OPTIONS:
                                ['Back', 'Go Back to the Main Menu']
                            }

                            sensitivity_menu_dictionary = {
                                0:
                                ['Very Low', 'Change Sensitivity to Very Low'],
                                1: ['Low', 'Change Sensitivity to Low'],
                                2: ['Normal', 'Change Sensitivity to Normal'],
                                3: ['High', 'Change Sensitivity to High'],
                                4: [
                                    'Very High',
                                    'Change Sensitivity to Very High'
                                ]
                            }

                            sound_menu_dictionary = {
                                TOGGLE_SFX: [
                                    'Sound Effects: ' +
                                    prettyprint.on(settings_list[SFX]),
                                    'Turn ' +
                                    prettyprint.on(not settings_list[SFX]) +
                                    ' Sound Effects'
                                ],
                                TOGGLE_MUSIC: [
                                    'Music: ' +
                                    prettyprint.on(settings_list[MUSIC]),
                                    'Turn ' +
                                    prettyprint.on(not settings_list[MUSIC]) +
                                    ' Music'
                                ],
                                EXIT_OPTIONS:
                                ['Back', 'Go Back to the Option Menu']
                            }

                            display_menu_dictionary = {
                                TOGGLE_PARTICLES: [
                                    'Particles: ' +
                                    prettyprint.able(settings_list[PARTICLES]),
                                    'Turn ' + prettyprint.on(
                                        not settings_list[PARTICLES]) +
                                    ' Particle Effects'
                                ],
                                TOGGLE_FULLSCREEN: [
                                    'Video Mode: ' + prettyprint.screen_mode(
                                        settings_list[SETTING_FULLSCREEN]),
                                    'Switch To ' + prettyprint.screen_mode(
                                        not settings_list[SETTING_FULLSCREEN])
                                    + ' Mode'
                                ],
                                EXIT_OPTIONS:
                                ['Back', 'Go Back to the Main Menu']
                            }

                            option_result = menu.Menu(
                                self.screen,
                                self.music_list[self.world_number],
                                screen_grab, [
                                    0, SCREEN_HEIGHT / 3, SCREEN_WIDTH,
                                    SCREEN_HEIGHT
                                ], [
                                    'Options', 96, SCREEN_WIDTH / 2,
                                    SCREEN_HEIGHT / 4
                                ], option_menu_dictionary,
                                last_highlighted).show()

                            if option_result == SOUND_MENU:
                                sound_result = True
                                last_highlighted = 0

                                while sound_result:
                                    sound_menu = menu.Menu(
                                        self.screen,
                                        self.music_list[self.world_number],
                                        screen_grab, [
                                            0, SCREEN_HEIGHT / 3, SCREEN_WIDTH,
                                            SCREEN_HEIGHT
                                        ], [
                                            'Sound Options', 96,
                                            SCREEN_WIDTH / 2, SCREEN_HEIGHT / 4
                                        ], sound_menu_dictionary,
                                        last_highlighted)

                                    sound_result = sound_menu.show()

                                    if sound_result == TOGGLE_SFX:
                                        settings_list[
                                            SFX] = not settings_list[SFX]
                                        last_highlighted = 0

                                    elif sound_result == TOGGLE_MUSIC:
                                        settings_list[
                                            MUSIC] = not settings_list[MUSIC]

                                        if not settings_list[MUSIC]:
                                            pygame.mixer.Channel(
                                                MUSIC_CHANNEL).stop()

                                        last_highlighted = 1

                                    elif sound_result == EXIT_OPTIONS:
                                        sound_result = False

                                    sound_menu_dictionary = {
                                        TOGGLE_SFX: [
                                            'Sound Effects: ' +
                                            prettyprint.on(settings_list[SFX]),
                                            'Turn ' + prettyprint.on(
                                                not settings_list[SFX]) +
                                            ' Sound Effects'
                                        ],
                                        TOGGLE_MUSIC: [
                                            'Music: ' + prettyprint.on(
                                                settings_list[MUSIC]),
                                            'Turn ' + prettyprint.on(
                                                not settings_list[MUSIC]) +
                                            ' Music'
                                        ],
                                        EXIT_OPTIONS:
                                        ['Back', 'Go Back to the Option Menu']
                                    }

                            if option_result == DISPLAY_MENU:
                                display_result = True
                                last_highlighted = 0

                                while display_result:

                                    display_menu = menu.Menu(
                                        self.screen,
                                        self.music_list[self.world_number],
                                        screen_grab, [
                                            0, SCREEN_HEIGHT / 3, SCREEN_WIDTH,
                                            SCREEN_HEIGHT
                                        ], [
                                            'Video Options', 96,
                                            SCREEN_WIDTH / 2, SCREEN_HEIGHT / 4
                                        ], display_menu_dictionary,
                                        last_highlighted)

                                    display_result = display_menu.show()

                                    if display_result == TOGGLE_PARTICLES:
                                        settings_list[
                                            PARTICLES] = not settings_list[
                                                PARTICLES]
                                        last_highlighted = 0

                                    elif display_result == TOGGLE_FULLSCREEN:
                                        settings_list[
                                            SETTING_FULLSCREEN] = not settings_list[
                                                SETTING_FULLSCREEN]
                                        last_highlighted = 1
                                        pygame.mixer.quit()
                                        pygame.mixer.init()

                                        if settings_list[SETTING_FULLSCREEN]:
                                            utility.set_fullscreen()
                                        else:
                                            utility.set_fullscreen(False)

                                        pygame.mouse.set_visible(False)

                                    elif display_result == EXIT_OPTIONS:
                                        display_result = False

                                    display_menu_dictionary = {
                                        TOGGLE_PARTICLES: [
                                            'Particles: ' + prettyprint.able(
                                                settings_list[PARTICLES]),
                                            'Turn ' + prettyprint.on(
                                                not settings_list[PARTICLES]) +
                                            ' Particle Effects'
                                        ],
                                        TOGGLE_FULLSCREEN: [
                                            'Video Mode: ' +
                                            prettyprint.screen_mode(
                                                settings_list[
                                                    SETTING_FULLSCREEN]),
                                            'Switch To ' + prettyprint.
                                            screen_mode(not settings_list[
                                                SETTING_FULLSCREEN]) + ' Mode'
                                        ],
                                        EXIT_OPTIONS:
                                        ['Back', 'Go Back to the Main Menu']
                                    }

                            elif option_result == EXIT_OPTIONS:
                                option_result = False

                            elif option_result == CHANGE_SENSITIVITY:
                                sensitivity_result = True
                                last_highlighted = 0

                                while sensitivity_result:
                                    sensitivity_menu = menu.Menu(
                                        self.screen,
                                        self.music_list[self.world_number],
                                        screen_grab, [
                                            0, SCREEN_HEIGHT / 3, SCREEN_WIDTH,
                                            SCREEN_HEIGHT
                                        ], [
                                            'Mouse Sensitivity', 96,
                                            SCREEN_WIDTH / 2, SCREEN_HEIGHT / 4
                                        ], sensitivity_menu_dictionary,
                                        last_highlighted)

                                    sensitivity_result = sensitivity_menu.show(
                                    )
                                    mouse_sensitivities = [
                                        0.5, 0.75, 1, 1.25, 1.5
                                    ]
                                    settings_list[
                                        SENSITIVITY] = mouse_sensitivities[
                                            sensitivity_result]

                                    if sensitivity_result > 0:
                                        sensitivity_result = False

                    elif menu_result == RESUME_GAME or menu_result == False:
                        pause_menu_running = False
                        pygame.mouse.get_rel()

                    elif menu_result == EXIT_GAME:
                        utility.fade_music()
                        utility.play_music(self.music_list[MENU_MUSIC], True)
                        self.done = True
                        pause_menu_running = False

            elif event.type == pygame.MOUSEMOTION and self.player.lives:
                mouse_input = [
                    pygame.mouse.get_pos()[0] - 512.0,
                    pygame.mouse.get_pos()[1] - 384.0
                ]

                if mouse_input[0] != 0 and mouse_input[1] != 0:
                    self.player.fire()
                    self.player.velocity = (
                        self.player.velocity +
                        mouse_input) / 1.5 * settings_list[SENSITIVITY]
Example #16
0
    def run(self):
        while not self.done:
            if self.world_done:
                if self.world_number < MAX_WORLD:
                    self.world_beat()

                    # Resetting player lives so that it isn't in their best
                    # interest to play easier worlds just to have extra lives.
                    self.player.lives = 3
                    self.player.life_board.set_text('x' +
                                                    str(self.player.lives))

                    self.player.score = 0
                    self.player.next_bonus = 50000

                    # Loading the new world
                    self.world_number += 1

                    if self.world_number == 0:
                        self.new_scene = scene.TutorialScene()

                    elif self.world_number == 1:
                        self.new_scene = scene.ForestScene()

                    elif self.world_number == 2:
                        self.new_scene = scene.RockyScene()

                    elif self.world_number == 3:
                        self.new_scene = scene.PinkScene()

                    if self.world_number > settings_list[WORLD_UNLOCKED]:
                        settings_list[WORLD_UNLOCKED] = self.world_number

                    utility.play_music(self.music_list[self.world_number],
                                       True)
                    self.current_world = world.World(
                        self.world_list[self.world_number],
                        self.music_list[self.world_number])
                    self.current_world.load()
                    self.world_done = False

                else:
                    self.game_beat()

            self.check_collision()
            self.update()
            self.draw()
            self.handle_events()

            pygame.mouse.set_pos(MOUSE_DEFAULT_POSITION)
            pygame.mouse.get_rel()
            self.mouse_last_move = pygame.mouse.get_pos()

            self.timer.tick(FRAMES_PER_SECOND)

            if self.player.dead:
                high_score = read_high_scores()

                if self.player.score < high_score[self.world_number]:
                    end_game_dictionary = {
                        HIGH_SCORE: [
                            'High Score For This World: ' +
                            str(high_score[self.world_number]),
                            'You would need to score ' +
                            str(high_score[self.world_number] -
                                self.player.score) + ' more to beat it!'
                        ],
                        NEXT_WORLD: ['Exit', 'Return To The Menu']
                    }

                elif self.player.score == high_score[self.world_number]:
                    end_game_dictionary = {
                        HIGH_SCORE: [
                            'High Score For This World: ' +
                            str(high_score[self.world_number]),
                            'You Tied the High Score!'
                        ],
                        NEXT_WORLD: ['Exit', 'Return To The Menu']
                    }

                else:
                    end_game_dictionary = {
                        HIGH_SCORE: [
                            'High Score For This World: ' +
                            str(high_score[self.world_number]),
                            'You Beat the High Score!'
                        ],
                        NEXT_WORLD: ['Exit', 'Return To The Menu']
                    }

                    high_score[self.world_number] = self.player.score
                    write_high_scores(high_score)

                utility.dim(128, FILL_COLOR)

                end_game_menu = menu.Menu(
                    self.screen, self.music_list[self.world_number],
                    self.screen.convert(),
                    [0, SCREEN_HEIGHT / 3, SCREEN_WIDTH, SCREEN_HEIGHT],
                    ['Game Over', 128, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 4],
                    end_game_dictionary)

                end_game_menu.show()

                self.done = True
                utility.fade_music()
                utility.play_music(self.music_list[MENU_MUSIC], True)
Example #17
0
    def run(self):
        while not self.done:
            if self.world_done:
                if self.world_number < MAX_WORLD:
                    self.world_beat()

                    # Resetting player lives so that it isn't in their best
                    # interest to play easier worlds just to have extra lives.
                    self.player.lives = 3
                    self.player.life_board.set_text('x' + str(self.player.lives))
                    
                    self.player.score = 0
                    self.player.next_bonus = 50000

                    # Loading the new world
                    self.world_number += 1
                    
                    if self.world_number == 0:
                        self.new_scene = scene.TutorialScene()

                    elif self.world_number == 1:
                        self.new_scene = scene.ForestScene()

                    elif self.world_number == 2:
                        self.new_scene = scene.RockyScene()

                    elif self.world_number == 3:
                        self.new_scene = scene.PinkScene()
                    
                    if self.world_number > settings_list[WORLD_UNLOCKED]:
                        settings_list[WORLD_UNLOCKED] = self.world_number

                    utility.play_music(self.music_list[self.world_number], True)
                    self.current_world = world.World(self.world_list[self.world_number], self.music_list[self.world_number])
                    self.current_world.load()
                    self.world_done = False
                        
                else:
                    self.game_beat()

            self.check_collision()
            self.update()
            self.draw()
            self.handle_events()
            
            pygame.mouse.set_pos(MOUSE_DEFAULT_POSITION)
            pygame.mouse.get_rel()
            self.mouse_last_move = pygame.mouse.get_pos()
            
            self.timer.tick(FRAMES_PER_SECOND)
     
            if self.player.dead:
                high_score = read_high_scores()

                if self.player.score < high_score[self.world_number]:
                    end_game_dictionary = {
                        HIGH_SCORE: ['High Score For This World: ' + str(high_score[self.world_number]), 'You would need to score ' + str(high_score[self.world_number] - self.player.score) + ' more to beat it!'],
                        NEXT_WORLD: ['Exit', 'Return To The Menu']
                    }

                elif self.player.score == high_score[self.world_number]:
                    end_game_dictionary = {
                        HIGH_SCORE: ['High Score For This World: ' + str(high_score[self.world_number]), 'You Tied the High Score!'],
                        NEXT_WORLD: ['Exit', 'Return To The Menu']
                    }

                else:
                    end_game_dictionary = {
                        HIGH_SCORE: ['High Score For This World: ' + str(high_score[self.world_number]), 'You Beat the High Score!'],
                        NEXT_WORLD: ['Exit', 'Return To The Menu']
                    }

                    high_score[self.world_number] = self.player.score
                    write_high_scores(high_score)

                utility.dim(128, FILL_COLOR)

                end_game_menu = menu.Menu(self.screen,
                                          self.music_list[self.world_number],
                                          self.screen.convert(),
                                          [0, SCREEN_HEIGHT / 3, SCREEN_WIDTH, SCREEN_HEIGHT],
                                          ['Game Over', 128, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 4],
                                          end_game_dictionary)

                end_game_menu.show()

                self.done = True
                utility.fade_music()
                utility.play_music(self.music_list[MENU_MUSIC], True)
Example #18
0
        world_result = menu.Menu(screen,
                                 music_list[MENU_MUSIC],
                                 new_scene,
                                 menu_bounds,
                                 ('Choose a World', 96, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 4),
                                 world_menu_dictionary,
                                 last_highlighted).show()

        if world_result == TUTORIAL:
            game.Game(screen, 0, music_list).run()

        elif world_result == EXIT_OPTIONS:
            world_result = False

        elif world_result is not False:
            utility.fade_music()
            utility.play_music(music_list[world_result - 1], True)
            game.Game(screen, world_result - 1, music_list).run()

    elif menu_result == OPTION_MENU:
        option_result = True
        last_highlighted = 0
        while option_result:
            option_result = menu.Menu(screen,
                                      music_list[MENU_MUSIC],
                                      new_scene,
                                      menu_bounds,
                                      ('Options', 96, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 4),
                                      option_menu_dictionary,
                                      last_highlighted).show()