def redrawAll(self, screen):
        self.mouse = pygame.mouse.get_pos()
        self.click = pygame.mouse.get_pressed()
        screen.blit(self.background, [-150, 0])

        pygame.draw.rect(
            self.screen, (204, 229, 255),
            (self.width / 2 - 250, self.height / 2 - 20, 500, 200))

        self.firstLine = self.buttonFont.render(
            "Use 'a' 's' 'd' 'f' keys to play the piano", True, (0, 0, 255))
        self.secondLine = self.buttonFont.render(
            "If you make a mistake, you lose a life", True, (0, 0, 255))
        self.thirdLine = self.buttonFont.render(
            "Try to make it to the end of the song", True, (0, 0, 255))
        self.fourthLine = self.buttonFont.render("Good Luck!", True,
                                                 (0, 0, 255))

        self.screen.blit(self.firstLine,
                         (self.width / 2 - 200, self.height / 2))
        self.screen.blit(self.secondLine,
                         (self.width / 2 - 200, self.height / 2 + 50))
        self.screen.blit(self.thirdLine,
                         (self.width / 2 - 200, self.height / 2 + 100))
        self.screen.blit(self.fourthLine,
                         (self.width / 2 - 100, self.height / 2 + 150))

        #CITATION: the following if-statement code from Youtube Channel sentdex
        if 210 > self.mouse[0] > 140 and 600 > self.mouse[1] > 560:
            #pygame.draw.rect(self.screen,(153,153,255),(90,580,190,60))
            self.big = pygame.font.Font("PG_Roof Runners_active_bold-it.ttf",
                                        40)
            self.quit = self.big.render("Quit", True, (127, 0, 255))
            self.screen.blit(self.quit, (140, 570))
            pygame.draw.ellipse(self.screen, (96, 96, 96), (140, 600, 80, 10))
            if self.click[0] == 1:
                pygame.display.quit()
        else:
            self.big = pygame.font.Font("PG_Roof Runners_active_bold-it.ttf",
                                        30)
            self.quit = self.big.render("Quit", True, (0, 102, 204))
            self.screen.blit(self.quit, (140, 570))

        if 540 > self.mouse[0] > 390 and 600 > self.mouse[1] > 560:
            #pygame.draw.rect(self.screen,(153,153,255),(90,580,190,60))
            self.big = pygame.font.Font("PG_Roof Runners_active_bold-it.ttf",
                                        40)
            self.level = self.big.render("Choose Level", True, (127, 0, 255))
            self.screen.blit(self.level, (360, 570))
            pygame.draw.ellipse(self.screen, (96, 96, 96), (360, 600, 250, 10))
            if self.click[0] == 1:
                Level.Levels().run()
        else:
            self.big = pygame.font.Font("PG_Roof Runners_active_bold-it.ttf",
                                        30)
            self.level = self.big.render("Choose Level", True, (0, 102, 204))
            self.screen.blit(self.level, (390, 570))
    def redrawAll(self, screen):
        self.mouse = pygame.mouse.get_pos()
        self.click = pygame.mouse.get_pressed()
        screen.blit(self.background, [-150, 0])

        self.gameOver = self.myFont.render("Game Over!", True, (255, 255, 255))
        self.screen.blit(self.gameOver, (150, 250))

        self.scoreStr = self.myFont2.render("Score:", True, (255, 255, 255))
        self.scoreNum = self.myFont2.render(str(self.score), True,
                                            (255, 255, 255))
        self.screen.blit(self.scoreStr, (200, 380))
        self.screen.blit(self.scoreNum, (420, 380))

        if 200 > self.mouse[0] > 130 and 580 > self.mouse[1] > 540:
            #pygame.draw.rect(self.screen,(153,153,255),(90,580,190,60))
            self.big = pygame.font.Font("PG_Roof Runners_active_bold-it.ttf",
                                        40)
            self.quit = self.big.render("Quit", True, (255, 255, 255))
            self.screen.blit(self.quit, (130, 550))
            if self.click[0] == 1:
                pygame.display.quit()
        else:
            #pygame.draw.rect(self.screen,(0,102,204),(90,580,190,60))
            self.big = pygame.font.Font("PG_Roof Runners_active_bold-it.ttf",
                                        30)
            self.quit = self.big.render("Quit", True, (255, 255, 255))
            self.screen.blit(self.quit, (140, 550))

        if 450 > self.mouse[0] > 380 and 580 > self.mouse[1] > 540:
            #pygame.draw.rect(self.screen,(153,153,255),(90,580,190,60))
            self.big = pygame.font.Font("PG_Roof Runners_active_bold-it.ttf",
                                        40)
            self.play = self.big.render("Play Again", True, (255, 255, 255))
            self.screen.blit(self.play, (390, 550))
            if self.click[0] == 1:
                Level.Levels().run()
        else:
            #pygame.draw.rect(self.screen,(0,102,204),(90,580,190,60))
            self.big = pygame.font.Font("PG_Roof Runners_active_bold-it.ttf",
                                        30)
            self.play = self.big.render("Play Again", True, (255, 255, 255))
            self.screen.blit(self.play, (400, 550))

        # pygame.draw.rect(self.screen,(0,0,0),(180,240,340,200))
        # self.message = self.buttonFont.render("You Lost!",True,(255,255,255))
        # self.lost = self.buttonFont.render("Sorry",True,(255,255,255))
        # self.screen.blit(self.lost,(280,250))
        # self.screen.blit(self.message,(250,300))

        # self.scoreStr = self.buttonFont.render("Score:",True,(255,255,255))
        # self.scoreNum = self.buttonFont.render(str(self.score),True,(255,255,255))
        # self.screen.blit(self.scoreStr,(240,380))
        # self.screen.blit(self.scoreNum,(420,380))

        # #CITATION: The following if-statement code is from Youtube Channel sentdex
        # if 265>self.mouse[0]>140 and 580>self.mouse[1]>540:
        # 	pygame.draw.rect(self.screen,(153,153,255),(140,540,125,40))
        # 	if self.click[0] == 1:
        # 		Level.Levels().run()
        # else:
        # 	pygame.draw.rect(self.screen,(0,102,204),(140,540,125,40))

        # self.playAgain = self.smallFont.render("Play Again",True,(0,0,0))
        # self.screen.blit(self.playAgain,(150,550))

        # if 505>self.mouse[0]>440 and 580>self.mouse[1]>540:
        # 	pygame.draw.rect(self.screen,(153,153,255),(440,540,65,40))
        # 	if self.click[0] == 1:
        # 		pygame.quit()
        # else:
        # 	pygame.draw.rect(self.screen,(0,102,204),(440,540,65,40))

        # self.quit = self.smallFont.render("Quit",True,(0,0,0))
        # self.screen.blit(self.quit,(450,550))
        Struct.score = 0


