ig.

UITracker

new UITracker()

Interactive ui element for tracking the closest entity of a type or name in a level.

Author:
  • Collin Hover - collinhover.com
Source:
Example
// to help your players find things in the game world, you might want a tracker
ig.UITrackerDummy = ig.UITracker.extend({
     // set the class of the entity to track
     entityClass: 'EntityDummy',
     // give it a 2% margin so it isn't smooshed against the screen edge
     // ui elements have a default position of top left
     margin: { x: 0.02, y: 0.02 },
     // we add an animation sheet
     animSheet: new ig.AnimationSheet( 'media/icons_trackers.png', 16, 16 ),
     // set the base size of our tracker
     size: { x: 16, y: 16 },
     // and set animations for when idle (not tracking) and tracking
     // these animations will be automatically swapped between
     animSettings: {
         idle: {
             sequence: [ 0 ]
         },
         tracking: {
             sequence: [ 1 ]
         }
     },
     // unfreeze tracker so we can animate it
     frozen: false,
});
// then spawn an instance of the ig.UITrackerDummy when the player is added to the game
// and player can click it to spawn an arrow pointing towards the tracked entity (if it exists)

alwaysToggleActivate

Trackers should only ever activate.

Source:

autoTrackingDelay :String|ig.Class

Delay in seconds between auto tracking. IMPORTANT: be careful when setting this value close to 0 as could affect performance.

Default Value:
  • 2
Source:

autoTrackingTimer :ig.Timer

Timer for auto tracking.
- created on init

Source:

directionThresholdX :Number

Threshold to make horizontal direction zero.

Source:
See:
  • ig.CONFIG.CHARACTER.SIZE_EFFECTIVE_X

directionThresholdY :Number

Threshold to make vertical direction zero.

Source:
See:
  • ig.CONFIG.CHARACTER.SIZE_EFFECTIVE_Y

entityClass :String|ig.Class

Entity class to track.

Source:

entityDirectionClass :String|ig.Class

Entity class to show as directional indicator.

Source:

entityDirectionIndicator :ig.EntityExtended

Entity instance shown as directional indicator on tracked.

Source:

entityName :String|ig.Class

Entity name to track.
- when present overrides ig.UITracker#entityClass

Source:

entityTracking :String|ig.Class

Entity currently being tracked IMPORTANT: do not set this directly, instead use ig.UITracker#track.

Source:

activateComplete()

Source:

initProperties()

Source:

pause()

Source:

track(show, entity)

Tracks entity by name or class.

Parameters:
Name Type Argument Default Description
show Boolean <optional>
true whether to show tracking direction.
entity Entity <optional>
entity to use to sort search by closest.
Source:

unpause()

Source:

untrack()

Stops tracking entity.

Source:

updateVisible()

Updates when visible and does auto tracking.

Source: