def __init__(self, scr):
        """Input parameters:
        scr - Surface for drawing."""
        self.scr = scr
        scr_rect = self.scr.get_rect()

        self.sliding_label = SlidingLabel(scr=self.scr,
                                          text=TEXT_MESSAGE,
                                          color=COLOR_PRIMARY,
                                          size=FONT_SIZE,
                                          slide=SLIDE_BOTTOM)
        self.sliding_label.set_origin_center(
            (scr_rect.centerx, -self.sliding_label.rect.height // 2))
        self.sliding_label.set_max_progress(
            (scr_rect.height + self.sliding_label.rect.height) // 2)
        self.sliding_label.set_speed(SLIDING_SPEED)
        self.sliding_label.set_repeat(False)

        self.blinking_label = BlinkingLabel(scr=self.scr,
                                            text=TEXT_MESSAGE,
                                            color=COLOR_PRIMARY,
                                            second_color=COLOR_SECONDARY,
                                            size=FONT_SIZE)
        self.blinking_label.rect.center = scr_rect.center
        self.blinking_label.set_repeat(False)
        self.blinking_label.set_speed(0.25)
Esempio n. 2
0
    def __init__(self, scr, score=0):
        """Input parameters:
        scr - Surface for drawing;
        score - player's final score."""
        self.scr = scr
        self.background = pygame.image.load(
            f"img/bg/{BACKGROUND_FILENAME}").convert()
        scr_rect = self.scr.get_rect()

        self.labels = []
        for i in range(0, len(ENDING_TEXT)):
            label = FadingLabel(scr=self.scr,
                                text=ENDING_TEXT[i],
                                color=DEFAULT_COLOR,
                                size=FONT_SIZE_DEFAULT)
            label.rect.midtop = (scr_rect.centerx, scr_rect.top +
                                 FONT_SIZE_DEFAULT * (i * 2 + 2))
            label.set_repeat(False)
            self.labels.append(label)

        self.score_label = FadingLabel(scr=self.scr,
                                       text=self._get_score_text(score),
                                       color=SCORE_COLOR,
                                       size=FONT_SIZE_DEFAULT)
        self.score_label.rect.midtop = (scr_rect.centerx,
                                        scr_rect.top + FONT_SIZE_DEFAULT *
                                        (len(ENDING_TEXT) * 2 + 4))
        self.score_label.set_repeat(False)
        self.labels.append(self.score_label)

        self.start_fading_label = FadingLabel(scr=self.scr,
                                              text=START_TEXT,
                                              color=START_COLOR_PRIMARY,
                                              size=FONT_SIZE_START)
        self.start_fading_label.rect.midbottom = (scr_rect.centerx,
                                                  scr_rect.bottom -
                                                  FONT_SIZE_START * 2)
        self.start_fading_label.set_repeat(False)
        self.labels.append(self.start_fading_label)

        self.start_blinking_label = BlinkingLabel(
            scr=self.scr,
            text=START_TEXT,
            color=START_COLOR_PRIMARY,
            second_color=START_COLOR_SECONDARY,
            size=FONT_SIZE_START)
        self.start_blinking_label.rect.midbottom = (
            self.start_fading_label.rect.midbottom)
        self.labels.append(self.start_blinking_label)
Esempio n. 3
0
    def __init__(self, scr):
        """Input parameters:
        scr - Surface for drawing."""
        self.scr = scr
        scr_rect = self.scr.get_rect()

        self.incoming_label = SlidingLabel(
            scr=self.scr,
            text=TEXT_MESSAGE,
            color=COLOR_PRIMARY,
            size=FONT_SIZE,
            slide=SLIDE_RIGHT)
        self.incoming_label.set_origin_center((
            -self.incoming_label.rect.width // 2,
            scr_rect.centery))
        self.incoming_label.set_max_progress(
            (scr_rect.width + self.incoming_label.rect.width) // 2)
        self.incoming_label.set_speed(SLIDING_SPEED)
        self.incoming_label.set_repeat(False)

        self.outcoming_label = SlidingLabel(
            scr=self.scr,
            text=TEXT_MESSAGE,
            color=COLOR_PRIMARY,
            size=FONT_SIZE,
            slide=SLIDE_RIGHT)
        self.outcoming_label.set_origin_center(scr_rect.center)
        self.outcoming_label.set_max_progress(
            (scr_rect.width + self.outcoming_label.rect.width) // 2)
        self.outcoming_label.set_speed(SLIDING_SPEED)
        self.outcoming_label.set_repeat(False)

        self.blinking_label = BlinkingLabel(
            scr=self.scr,
            text=TEXT_MESSAGE,
            color=COLOR_PRIMARY,
            second_color=COLOR_SECONDARY,
            size=FONT_SIZE)
        self.blinking_label.rect.center = scr_rect.center
        self.blinking_label.set_repeat(False)
        self.blinking_label.set_speed(1)
Esempio n. 4
0
    def __init__(self, scr, view_point, stars):
        """Input parameters:
        scr - Surface for drawing;
        view_point - ViewPoint class instance;
        stars - Stars class instance for drawing."""
        self.scr = scr
        self.view_pt = view_point
        self.stars = stars
        self.background = pygame.image.load(
            f"img/bg/{BACKGROUND_FILENAME}").convert()
        scr_rect = self.scr.get_rect()

        self.top_sliding_label = SlidingLabel(
            scr=self.scr,
            text=TOP_TITLE_TEXT,
            color=TITLE_COLOR_PRIMARY,
            size=FONT_SIZE_TITLE,
            typeface=TYPEFACE_3D,
            slide=SLIDE_RIGHT)
        self.top_sliding_label.set_origin_center((
            -self.top_sliding_label.rect.width // 2,
            scr_rect.centery - FONT_SIZE_TITLE // 2))
        self.top_sliding_label.set_max_progress(
            (scr_rect.width + self.top_sliding_label.rect.width) // 2)
        self.top_sliding_label.set_speed(SLIDING_SPEED)
        self.top_sliding_label.set_repeat(False)

        self.bottom_sliding_label = SlidingLabel(
            scr=self.scr,
            text=BOTTOM_TITLE_TEXT,
            color=TITLE_COLOR_PRIMARY,
            size=FONT_SIZE_TITLE,
            typeface=TYPEFACE_3D,
            slide=SLIDE_LEFT)
        self.bottom_sliding_label.set_origin_center((
            scr_rect.width + self.bottom_sliding_label.rect.width // 2,
            scr_rect.centery + FONT_SIZE_TITLE // 2))
        self.bottom_sliding_label.set_max_progress(
            (scr_rect.width + self.bottom_sliding_label.rect.width) // 2)
        self.bottom_sliding_label.set_speed(SLIDING_SPEED)
        self.bottom_sliding_label.set_repeat(False)

        self.top_blinking_label = BlinkingLabel(
            scr=self.scr,
            text=TOP_TITLE_TEXT,
            color=TITLE_COLOR_PRIMARY,
            second_color=TITLE_COLOR_SECONDARY,
            size=FONT_SIZE_TITLE,
            typeface=TYPEFACE_3D)
        self.top_blinking_label.rect.center = (
            scr_rect.centerx,
            scr_rect.centery - FONT_SIZE_TITLE // 2)
        self.top_blinking_label.set_speed(0.5)

        self.bottom_blinking_label = BlinkingLabel(
            scr=self.scr,
            text=BOTTOM_TITLE_TEXT,
            color=TITLE_COLOR_PRIMARY,
            second_color=TITLE_COLOR_SECONDARY,
            size=FONT_SIZE_TITLE,
            typeface=TYPEFACE_3D)
        self.bottom_blinking_label.rect.center = (
            scr_rect.centerx,
            scr_rect.centery + FONT_SIZE_TITLE // 2)
        self.bottom_blinking_label.set_speed(0.5)

        self.start_fading_label = FadingLabel(
            scr=self.scr,
            text=START_TEXT,
            color=START_COLOR_PRIMARY,
            size=FONT_SIZE_START)
        self.start_fading_label.rect.midbottom = (
            scr_rect.centerx,
            scr_rect.bottom - FONT_SIZE_START * 2)
        self.start_fading_label.set_repeat(False)

        self.start_blinking_label = BlinkingLabel(
            scr=self.scr,
            text=START_TEXT,
            color=START_COLOR_PRIMARY,
            second_color=START_COLOR_SECONDARY,
            size=FONT_SIZE_START)
        self.start_blinking_label.rect.midbottom = (
            self.start_fading_label.rect.midbottom)