|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
clock=pygame.time.Clock()
while True:
clock.tick(60) # 使用时钟对象的方法,设定停顿时间:1/参数,也即 帧率
for event in pygame.event.get(): # event.get() 获取用户操作返回列表,遍历它
if event.type==pygame.QUIT:
pygame.quit() # unload pygame 模块
sys.exit() # 退出程序
#修改飞机位置:
if hero_rect.y<=-126: #当飞机飞出屏幕,就调整飞机的位置
hero_rect.y=700
hero_rect.y-=1
screen.blit(img_bg, (0, 0)) #重画背景
screen.blit(hero,hero_rect) #重画飞机
pygame.display.update()
点游戏右上角的叉 ,无法退出游戏窗体, 控制台显示有 [<Event(32787-WindowClose {'window': None})>, <Event(256-Quit {})>]
idle 跟 pygame 有冲突的,你直接双击打开的话就不会了
|
|