1.追逐、闪躲与拦截资料.pptVIP

  • 27
  • 0
  • 约3.84千字
  • 约 24页
  • 2016-06-29 发布于湖北
  • 举报
人工智能 游戏系 追逐、闪躲与拦截 追踪是游戏中最常用的也是最基本的人工智能算法。 追踪可以直接根据被追踪者的坐标来修改追踪者的坐标,使两者之间的距离逐渐缩短。 也可以使用向量追踪的方法使追踪看起来更真实。 追踪和闪躲是算法基本是一样的(闪躲是将两者之间的距离增加)。 基本追逐 假设被追踪者的坐标是preyX和preyY,追踪者的坐标是predatorX和predatorY,基本追踪算法如下。 if (predatorX preyX) predatorX --; else if (predatorX preyX) predatorX ++; if (predatorY preyY) predatorY --; else if (predatorY preyY) predatorY ++; prey [ prei ] 猎物 predator [ ’pred?t? ] 捕食者 基本闪躲 颠倒一下判断逻辑,就可以实现闪躲效果 if (preyX predatorX) preyX++; else if (preyX predatorX) preyX--; if (preyY predatorY) preyY++; else if (preyY predatorY) prey

文档评论(0)

1亿VIP精品文档

相关文档