本文整理汇总了Python中gamestate.GameState.read方法的典型用法代码示例。如果您正苦于以下问题:Python GameState.read方法的具体用法?Python GameState.read怎么用?Python GameState.read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gamestate.GameState
的用法示例。
在下文中一共展示了GameState.read方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Response
# 需要导入模块: from gamestate import GameState [as 别名]
# 或者: from gamestate.GameState import read [as 别名]
#surface = pygame.display.set_mode([1000, 1000])
r = Response()
state = GameState()
(width, height) = (100, 100)
screen = pygame.display.set_mode((width, height))
pygame.display.set_caption('Manual Control')
running = True
count = 0;
rotate_left = False
rotate_right = False
while running:
state.read() # just to consume stdin/wait for turn
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type == pygame.KEYDOWN or event.type == pygame.KEYUP:
if event.key == pygame.K_ESCAPE:
running = False
elif event.key == pygame.K_LEFT:
rotate_left = (event.type == pygame.KEYDOWN)
elif event.key == pygame.K_RIGHT:
rotate_right = (event.type == pygame.KEYDOWN)
elif event.key == pygame.K_UP:
r.set_thrust(event.type == pygame.KEYDOWN)
elif event.key == pygame.K_SPACE:
r.set_fire(event.type == pygame.KEYDOWN)
if(rotate_left):