Agent

Agent

This is a component class used to add AI behavior to an entity.

Constructor

new Agent()

Source:

Members

behaviours :Array.<Behaviour>

Source:
Type:

maxSpeed :number

Description:
  • The maximum speed of the agent in pixels per second.
Source:
The maximum speed of the agent in pixels per second.
Type:
  • number

maxTurnRate :number

Description:
  • Maximum rotation of the agent in radians per second Not yet implemented.
Source:
Maximum rotation of the agent in radians per second Not yet implemented.
Type:
  • number

Methods

add(behaviour)

Description:
  • Adds a behavior to the agent.
Source:
Parameters:
Name Type Description
behaviour Behaviour

remove(behaviour)

Description:
  • Removes a behavior to the agent.
Source:
Parameters:
Name Type Description
behaviour Behaviour

(static) update(inv_dt, agent, transform, movable)

Description:
  • :
Source:
Parameters:
Name Type Description
inv_dt number Inverse of delta time i.e frameRate.
agent Agent
transform any
movable any

(static) updateBehaviours(inv_dt, behaviours, transform, inv_dt)

Description:
  • Updates the behaviours of the agent and applies changes to agent.
Source:
Parameters:
Name Type Description
inv_dt number
behaviours string | Array.<any>
transform any
inv_dt