示例#1
0
    def draw_start_text(self):
        """
        description:
            - Creates and draws the Text object when being in pause mode
        :return: nothing
        """
        dbi = DatabaseInteract()
        sets = dbi.get_settings()

        key_left = sets[1]
        key_right = sets[3]
        key_shoot = sets[8]

        heading1 = TextElement(
            center_position=(400, 400),
            font_size=18,
            bg_rgb=BLUE,
            text_rgb=WHITE,
            text=f"Startwinkel mit '{key_left}' und '{key_right}' auswählen",
            )
        heading2 = TextElement(
            center_position=(400, 450),
            font_size=18,
            bg_rgb=BLUE,
            text_rgb=WHITE,
            text=f"Mit '{key_shoot}' Ball abschiessen, zum Beenden 'ESC' drücken ",
            )
        elems = RenderUpdates(heading1,heading2)
        elems.draw(self.screen)
示例#2
0
 def pause_elems(self):
     """
     description:
         - Creates the Text object when being in pause mode
     :return: elements to be drawn during pause mode
     """
     dbi = DatabaseInteract()
     sets = dbi.get_settings()
     heading = TextElement(
         center_position=(400, 400),
         font_size=18,
         bg_rgb=BLUE,
         text_rgb=WHITE,
         text=f"Spiel Pausiert, zum Fortsetzen '{sets[5]}' drücken, zum Beenden 'ESC' drücken ",
         )
     elems = RenderUpdates(heading)
     return elems
示例#3
0
 def draw_spcl_txt(self):
     """
     description:
         - Write the type of the special that just dropped to the top of the screen.
     :return: nothing
     """
     if self.spcl_text is not None:
         info = TextElement(
             center_position=(590, 10),
             font_size=16,
             bg_rgb=BLUE,
             text_rgb=WHITE,
             text=f"Spezial: {self.spcl_text.text} aufgetaucht",
             )
         elems = RenderUpdates(info)
         elems.draw(self.screen)
         if self.spcl_text.tick():
             self.spcl_text = None
示例#4
0
    def settings_page_highlited(self, screen, player, highlited_btn):
        """
        description:
            - Settings page
        :param screen: actual screen
        :param player: player object
        :param highlited_btn: selected button 
        :return: result of game_loop
        """
        # Datenbank zum auslesen der aktuellen Einstellungen
        # ansicht der Settings seite zum Auswaehlen des Buttons L/R/Pause
        dbi = DatabaseInteract()
        sets = dbi.get_settings()

        heading = TextElement(
            center_position=(400, 80),
            font_size=25,
            bg_rgb=BLUE,
            text_rgb=WHITE,
            text="Einstellungen",
        )
        return_btn = UIElement(
            center_position=(140, 570),
            font_size=20,
            bg_rgb=BLUE,
            text_rgb=WHITE,
            text="Zurück zum Hauptmenü",
            action=GameState.TITLE,
        )

        move_left = TextElement(
            center_position=(400, 150),
            font_size=font_size_picker("move_left", highlited_btn),
            bg_rgb=BLUE,
            text_rgb=WHITE,
            text=f"Nach Links: {sets[1]}",
        )

        move_right = TextElement(
            center_position=(400, 200),
            font_size=font_size_picker("move_right", highlited_btn),
            bg_rgb=BLUE,
            text_rgb=WHITE,
            text=f"Nach Rechts: {sets[3]}",
        )

        shoot_ball = TextElement(
            center_position=(400, 250),
            font_size=font_size_picker("shoot_ball", highlited_btn),
            bg_rgb=BLUE,
            text_rgb=WHITE,
            text=f"Ball schiessen: {sets[8]}",
        )

        do_pause = TextElement(
            center_position=(400, 300),
            font_size=font_size_picker("do_pause", highlited_btn),
            bg_rgb=BLUE,
            text_rgb=WHITE,
            text=f"Pausenmenü: {sets[5]}",
        )

        if highlited_btn != 4:
            difficulty = TextElement(
                center_position=(400, 350),
                font_size=font_size_picker("difficulty", highlited_btn),
                bg_rgb=BLUE,
                text_rgb=WHITE,
                text=f"Schwierigkeit: {sets[7]}",
            )
        else:
            difficulty = TextElement(
                center_position=(400, 350),
                font_size=font_size_picker("difficulty", highlited_btn),
                bg_rgb=BLUE,
                text_rgb=WHITE,
                text=
                f"Schwierigkeit: {sets[7]} (mit '+' und '-' anpassen max. 4 min. 1)",
            )

        buttons = RenderUpdates(return_btn, move_left, move_right, do_pause,
                                difficulty, heading, shoot_ball)

        return self.game_loop(screen, buttons, highlited_btn * -1)
示例#5
0
    def settings_page(self, screen, player):
        """
        description:
            - Settings page
        :param screen: actual screen
        :param player: player object
        :return: result of game_loop
        """
        # Datenbank zum auslesen der aktuellen Einstellungen
        dbi = DatabaseInteract()
        sets = dbi.get_settings()

        heading = TextElement(
            center_position=(400, 80),
            font_size=25,
            bg_rgb=BLUE,
            text_rgb=WHITE,
            text="Einstellungen",
        )
        return_btn = UIElement(
            center_position=(140, 570),
            font_size=20,
            bg_rgb=BLUE,
            text_rgb=WHITE,
            text="Zurück zum Hauptmenü",
            action=GameState.TITLE,
        )

        move_left = UIElement(
            center_position=(400, 150),
            font_size=20,
            bg_rgb=BLUE,
            text_rgb=WHITE,
            text=f"Nach Links: {sets[1]}",
            action=GameState.SETTINGS_HIGHLITED_MOVE_LEFT,
        )

        move_right = UIElement(
            center_position=(400, 200),
            font_size=20,
            bg_rgb=BLUE,
            text_rgb=WHITE,
            text=f"Nach Rechts: {sets[3]}",
            action=GameState.SETTINGS_HIGHLITED_MOVE_RIGHT,
        )

        shoot_ball = UIElement(
            center_position=(400, 250),
            font_size=20,
            bg_rgb=BLUE,
            text_rgb=WHITE,
            text=f"Ball schiessen: {sets[8]}",
            action=GameState.SETTINGS_HIGHLITED_SHOOT_BALL,
        )

        do_pause = UIElement(
            center_position=(400, 300),
            font_size=20,
            bg_rgb=BLUE,
            text_rgb=WHITE,
            text=f"Pausenmenü: {sets[5]}",
            action=GameState.SETTINGS_HIGHLITED_DO_PAUSE,
        )

        difficulty = UIElement(
            center_position=(400, 350),
            font_size=20,
            bg_rgb=BLUE,
            text_rgb=WHITE,
            text=f"Schwierigkeit: {sets[7]}",
            action=GameState.SETTINGS_HIGHLITED_DIFFICULTY,
        )

        buttons = RenderUpdates(return_btn, move_left, move_right, do_pause,
                                difficulty, heading, shoot_ball)

        return self.game_loop(screen, buttons, 0)