#Lost().run()
Exemple #3
0
    def redrawAll(self, screen):
        #congrats, stars, score, buttons
        screen.blit(self.background, [-150, 0])
        self.mouse = pygame.mouse.get_pos()
        self.click = pygame.mouse.get_pressed()

        self.congrat = self.myFont.render("Congratulations!", True,
                                          (255, 204, 102))
        self.screen.blit(self.congrat, (50, 100))

        if self.starNum == 1:
            screen.blit(self.star, [100, 200])
            screen.blit(self.starOutline, [240, 180])
            screen.blit(self.starOutline, [400, 180])
        elif self.starNum == 2:
            screen.blit(self.star, [100, 200])
            screen.blit(self.star, [260, 200])
            screen.blit(self.starOutline, [400, 180])
        else:
            screen.blit(self.star, [100, 200])
            screen.blit(self.star, [260, 200])
            screen.blit(self.star, [420, 200])

        self.scoreStr = self.myFont2.render("Score:", True, (255, 204, 102))
        self.scoreNum = self.myFont2.render(str(self.score), True,
                                            (255, 204, 102))
        self.screen.blit(self.scoreStr, (200, 380))
        self.screen.blit(self.scoreNum, (420, 380))

        if 265 > self.mouse[0] > 140 and 580 > self.mouse[1] > 540:
            #pygame.draw.rect(self.screen,(153,153,255),(90,580,190,60))
            self.big = pygame.font.Font("PG_Roof Runners_active_bold-it.ttf",
                                        40)
            self.quit = self.big.render("Quit", True, (255, 204, 102))
            self.screen.blit(self.quit, (130, 550))
            if self.click[0] == 1:
                pygame.display.quit()
        else:
            #pygame.draw.rect(self.screen,(0,102,204),(90,580,190,60))
            self.big = pygame.font.Font("PG_Roof Runners_active_bold-it.ttf",
                                        30)
            self.quit = self.big.render("Quit", True, (255, 204, 102))
            self.screen.blit(self.quit, (140, 550))

        if 600 > self.mouse[0] > 390 and 580 > self.mouse[1] > 540:
            #pygame.draw.rect(self.screen,(153,153,255),(90,580,190,60))
            self.big = pygame.font.Font("PG_Roof Runners_active_bold-it.ttf",
                                        40)
            self.again = self.big.render("Play Again", True, (255, 204, 102))
            self.screen.blit(self.again, (400, 550))
            if self.click[0] == 1:
                Level.Levels().run()
        else:
            #pygame.draw.rect(self.screen,(0,102,204),(90,580,190,60))
            self.big = pygame.font.Font("PG_Roof Runners_active_bold-it.ttf",
                                        30)
            self.again = self.big.render("Play Again", True, (255, 204, 102))
            self.screen.blit(self.again, (410, 550))

        Struct.score = 0


#Win().run()