当前位置: 首页>>代码示例>>Python>>正文


Python World.hunter方法代码示例

本文整理汇总了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()
开发者ID:Dan-Newman,项目名称:AI4Games,代码行数:32,代码来源:main.py

示例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()
开发者ID:Dan-Newman,项目名称:AI4Games,代码行数:32,代码来源:main.py

示例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()
开发者ID:Dan-Newman,项目名称:AI4Games,代码行数:33,代码来源:main.py


注:本文中的world.World.hunter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。