Method: hasBehaviour

Checks if the object has the specified behaviour already added to it.
hasBehaviour (String id, Boolean duringTick)
  • Stringid
  • BooleanduringTick If true will look to remove the behaviour from the tick method rather than the update method.
Returns * Returns this on success or false on failure.

Check for a behaviour with the id "myBehaviour"

var entity = new IgeEntity();
entity.addBehaviour('myBehaviour', function () {
    // Code here will execute during each engine update for
    // this entity. I can access the entity via the "this"
    // keyword such as:
    this._somePropertyOfTheEntity = 'moo';

// Now check for the "myBehaviour" behaviour
console.log(entity.hasBehaviour('myBehaviour')); // Will log "true"
© Copyright 2013 Irrelon Software Limited. All Rights Reserved. UK Registered Company Number: 07522767
Isogenic (ī´sōjen´ik): Adj originating from a common source; possessing the same genetic composition.
Strange Things Happen at the One Two Point