本文整理汇总了Python中arena.Arena.focus_on_next_ship方法的典型用法代码示例。如果您正苦于以下问题:Python Arena.focus_on_next_ship方法的具体用法?Python Arena.focus_on_next_ship怎么用?Python Arena.focus_on_next_ship使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arena.Arena
的用法示例。
在下文中一共展示了Arena.focus_on_next_ship方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main_loop
# 需要导入模块: from arena import Arena [as 别名]
# 或者: from arena.Arena import focus_on_next_ship [as 别名]
def main_loop():
screen = get_screen(SCREEN_WIDTH, SCREEN_HEIGHT)
arena = Arena(screen)
arena.make(Ship, position=(5,5))
arena.make(Ship, position=(2,2))
arena.make(Ship, position=(2,8))
arena.make(Ship, position=(8,2))
arena.make(Ship, position=(8,8))
arena.make(Bullet)
space = Spacilizer(arena.view)
playing = True
isPaused = True
currentTime = get_ticks()
while playing:
previousTime = currentTime
currentTime = get_ticks()
deltaTime = currentTime - previousTime
for event in events.get():
if event.type == QUIT:
playing = False
elif event.type is KEYDOWN:
if event.key is pygame.K_SPACE:
isPaused = not isPaused
elif event.key is pygame.K_RETURN:
arena.focus_on_next_ship()
arena.update(deltaTime)
start_frame(screen)
space.draw()
for entity in arena.entities:
entity.draw()
finish_frame(screen)
elapsedTime = get_ticks() - currentTime
if elapsedTime < IDEAL_FRAME_TIME:
wait(IDEAL_FRAME_TIME - elapsedTime)