"""
    Author:Zhou
    Create_Date:2022年06月30日--23:54
    Tool:PyCharm
    Software: PyCharm
"""
import sys
import pygame
    
class AlieInvasion:
    def __init__(self):
        """初始化游戏并创建游戏"""
        pygame.init()
        # 设置游戏界面大小
        self.screen = pygame.display.set_mode((1200, 800))
        # 窗口名称
        pygame.display.set_caption("Alien Invasion")
    def run_game(self):
        """开始游戏的主循环"""
        while True:
            # 监视键盘和鼠标事件
            for event in pygame.event.get():
                # 如果鼠标事件是点击关闭窗口,则关闭窗口
                if event.type == pygame.QUIT:
                    sys.exit()
            # 让最近绘制的屏幕可见
            pygame.display.flip()
if __name__ == '__main__':
    # 创建游戏实例并运行游戏
    ai = AlieInvasion()
    ai.run_game()