Exemplo n.º 1
0
    def drawFrameMenu(self, mouseCoords, button1Fac, button2Fac):
        pygame.mouse.set_visible(False)
        self.screen.fill(self.backCol)
        pygame.draw.rect(
            self.screen, (179, 120, 43),
            pygame.Rect(c.halfDims[0] + 50, 50, c.halfDims[0] - 100,
                        c.windowDims[1] - 100))
        pygame.draw.rect(
            self.screen, (255, 163, 43),
            pygame.Rect(c.halfDims[0] + 50, 50, c.halfDims[0] - 100,
                        (c.windowDims[1] - 100) * button1Fac))
        pygame.draw.rect(self.screen, (179, 43, 43),
                         pygame.Rect(50, 50, 400, 200))
        pygame.draw.rect(self.screen, (237, 14, 14),
                         pygame.Rect(50, 50, 400, 200 * button2Fac))

        font = pygame.font.SysFont(None, 300)
        img = font.render("Play", True, self.backCol)
        self.screen.blit(img, (c.halfDims[0] + 250, c.halfDims[1] - 100))

        font = pygame.font.SysFont(None, 200)
        img = font.render("Exit", True, self.backCol)
        self.screen.blit(img, (100, 90))

        for i in range(len(mouseCoords)):
            co.drawCircle(self.screen,
                          (255, 255, 255, 255 * (i / (len(mouseCoords) - 1))),
                          mouseCoords[i], 50, 5)
        pygame.display.flip()
        pygame.display.update()
Exemplo n.º 2
0
    def drawFrameGameover(self, mouseCoords, button1Fac, button2Fac, update):
        self.screen.fill(self.backCol)
        pygame.draw.rect(
            self.screen, (179, 120, 43),
            pygame.Rect(c.windowDims[0] * 0.55, c.windowDims[1] * 0.05,
                        c.windowDims[0] * 0.4, c.windowDims[1] * 0.4))
        pygame.draw.rect(
            self.screen, (255, 163, 43),
            pygame.Rect(c.windowDims[0] * 0.55, c.windowDims[1] * 0.05,
                        c.windowDims[0] * 0.4,
                        c.windowDims[1] * 0.4 * button1Fac))
        pygame.draw.rect(
            self.screen, (179, 43, 43),
            pygame.Rect(c.windowDims[0] * 0.05, c.windowDims[1] * 0.05,
                        c.windowDims[0] * 0.4, c.windowDims[1] * 0.4))
        pygame.draw.rect(
            self.screen, (237, 14, 14),
            pygame.Rect(c.windowDims[0] * 0.05, c.windowDims[1] * 0.05,
                        c.windowDims[0] * 0.4,
                        c.windowDims[1] * 0.4 * button2Fac))

        font = pygame.font.SysFont(None, int(c.windowDims[0] * 0.15))
        img = font.render("Retry", True, self.backCol)
        center = img.get_rect(center=(c.windowDims[0] * 0.75,
                                      c.windowDims[1] * 0.275))
        self.screen.blit(img, center)

        font = pygame.font.SysFont(None, int(c.windowDims[0] * 0.15))
        img = font.render("Exit", True, self.backCol)
        center = img.get_rect(center=(c.windowDims[0] * 0.25,
                                      c.windowDims[1] * 0.275))
        self.screen.blit(img, center)

        font = pygame.font.SysFont(None, int(c.windowDims[0] * 0.2))
        img = font.render('Game Over', True, (255, 255, 255))
        center = img.get_rect(center=(c.halfDims[0], c.windowDims[1] * 0.7))
        self.screen.blit(img, center)

        for i in range(len(mouseCoords)):
            co.drawCircle(self.screen,
                          (255, 255, 255, 255 * (i / (len(mouseCoords) - 1))),
                          mouseCoords[i], 50, 5)

        if update:
            pygame.display.flip()
            pygame.display.update()
Exemplo n.º 3
0
    def activateGameOver(self):
        for i in range(50):
            self.drawFrameGame(False)
            co.drawRect(self.screen, (self.backCol[0], self.backCol[1],
                                      self.backCol[2], 255 * (i / 49)),
                        pygame.Rect(0, 0, c.windowDims[0], c.windowDims[1]))
            self.ball.drawRed(self.screen)
            pygame.display.flip()
            pygame.display.update()
            t.sleep(0.005)

        for i in range(50):
            self.drawFrameGameover([(0, 0), (0, 0)], 0, 0, False)
            co.drawRect(self.screen, (self.backCol[0], self.backCol[1],
                                      self.backCol[2], 255 * (1 - (i / 49))),
                        pygame.Rect(0, 0, c.windowDims[0], c.windowDims[1]))
            pygame.display.flip()
            pygame.display.update()
            t.sleep(0.005)
Exemplo n.º 4
0
    def drawFillBack(self, screen, c1, c2):
        c1Fac = self.C1.depthAdjustFactor() * c.resScale
        c2Fac = self.C2.depthAdjustFactor() * c.resScale

        col = co(c1).interpColors(c2, self.backVal)

        points = [(self.C1.x * c2Fac + c.halfDims[0],
                   c.windowDims[1] - self.C1.y * c2Fac - c.halfDims[1]),
                  (self.C2.x * c2Fac + c.halfDims[0],
                   c.windowDims[1] - self.C1.y * c2Fac - c.halfDims[1]),
                  (self.C2.x * c2Fac + c.halfDims[0],
                   c.windowDims[1] - self.C2.y * c2Fac - c.halfDims[1]),
                  (self.C1.x * c2Fac + c.halfDims[0],
                   c.windowDims[1] - self.C2.y * c2Fac - c.halfDims[1])]

        co.drawPoly(screen, col, points)
        if (self.backVal > 0):
            self.backVal -= self.fadeAmount
        else:
            self.backVal = 0
