美文网首页
01.16 作业

01.16 作业

作者: xxxQinli | 来源:发表于2019-01-16 19:51 被阅读0次
    """__author__ = 'Qinli'"""
    
    import pygame
    
    def base_Game():
    
        pygame.init()
        pygame.display.set_caption('2048')
        window = pygame.display.set_mode((400, 600))
        window.fill((255,255,255))
    
        pygame.draw.rect(window, (178, 166, 41), (39,31,122,122), 0) # 2048
        pygame.draw.rect(window, (198, 194, 193), (182,32,79,60), 0) # score
        pygame.draw.rect(window, (198, 194, 193), (283,32,79,60), 0) # max score
        pygame.draw.rect(window, (250, 163, 47), (182,113,79,32), 0) # quit
        pygame.draw.rect(window, (250, 163, 47), (283,113,79,32), 0) # new game
        pygame.draw.rect(window, (206, 197, 200), (56,244,290,290), 0) # backrect
    
    
        pygame.draw.rect(window, (245, 215, 61), (68,254,59,60), 0) # rect1_1
        pygame.draw.rect(window, (216, 216, 216), (136,254,59,60), 0) # rect1_2
        pygame.draw.rect(window, (216, 216, 216), (205,254,59,60), 0) # rect1_3
        pygame.draw.rect(window, (216, 216, 216), (273,254,59,60), 0) # rect1_4
        pygame.draw.rect(window, (216, 216, 216), (68,323,59,60), 0) # rect2_1
        pygame.draw.rect(window, (216, 216, 216), (136,323,59,60), 0) # rect2_2
        pygame.draw.rect(window, (216, 216, 216), (205,323,59,60), 0) # rect2_3
        pygame.draw.rect(window, (216, 216, 216), (273,323,59,60), 0) # rect2_4
        pygame.draw.rect(window, (216, 216, 216), (68,393,59,60), 0) # rect3_1
        pygame.draw.rect(window, (216, 216, 216), (136,393,59,60), 0) # rect3_2
        pygame.draw.rect(window, (216, 216, 216), (205,393,59,60), 0) # rect3_3
        pygame.draw.rect(window, (216, 216, 216), (273,393,59,60), 0) # rect3_4
        pygame.draw.rect(window, (216, 216, 216), (68,462,59,60), 0) # rect4_1
        pygame.draw.rect(window, (216, 216, 216), (136,462,59,60), 0) # rect4_2
        pygame.draw.rect(window, (216, 216, 216), (205,462,59,60), 0) # rect4_3
        pygame.draw.rect(window, (216, 216, 216), (273,462,59,60), 0) # rect4_4
    
        font_2048 = pygame.font.SysFont('PingFang SC', 50)
        text_2048 = font_2048.render('2048', True, (255,255,255))
        window.blit(text_2048, (60, 70))
        
        font_getscore = pygame.font.SysFont('PingFang SC', 23)
        text_getscore = font_getscore.render('Score', True, (255,255,255))
        window.blit(text_getscore, (201, 40))
    
        font_getmax = pygame.font.SysFont('PingFang SC', 23)
        text_getmax = font_getmax.render('Max', True, (255,255,255))
        window.blit(text_getmax, (306, 40))
    
        font_score = pygame.font.SysFont('PingFang SC', 35)
        text_score = font_score.render('190', True, (255,255,255))
        window.blit(text_score, (196, 60))
    
        font_max = pygame.font.SysFont('PingFang SC', 35)
        text_max = font_max.render('230', True, (255,255,255))
        window.blit(text_max, (301, 60))
    
        font_exit = pygame.font.SysFont('PingFang SC', 20)
        text_exit = font_exit.render('EXIT', True, (255,255,255))
        window.blit(text_exit, (205, 123))
    
        font_newgame = pygame.font.SysFont('PingFang SC', 20)
        text_newgame = font_newgame.render('NEW GAME', True, (255,255,255))
        window.blit(text_newgame, (286, 123))
    
        font_title = pygame.font.SysFont('PingFang SC', 23)
        text_title = font_title.render('Combine these blocks to get 2048', True, (180,183,128))
        window.blit(text_title, (78, 214))
    
        font_1_1 = pygame.font.SysFont('PingFang SC', 50)
        text_1_1 = font_1_1.render('2', True, (255,255,255))
        window.blit(text_1_1, (89, 262))
    
        font_1_2 = pygame.font.SysFont('PingFang SC', 50)
        text_1_2 = font_1_2.render('2', True, (255,255,255))
        window.blit(text_1_2, (156, 262))
    
        font_1_3 = pygame.font.SysFont('PingFang SC', 50)
        text_1_3 = font_1_3.render('2', True, (255,255,255))
        window.blit(text_1_3, (223, 262))
    
        font_1_4 = pygame.font.SysFont('PingFang SC', 50)
        text_1_4 = font_1_4.render('2', True, (255,255,255))
        window.blit(text_1_4, (289, 262))
    
        font_2_1 = pygame.font.SysFont('PingFang SC', 50)
        text_2_1 = font_2_1.render('2', True, (255,255,255))
        window.blit(text_2_1, (89, 339))
    
        font_2_2 = pygame.font.SysFont('PingFang SC', 50)
        text_2_2 = font_2_2.render('2', True, (255,255,255))
        window.blit(text_2_2, (156, 339))
    
        font_2_3 = pygame.font.SysFont('PingFang SC', 50)
        text_2_3 = font_2_3.render('2', True, (255,255,255))
        window.blit(text_2_3, (223, 339))
    
        font_2_4 = pygame.font.SysFont('PingFang SC', 50)
        text_2_4 = font_2_4.render('2', True, (255,255,255))
        window.blit(text_2_4, (289, 339))
    
        font_3_1 = pygame.font.SysFont('PingFang SC', 50)
        text_3_1 = font_3_1.render('2', True, (255,255,255))
        window.blit(text_3_1, (89, 410))
    
        font_3_2 = pygame.font.SysFont('PingFang SC', 50)
        text_3_2 = font_3_2.render('2', True, (255,255,255))
        window.blit(text_3_2, (156, 410))
    
        font_3_3 = pygame.font.SysFont('PingFang SC', 50)
        text_3_3 = font_3_3.render('2', True, (255,255,255))
        window.blit(text_3_3, (223, 410))
    
        font_3_4 = pygame.font.SysFont('PingFang SC', 50)
        text_3_4 = font_3_4.render('2', True, (255,255,255))
        window.blit(text_3_4, (289, 410))
    
        font_4_1 = pygame.font.SysFont('PingFang SC', 50)
        text_4_1 = font_4_1.render('2', True, (255,255,255))
        window.blit(text_4_1, (89, 479))
    
        font_4_2 = pygame.font.SysFont('PingFang SC', 50)
        text_4_2 = font_4_2.render('2', True, (255,255,255))
        window.blit(text_4_2, (156, 479))
    
        font_4_3 = pygame.font.SysFont('PingFang SC', 50)
        text_4_3 = font_4_3.render('2', True, (255,255,255))
        window.blit(text_4_3, (223, 479))
    
        font_4_4 = pygame.font.SysFont('PingFang SC', 50)
        text_4_4 = font_4_4.render('2', True, (255,255,255))
        window.blit(text_4_4, (289, 479))
    
    
    
        
        while True:
            for event in pygame.event.get():
                if event.type == pygame.QUIT:
                    return
            
            pygame.display.flip()
            pygame.display.update()
    
    
    def main():
        base_Game()
    
    
    
    if __name__ == '__main__':
        main()
    
    

    相关文章

      网友评论

          本文标题:01.16 作业

          本文链接:https://www.haomeiwen.com/subject/kdlvdqtx.html