Пример #1
0
    def __init__(self, screen):
        super().__init__(screen)
        self.rect = pg.Rect(0, 0, 0, 0)

        self.x1 = 50
        self.y1 = 50
        self.x2 = 50
        self.y2 = 85
        self.spacing = 30

        self.p1Text = TextLabel("P1", 30, "orange", self.x1 - 35, self.y1 + 4,
                                self.screen)
        self.p2Text = TextLabel("P2", 30, "navy_blue", self.x2 - 35,
                                self.y2 + 4, self.screen)

        self._p1HP = None
        self._p1MaxHP = None
        self._p1Lives = []
        self._p2HP = None
        self._p2MaxHP = None
        self._p2Lives = []

        self._audio = AudioComponent(self, isAutoPlay=False, isRepeat=True)
        self._audio.add("healthy", SFX_RESOURCES["menu_heartbeat_healthy"])
        self._audio.add("injured", SFX_RESOURCES["menu_heartbeat_injured"])
        self._audio.add("danger", SFX_RESOURCES["menu_heartbeat_danger"])
Пример #2
0
    def __init__(self, settingName, settingChoices, size, colour, x, y,
                 spacing, screen):
        """
        :param settingName: String, the name of the setting.
        :param settingChoices: List, containing string options choices.
        :param size: Integer, the size of the font.
        :param colour: 3-Tuple, containing the RGB values of the colour.
        :param x: Integer, the x-position of the text.
        :param y: Integer, the y-position of the text.
        :param spacing: Integer, the gap between the setting name and choice.
        :param screen: pygame.Surface, representing the screen.
        """
        self.rect = pg.Rect(x, y, 0, 0)
        self.screen = screen

        self.index = 0
        self.optionChosen = None
        self.name = TextLabel(settingName, size, colour, x, y, self.screen)

        self.options = [
            TextLabel(choice, size, colour, x + spacing, y, self.screen)
            for choice in settingChoices
        ]

        self.audio = AudioComponent(self, isAutoPlay=False)
        self.audio.add("switch", SFX_RESOURCES["menu_option_switch"])
        self.audio.state = "switch"
Пример #3
0
    def __init__(self, screen):
        super().__init__(screen)
        self.totalOptions = 4
        self.fontSize = 22
        self.fontColour = "white"
        self.x = 250
        self.y = 155
        self.dx = 0
        self.dy = 38

        self.option1 = TextLabel("1 Jugador", self.fontSize, self.fontColour,
                                 self.x, self.y + 1 * self.dy, self.screen)
        self.option2 = TextLabel("2 Jugadores", self.fontSize, self.fontColour,
                                 self.x, self.y + 2 * self.dy, self.screen)
        self.option3 = TextLabel("Opciones", self.fontSize, self.fontColour,
                                 self.x, self.y + 3 * self.dy, self.screen)
        self.option4 = TextLabel("Salir", self.fontSize, self.fontColour,
                                 self.x, self.y + 4 * self.dy, self.screen)
        self.title = ImageLabel(MENU_RESOURCES["assets"]["title"][0], 60, 55,
                                self.screen)
        self.arrow = _Arrow(self.x - 40, self.y + 28, self.dx, self.dy,
                            self.totalOptions, self.screen)

        background = MENU_RESOURCES["screens"]["main"][0]
        self.render = RenderComponent(self)
        self.render.add("background", background)
        self.render.state = "background"

        self.audio = AudioComponent(self, isAutoPlay=False)
        self.audio.add("enter", SFX_RESOURCES["menu_enter"])
Пример #4
0
    def __init__(self, screen):
        super().__init__(screen)
        self.fontSize = 50
        self.fontColour = "orange"
        self.x = 270
        self.y = 225

        self.pauseText = TextLabel("Pause",
                                   self.fontSize,
                                   self.fontColour,
                                   self.x,
                                   self.y,
                                   self.screen,
                                   isItalic=True)

        image = MENU_RESOURCES["screens"]["fade"][0]
        self.render = RenderComponent(self)
        self.render.add("background", image)
        self.render.state = "background"

        self.audio = AudioComponent(self, isAutoPlay=False)
        self.audio.add("pause", SFX_RESOURCES["menu_pause"])
        self.audio.state = "pause"

        # Need to draw once only otherwise it overrides what is already drawn
        # by the Scene Engine
        self.render.update()
        self.pauseText.update()
        self.pauseText.draw()
        self.render.draw()
Пример #5
0
    def __init__(self, screen):
        super().__init__(screen)
        fontSize = 22
        fontColour = "white"
        x, y = 230, 155
        dx, dy = 0, 50

        self.backgroundSetting = _SettingsLabel("Orientación: ",
                                                ["Vertical", "Horizontal"],
                                                fontSize, fontColour, x, y,
                                                130, screen)
        self.fullscreenSetting = _SettingsLabel("Full Screen: ",
                                                ["Desactivar", "Activar"],
                                                fontSize, fontColour, x,
                                                y + dy, 130, screen)

        self.arrow = _Arrow(x - 40, y - 10, dx, dy, 2, screen)
        self.escapeImage = ImageLabel(MENU_RESOURCES["assets"]["esc"], 25, 440,
                                      screen)
        self.escapeText = TextLabel("Esc para volver", 14, fontColour, 50, 445,
                                    screen)

        self.effect = FadeEffect(self.screen)
        self.effect.timeStartDarken = float('inf')
        self.effect.timeEndDarken = float('inf')
        self.dt = 2

        background = MENU_RESOURCES["screens"]["options"][0]
        self.render = RenderComponent(self)
        self.render.add("background", background)
        self.render.state = "background"

        self.audio = AudioComponent(self, isAutoPlay=False)
        self.audio.add("exit", SFX_RESOURCES["menu_exit"])
Пример #6
0
    def __init__(self, screen):
        super().__init__(screen)
        self.screen = screen
        self.fontSize = 18
        self.fontColour = "white"
        self.x = 150
        self.y = 320

        self.enterText = TextLabel("Enter para salir", self.fontSize,
                                   self.fontColour, self.x, self.y,
                                   self.screen)
        self.Text2 = TextLabel("NIVEL 3 COMING SOON...", 32, self.fontColour,
                               100, 100, self.screen)

        image = MENU_RESOURCES["screens"]["fade"][0]
        self.render = RenderComponent(self)
        self.render.add("idle", image)
        self.render.state = "idle"

        self.audio = AudioComponent(self, isAutoPlay=False, isRepeat=True)
        self.audio.add("win", SFX_RESOURCES["scene_win"])
        self.audio.state = "win"
Пример #7
0
    def __init__(self, screen):
        super().__init__(screen)
        self.fontSize = 18
        self.fontColour = "white"
        self.x = 150
        self.y = 320

        self.enterText = TextLabel("Enter para salir", self.fontSize,
                                   self.fontColour, self.x, self.y,
                                   self.screen)

        image = MENU_RESOURCES["screens"]["lose"][0]
        self.render = RenderComponent(self)
        self.render.add("idle", image)
        self.render.state = "idle"

        self.audio = AudioComponent(self, isAutoPlay=False)
        self.audio.add("meow", SFX_RESOURCES["menu_lose"])
        self.audio.state = "meow"