Esempio n. 1
0
    def game_over(self):

        text_1 = text.Text("Game Over", screen.red,
                           (screen.scr_width / 2, screen.scr_height / 2 - 50),
                           90)
        text_2 = text.Text("Press SPACE for Play Again or ESC for Quit Game",
                           screen.red,
                           (screen.scr_width / 2, screen.scr_height / 2 + 50),
                           25)
        text_3 = text.Text(
            "Your score: ", screen.red,
            (screen.scr_width / 2 - 50, screen.scr_height / 2 + 100), 25)
        text_4 = text.Text(
            self.score, screen.red,
            (screen.scr_width / 2 + 50, screen.scr_height / 2 + 100), 25)

        while True:
            screen.screen.fill(screen.white)
            text_1.print_text()
            text_2.print_text()
            text_3.print_text()
            text_4.print_text()
            pygame.display.update()
            for event in pygame.event.get():
                if event.type == pygame.KEYDOWN:
                    if event.key == pygame.K_SPACE:
                        self.state = 1
                        return None
                    if event.key == pygame.K_ESCAPE:
                        self.state = 3
                        return None
                if event.type == pygame.QUIT:
                    self.state = 3
                    return None
Esempio n. 2
0
    def help_game(self):

        text_1 = text.Text("How to play???", screen.red,
                           (screen.scr_width / 2, 40), 90)
        text_2 = text.Text("Eat errors.", screen.red,
                           (screen.scr_width / 2, 140), 40)
        text_3 = text.Text("Use arrow keys.", screen.red,
                           (screen.scr_width / 2, 240), 40)
        text_4 = text.Text("Press ESC to go back.", screen.red,
                           (screen.scr_width / 2, 640), 40)

        while True:
            screen.screen.fill(screen.white)
            text_1.print_text()
            text_2.print_text()
            text_3.print_text()
            text_4.print_text()
            pygame.display.update()
            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    self.state = 3
                    return None
                if event.type == pygame.KEYDOWN:
                    if event.key == pygame.K_ESCAPE:
                        self.state = 0
                        return None
Esempio n. 3
0
    def game_pause():

        text_1 = text.Text("Game Paused", screen.red,
                           (screen.scr_width / 2, screen.scr_height / 2 - 50),
                           40)
        text_2 = text.Text("Press SPACE for return to the game!", screen.red,
                           (screen.scr_width / 2, screen.scr_height / 2 + 50),
                           25)

        while True:
            screen.screen.fill(screen.white)
            text_1.print_text()
            text_2.print_text()
            pygame.display.update()
            for event in pygame.event.get():
                if event.type == pygame.KEYDOWN:
                    if event.key == pygame.K_SPACE:
                        return None
Esempio n. 4
0
    def menu_game(self):

        text_1 = text.Text("Error Eater", screen.red,
                           (screen.scr_width / 2, screen.scr_height / 2 - 100),
                           90)
        text_2 = text.Text("Play Game!", screen.red,
                           (screen.scr_width / 2, screen.scr_height / 2 + 50),
                           40)
        text_3 = text.Text("Quit Game", screen.red,
                           (screen.scr_width / 2, screen.scr_height / 2 + 150),
                           40)
        text_4 = text.Text("Help", screen.red,
                           (screen.scr_width / 2, screen.scr_height / 2 + 100),
                           40)

        select = "Play Game!"

        while True:

            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    self.state = 3
                    return None
                if event.type == pygame.KEYDOWN:
                    if event.key == pygame.K_SPACE:
                        self.state = 1
                        return None
                    elif event.key == pygame.K_DOWN:
                        if select == "Play Game!":
                            select = "Help"
                        else:
                            select = "Quit Game"
                    elif event.key == pygame.K_UP:
                        if select == "Help":
                            select = "Play Game!"
                        elif select == "Quit Game":
                            select = "Help"
                    if event.key == pygame.K_RETURN:
                        if select == "Play Game!":
                            self.state = 1
                            return None
                        if select == "Help":
                            self.state = 4
                            return None
                        if select == "Quit Game":
                            self.state = 3
                            return None

            screen.screen.blit(self.menu_back, (0, 0))
            text_1.print_text()
            if select == "Play Game!":
                text_2.change_colour(screen.gold)
            else:
                text_2.change_colour(screen.red)
            text_2.print_text()
            if select == "Help":
                text_4.change_colour(screen.gold)
            else:
                text_4.change_colour(screen.red)
            text_4.print_text()
            if select == "Quit Game":
                text_3.change_colour(screen.gold)
            else:
                text_3.change_colour(screen.red)
            text_3.print_text()
            pygame.display.update()
Esempio n. 5
0
    def show_score(self):
        text_1 = text.Text(self.get_score_str(), screen.red,
                           (screen.scr_width / 2, 40), 90)

        text_1.print_text()