用python+pygame实现的飞机大战的源码,包含资源,可直接运行。通过鼠标控制。 while True: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() exit() # 绘画背景 screen.blit(background,(0, 0)) # 检测游戏状态 if not gameover: # 定位鼠标的x, y坐标 x, y = pygame.mouse.get_pos() #
本文实例讲述了Python中pygame的mouse鼠标事件用法。分享给大家供大家参考,具体如下:
pygame.mouse提供了一些方法获取鼠标设备当前的状态
'''
pygame.mouse.get_pressed - get the state of the mouse buttons get the state of the mouse buttons
pygame.mouse.get_pos - get the mouse cursor position get the mous