Let things follow things
obj.track(target, {
// Default options:
offsetX : 0,
offsetY : 0,
trackRotation : false,
rotateOffset : false,
disableBodyMoves : true
})
obj
is a Sprite or Emittertarget
is a Display Object, a Pointer, or any object with x
and y
trackRotation
: match the object’s rotation
to the target’s rotation
rotateOffset
: rotate the offset around the target by the target’s rotation
disableBodyMoves
: suspend the object’s physics movement while trackingAn Emitter moves its launch point (emitX, emitY) to follow the target. A Sprite moves its position.
The object stops tracking only if
untrack
It doesn’t stop tracking if the target is killed.
It will not track while its own exists
is false.
obj.untrack()
track
arguments