示例#1
0
    def __init__(self, screen):
        Level.__init__(self, screen)
        if Globals.winner == 'Red':
            winner = Globals.red_player
            colour = (255, 0, 0)
        elif Globals.winner == 'Blue':
            winner = Globals.blue_player
            colour = (0, 0, 255)
        else:
            winner = 'Draw'
            colour = (255, 255, 255)

        winner_text = TextObject(self, Globals.SCREEN_WIDTH / 3,
                                 Globals.SCREEN_HEIGHT / 3 * 2, winner, 80)
        winner_text.colour = colour
        winner_text.update_text()
        winner_text.x = Globals.SCREEN_WIDTH / 2 - winner_text.width / 2
        self.add_room_object(winner_text)

        battle_text = TextObject(self, Globals.SCREEN_WIDTH / 3,
                                 Globals.SCREEN_HEIGHT / 3, 'Battle Winner',
                                 80)
        battle_text.colour = colour
        battle_text.update_text()
        battle_text.x = Globals.SCREEN_WIDTH / 2 - battle_text.width / 2
        self.add_room_object(battle_text)

        Globals.background_music.stop()

        break_sound = self.load_sound('rock_breaking.ogg')
        self.applause = self.load_sound('applause.wav')
        break_sound.play()
        self.set_timer(60, self.applaud)

        self.set_timer(240, self.end_game)
示例#2
0
    def show_winner(self):
        file_name = os.path.join('Battles', 'results.txt')
        log_file = open(file_name, 'r')
        results_from_file = log_file.read().splitlines(False)
        log_file.close()

        ordered_results = list(Counter(results_from_file).most_common())

        y_pos = 320
        for team in ordered_results:
            team_result = TextObject(self, Globals.SCREEN_WIDTH / 3, y_pos,
                                     '{}    {}'.format(team[0], team[1]), 80,
                                     'Comic Sans MS', (255, 255, 255))
            team_result.x = Globals.SCREEN_WIDTH / 2 - team_result.width / 2
            self.add_room_object(team_result)
            y_pos += 80
示例#3
0
    def __init__(self, screen, joysticks):
        Level.__init__(self, screen, joysticks)

        title = VarsityText(self, Globals.SCREEN_WIDTH / 3,
                            Globals.SCREEN_HEIGHT / 3, 'GF Capture the Flag',
                            80, 'Comic Sans MS', (255, 255, 255))

        title.x = Globals.SCREEN_WIDTH / 2 - title.width / 2
        self.add_room_object(title)

        ctf_text = TextObject(self, Globals.SCREEN_WIDTH / 3,
                              Globals.SCREEN_HEIGHT / 3 + 100,
                              '2020 Championships', 100, 'Comic Sans MS',
                              (255, 255, 255))

        ctf_text.x = Globals.SCREEN_WIDTH / 2 - ctf_text.width / 2
        self.add_room_object(ctf_text)

        if not Globals.first_run:
            self.set_timer(30, self.start_battle)

        ibm_logo = IBMLogo(self, Globals.SCREEN_WIDTH / 2 + 220, 0)
        self.add_room_object(ibm_logo)

        varsity_logo = VarsityLogo(self, Globals.SCREEN_WIDTH / 2 - 130, 0)
        self.add_room_object(varsity_logo)

        griff_logo = GriffLogo(self, Globals.SCREEN_WIDTH / 2 - 580, 0)
        self.add_room_object(griff_logo)

        soma_logo = SomaLogo(self, 80, Globals.SCREEN_HEIGHT - 140)
        self.add_room_object(soma_logo)

        little_phil_logo = LittlePhilLogo(self, Globals.SCREEN_WIDTH - 500,
                                          Globals.SCREEN_HEIGHT - 160)
        self.add_room_object(little_phil_logo)
示例#4
0
    def __init__(self, screen, joysticks):
        Level.__init__(self, screen, joysticks)

        self.background_sound = self.load_sound('dramatic_event.ogg')
        self.background_sound.play()

        ibm_logo = IBMLogo(self, Globals.SCREEN_WIDTH / 2 + 220, 0)
        self.add_room_object(ibm_logo)

        varsity_logo = VarsityLogo(self, Globals.SCREEN_WIDTH / 2 - 130, 0)
        self.add_room_object(varsity_logo)

        griff_logo = GriffLogo(self, Globals.SCREEN_WIDTH / 2 - 580, 0)
        self.add_room_object(griff_logo)

        soma_logo = SomaLogo(self, 80, Globals.SCREEN_HEIGHT - 140)
        self.add_room_object(soma_logo)

        little_phil_logo = LittlePhilLogo(
            self,
            Globals.SCREEN_WIDTH - 500,
            Globals.SCREEN_HEIGHT - 160
        )
        self.add_room_object(little_phil_logo)

        red_team = TextObject(self,
                              Globals.SCREEN_WIDTH / 4,
                              Globals.SCREEN_HEIGHT / 4,
                              'Red : {}'.format(Globals.game_list[Globals.current_battle][1]),
                              70,
                              'Comic Sans MS',
                              (255, 0, 0)
                              )
        red_team.x = Globals.SCREEN_WIDTH / 2 - red_team.width / 2
        self.add_room_object(red_team)

        versus = TextObject(self,
                            Globals.SCREEN_WIDTH / 3,
                            Globals.SCREEN_HEIGHT / 2 - 70,
                            'Versus',
                            70,
                            'Comic Sans MS',
                            (255, 255, 255)
                            )
        versus.x = Globals.SCREEN_WIDTH / 2 - versus.width / 2
        self.add_room_object(versus)

        blue_team = TextObject(self,
                               Globals.SCREEN_WIDTH / 4,
                               Globals.SCREEN_HEIGHT / 4 * 3 - 140,
                               'Blue : {}'.format(Globals.game_list[Globals.current_battle][0]),
                               70,
                               'Comic Sans MS',
                               (0, 0, 255)
                               )
        blue_team.x = Globals.SCREEN_WIDTH / 2 - blue_team.width / 2
        self.add_room_object(blue_team)

        self.load_new_bots()

        self.set_timer(200, self.run_battle)