最顶层的游戏框架设代码_碰彩球游戏

"""
   最顶层的游戏框架设代码,碰彩球游戏
"""
from ball import *
from cover import *

def start_game(screen):
    """
       screen是屏幕对象
       本函数生成游戏中的各个对象,进入游戏循环,
       返回游戏成功或失败的逻辑值
    """
    
def display(screen,image):
    """
       本函数只是显示一个image,
       直到按窗口关闭按钮才会退出Pygame
    """
    image = pygame.image.load(image)
    screen.blit(image,(0,0))    
    while not pygame.event.get(QUIT):pass
    pygame.quit()

def main():

    cover_image = "images/gingerbread.png"
    screen = display_cover(cover_image)

    if screen == None: return
    
    success = start_game(screen)
    if success:
        image = "images/success.png"
    else:
        image = "image/fail.png"

    display(screen,image)    
        
if __name__ == "__main__":

    main()
        

You must log in to read the rest of this article. Please log in or register as a user.