AISystem:update_ai

Updates AI logic. This involves:

  1. Computing new paths if applicable
  2. Setting the heading to follow active paths

If you have unrelated scripts joining on threads managed by these components (such as threads returned by Navigation:navigate_to), they may resume execution during this call.

Usage

ai_system:update_ai(delta_time)

Arguments

Name Type Description
delta_time number Time elapsed since last update.

Examples

local MyScene = Class("MyScene", crystal.Scene);

MyScene.init = function(self)
  local map = crystal.assets.get("assets/map/dungeon.lua");
  self.ecs = crystal.ECS:new();
  self.ai_system = self.ecs:add_system(crystal.AISystem, map);
end

MyScene.update = function(self, delta_time)
  self.ai_system:update_ai(delta_time);
end

This site uses Just the Docs, a documentation theme for Jekyll.