Class R.components.logic.behaviors.Flee
Extends
R.components.logic.behaviors.BaseBehavior.
The flee behavior component. This is essentially opposite of seeking. Fleeing
needs to be updated dynamically. If the argument to #fleeFrom is an
object, it must be a descendant of R.objects.Object2D.
Defined in: flee.js.
Constructor Attributes | Constructor Name and Description |
---|---|
R.components.logic.behaviors.Flee(target, minDist)
|
- Fields borrowed from class R.components.Base:
- TYPE_COLLIDER, TYPE_INPUT, TYPE_LOGIC, TYPE_RENDERING, TYPE_TRANSFORM
Method Attributes | Method Name and Description |
---|---|
execute(renderContext, time, dt)
This method is called by the game object to run the component,
updating its state.
|
|
fleeFrom(target)
Update the object to flee from.
|
- Methods borrowed from class R.components.logic.behaviors.BaseBehavior:
- getTransformComponent, setTransformComponent
- Methods borrowed from class R.components.Logic:
- getClassName
- Methods borrowed from class R.components.Base:
- getGameObject, getHostObject, getPriority, getType, getTypeString, release, setGameObject, setHostObject, setPriority
- Methods borrowed from class R.engine.BaseObject:
- addEvent, addEvents, destroy, getElement, jQ, removeEvent, setElement, triggerEvent, update
- Methods borrowed from class R.engine.PooledObject:
- clearObjectDataModel, getId, getName, getObjectDataModel, getProperties, isDestroyed, setName, setObjectDataModel, toString, toXML
Class Detail
R.components.logic.behaviors.Flee(target, minDist)
- Parameters:
- target
- The target to flee from or a point to flee from.
- minDist Optional, Default: 350
- The minimum distance at which the vehicle will be triggered to flee.
Method Detail
execute(renderContext, time, dt)
This method is called by the game object to run the component,
updating its state.
- Parameters:
- renderContext
- {R.rendercontexts.AbstractRenderContext} The context the component will render within.
- time
- {Number} The global engine time
- dt
- {Number} The delta between the world time and the last time the world was updated in milliseconds.
fleeFrom(target)
Update the object to flee from.
- Parameters:
- target
- The point or object to flee from