コード例 #1
0
 def on_select_clicked(self, *args):
     cs = CharacterSelect()
     cs.bind(on_dismiss=self.on_picked)
     cs.open()
コード例 #2
0
 def open_character_select(self):
     cs = CharacterSelect()
     cs.bind(on_dismiss=self.on_picked)
     cs.open()
コード例 #3
0
    def title_loop(self):
        """
        The main loop of the title screen. The user can begin the player vs. player session or exit the game.
        This loop also intializes the the window screen size.

        If the current_selection is 0, then the game enters the player vs. player game.
        If the current_selection is 1, then the game exits.
        :return:
        """

        pygame.init()
        title_loop = True
        display_width = 800
        display_height = 600
        game_display = pygame.display.set_mode((display_width, display_height))
        pygame.display.set_caption('Conflict Resolution')

        fpsClock = pygame.time.Clock()

        cursor_selection = 300
        character_screen = CharacterSelect(self.current_selection)
        select_sound = pygame.mixer.Sound('Sprites/sfx/sounds/24H.wav')
        confirm_sound = pygame.mixer.Sound('Sprites/sfx/sounds/22H.wav')

        while title_loop is True:
            game_display.blit(self.image, (0, 0))
            game_display.blit(self.cursor, (165, cursor_selection))

            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    pygame.quit()
                    quit()

                keys = pygame.key.get_pressed()
                if keys[pygame.K_w]:
                    select_sound.play()
                    if self.current_selection == 0:
                        cursor_selection = 400
                        self.current_selection += 1
                    elif self.current_selection == 1:
                        cursor_selection = 300
                        self.current_selection = 0

                if keys[pygame.K_s]:
                    select_sound.play()
                    if self.current_selection == 0:
                        cursor_selection = 400
                        self.current_selection += 1
                    elif self.current_selection == 1:
                        cursor_selection = 300
                        self.current_selection = 0

                elif keys[pygame.K_u]:
                    if self.current_selection == 0:
                        confirm_sound.play()
                        self.transitionIn(game_display, fpsClock)
                        character_screen.select_screen(game_display)
                    else:
                        pygame.quit()
                        quit()

            fpsClock.tick(60)
            pygame.display.flip()
コード例 #4
0
 def on_char_select_clicked(self, *args):
     cs = CharacterSelect()
     self.dismiss(animation=False)
     cs.open()