Beispiel #1
0
    def drawPaused(self,surface):
        pygame.mouse.set_visible(True)
        rect = pygame.Surface((self.width,self.height), pygame.SRCALPHA, 32)
        rect.fill((0, 0, 0, 200))
        surface.blit(rect, (0,0))

        rect = pygame.Surface((self.width/3,self.height/3+200), pygame.SRCALPHA, 32)
        rect.fill((0, 0, 0, 200))
        surface.blit(rect, (self.width/2-200,150))
        label = self.font.render(("Paused"), 1, (255, 255, 0))
        surface.blit(label, (self.width/2-100,self.height/3))

        rect = pygame.Surface((120,60), pygame.SRCALPHA, 32)



        if self.hover(self.width/2-105,300,100,50):
            rect.fill((55, 55, 55, 200))
        else:
            rect.fill((255, 255, 255, 200))
        if self.button(self.width/2-105,300,100,50):
            rect.fill((0, 0, 0, 200))
            CON.reset()
            dynamicConfig.whatGame = 0
            dynamicConfig.paused = False
            CON.runGame()


        surface.blit(rect, (self.width/2-105,300))

        label = self.font.render(("Restart"), 1, (0, 0, 0))
        surface.blit(label, (self.width/2-100,self.height/2))

        rect = pygame.Surface((120,50), pygame.SRCALPHA, 32)
        if self.hover(self.width/2-105,400,100,50):
            rect.fill((55, 55, 55, 200))
        else:
            rect.fill((255, 255, 255, 200))
        if self.button(self.width/2-105,400,100,50):
            rect.fill((0, 0, 0, 200))
            dynamicConfig.paused = False

        surface.blit(rect, (self.width/2-105,400))

        label = self.font.render(("Resume"), 1, (0, 0, 0))
        surface.blit(label, (self.width/2-100,self.height/2+100))
        return
Beispiel #2
0
    def draw(self,surface):
        rect = pygame.Rect(0,0,self.width,self.height)
        surface.fill((55,55,55),rect )
        label = self.font.render("Games Completed: "+str(dynamicConfig.completedGames), 1, (255, 255, 0))
        surface.blit(label, (self.width/2-200,self.height/3))
        label = self.font.render("Score: "+str(dynamicConfig.score), 1, (255, 255, 0))
        surface.blit(label, (self.width/2-100,self.height/2))

        rect= pygame.Rect(self.width/2-50,self.height/2+100,80,60)
        x,y,w,h = rect
        if self.hover(x,y,w,h)==True:
            surface.fill((100,100,100),rect )
        else:
            surface.fill((155,155,155),rect )
        if self.button(x, y, w, h):
            dynamicConfig.whatGame = dynamicConfig.randGame()
            CON.reset()
            CON.runGame()

        return