Exemplo n.º 5
0
    def drawFrameMenu(self, mouseCoords, button1Fac, button2Fac):
        pygame.mouse.set_visible(False)
        self.screen.fill(self.backCol)
        pygame.draw.rect(
            self.screen, (179, 120, 43),
            pygame.Rect(c.windowDims[0] * 0.6, c.windowDims[1] * 0.1,
                        c.windowDims[0] * 0.37, c.windowDims[1] * 0.8))
        pygame.draw.rect(
            self.screen, (255, 163, 43),
            pygame.Rect(c.windowDims[0] * 0.6, c.windowDims[1] * 0.1,
                        c.windowDims[0] * 0.37,
                        c.windowDims[1] * 0.8 * button1Fac))
        pygame.draw.rect(
            self.screen, (179, 43, 43),
            pygame.Rect(c.windowDims[0] * 0.05, c.windowDims[1] * 0.05,
                        c.windowDims[0] * 0.3, c.windowDims[1] * 0.25))
        pygame.draw.rect(
            self.screen, (237, 14, 14),
            pygame.Rect(c.windowDims[0] * 0.05, c.windowDims[1] * 0.05,
                        c.windowDims[0] * 0.3,
                        c.windowDims[1] * 0.25 * button2Fac))

        font = pygame.font.SysFont(None, int(c.windowDims[0] * 0.2))
        img = font.render("Play", True, self.backCol)
        center = img.get_rect(center=(c.windowDims[0] * 0.78,
                                      c.windowDims[1] * 0.5))
        self.screen.blit(img, center)

        font = pygame.font.SysFont(None, int(c.windowDims[0] * 0.17))
        img = font.render("Exit", True, self.backCol)
        center = img.get_rect(center=(c.windowDims[0] * 0.195,
                                      c.windowDims[1] * 0.175))
        self.screen.blit(img, center)

        for i in range(len(mouseCoords)):
            co.drawCircle(self.screen,
                          (255, 255, 255, 255 * (i / (len(mouseCoords) - 1))),
                          mouseCoords[i], 50, 5)
        pygame.display.flip()
        pygame.display.update()
Exemplo n.º 6
0
    def activateGame(self, menu1):
        if menu1:
            for i in range(5):
                self.screen.fill(self.backCol)
                pygame.draw.rect(
                    self.screen, (207, 154, 85),
                    pygame.Rect(c.halfDims[0] + 50, 50, c.halfDims[0] - 100,
                                c.windowDims[1] - 100))
                pygame.display.flip()
                pygame.display.update()
                t.sleep(0.05)
                pygame.draw.rect(
                    self.screen, (179, 120, 43),
                    pygame.Rect(c.halfDims[0] + 50, 50, c.halfDims[0] - 100,
                                c.windowDims[1] - 100))
                pygame.display.flip()
                pygame.display.update()
                t.sleep(0.05)
        else:
            for i in range(5):
                self.screen.fill(self.backCol)
                pygame.draw.rect(
                    self.screen, (207, 154, 85),
                    pygame.Rect(c.halfDims[0] + 50, 50, c.halfDims[0] - 100,
                                c.halfDims[1] - 100))
                font = pygame.font.SysFont(None, 200)
                img = font.render("Retry", True, self.backCol)
                self.screen.blit(img,
                                 (c.halfDims[0] + 290, c.halfDims[1] - 330))
                pygame.display.flip()
                pygame.display.update()
                t.sleep(0.05)
                pygame.draw.rect(
                    self.screen, (179, 120, 43),
                    pygame.Rect(c.halfDims[0] + 50, 50, c.halfDims[0] - 100,
                                c.halfDims[1] - 100))
                font = pygame.font.SysFont(None, 200)
                img = font.render("Retry", True, self.backCol)
                self.screen.blit(img,
                                 (c.halfDims[0] + 290, c.halfDims[1] - 330))
                pygame.display.flip()
                pygame.display.update()
                t.sleep(0.05)

        for i in range(50):
            self.drawFrameGame(False)
            co.drawRect(self.screen, (self.backCol[0], self.backCol[1],
                                      self.backCol[2], 255 * (1 - (i / 49))),
                        pygame.Rect(0, 0, c.windowDims[0], c.windowDims[1]))
            pygame.display.flip()
            pygame.display.update()
            t.sleep(0.005)

        for i in range(3):
            self.drawFrameGame(False)
            font = pygame.font.SysFont(None, 500)
            img = font.render(str(3 - i), True, (255, 255, 255))
            self.screen.blit(img, (c.halfDims[0] - 100, c.halfDims[1] - 150))
            pygame.display.flip()
            pygame.display.update()
            t.sleep(0.7)
        self.drawFrameGame(False)
        font = pygame.font.SysFont(None, 500)
        img = font.render("GO!", True, (255, 255, 255))
        self.screen.blit(img, (c.halfDims[0] - 330, c.halfDims[1] - 150))
        pygame.display.flip()
        pygame.display.update()
        t.sleep(0.7)
        return True