本文整理汇总了Python中world.World.hunter方法的典型用法代码示例。如果您正苦于以下问题:Python World.hunter方法的具体用法?Python World.hunter怎么用?Python World.hunter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类world.World
的用法示例。
在下文中一共展示了World.hunter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: glEnable
# 需要导入模块: from world import World [as 别名]
# 或者: from world.World import hunter [as 别名]
# create a pyglet window and set glOptions
win = window.Window(width=500, height=500, vsync=True, resizable=True)
glEnable(GL_BLEND)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
# needed so that egi knows where to draw
egi.InitWithPyglet(win)
# prep the fps display
fps_display = clock.ClockDisplay()
# register key and mouse event handlers
win.push_handlers(on_key_press)
win.push_handlers(on_resize)
# create a world for agents
world = World(500, 500)
# add one agent
world.hunter = Hunter(world)
world.prey = Prey(world)
# unpause the world ready for movement
world.paused = False
while not win.has_exit:
win.dispatch_events()
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
# show nice FPS bottom right (default)
delta = clock.tick()
world.update(delta)
world.render()
fps_display.draw()
# swap the double buffer
win.flip()
示例2: glEnable
# 需要导入模块: from world import World [as 别名]
# 或者: from world.World import hunter [as 别名]
glEnable(GL_BLEND)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
# needed so that egi knows where to draw
egi.InitWithPyglet(win)
# prep the fps display
fps_display = clock.ClockDisplay()
# register key and mouse event handlers
win.push_handlers(on_key_press)
win.push_handlers(on_mouse_press)
win.push_handlers(on_resize)
# create a world for agents
world = World(500, 500)
# add one agent
for i in range(0, 50):
world.agents.append(Agent(world))
world.hunter = world.agents[0]
# unpause the world ready for movement
world.paused = False
while not win.has_exit:
win.dispatch_events()
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
# show nice FPS bottom right (default)
delta = clock.tick()
world.update(delta)
world.render()
fps_display.draw()
# swap the double buffer
win.flip()
示例3: World
# 需要导入模块: from world import World [as 别名]
# 或者: from world.World import hunter [as 别名]
egi.InitWithPyglet(win)
# prep the fps display
fps_display = clock.ClockDisplay()
# register key and mouse event handlers
win.push_handlers(on_key_press)
win.push_handlers(on_resize)
# create a world for agents
world = World(1200, 800)
# add one agent
hunter = Hunter(world)
hunter.add_waypoint(400, 600)
hunter.add_waypoint(800, 800)
hunter.add_waypoint(250, 300)
world.hunter = hunter
for i in range(0,10):
world.preyList.append(Prey(world))
# unpause the world ready for movement
world.paused = False
while not win.has_exit:
win.dispatch_events()
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
# show nice FPS bottom right (default)
delta = clock.tick()
world.update(delta)
world.render()
fps_display.draw()
# swap the double buffer
win.flip()