Exemplo n.º 1
0
class GestCharacterSelect(object):

    def __init__(self, client):
        self.client = client
        self.scene = CharacterSelect(client)

    def draw(self):
        self.scene.draw()

    def action(self, controller):
        self.scene.action(controller)
        mode = self.client.send(None)
        if STAGE_SELECT == mode:
            return LoadingStageSelect(self.client, self.scene.player_id)
        return self
Exemplo n.º 2
0
class HostCharacterSelect(object):

    def __init__(self, server, client):
        self.server = server
        self.client = client
        self.next = Text("Next", fontsize=160, color=BLACK)
        self.scene = CharacterSelect(client)

    def draw(self):
        self.next.draw(NEXT_BOUNDS)
        self.scene.draw()

    def action(self, controller):
        self.scene.action(controller)
        pos = controller.pos()
        if controller.button_a and scene.contains(NEXT_BOUNDS, pos):
            self.client.send(STAGE_SELECT)
            return StageSelect(self.server, self.client, self.scene.player_id)
        return self
Exemplo n.º 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()
Exemplo n.º 4
0
 def __init__(self, server, client):
     self.server = server
     self.client = client
     self.next = Text("Next", fontsize=160, color=BLACK)
     self.scene = CharacterSelect(client)
Exemplo n.º 5
0
 def __init__(self, client):
     self.client = client
     self.scene = CharacterSelect(client)
Exemplo n.º 6
0
 def open_character_select(self):
     cs = CharacterSelect()
     cs.bind(on_dismiss=self.on_picked)
     cs.open()
Exemplo n.º 7
0
 def on_char_select_clicked(self, *args):
     cs = CharacterSelect()
     self.dismiss(animation=False)
     cs.open()
Exemplo n.º 8
0
 def on_select_clicked(self, *args):
     cs = CharacterSelect()
     cs.bind(on_dismiss=self.on_picked)
     cs.open()