phaser-track

1.0.0 • Public • Published

Screenshot

Demo

Use

Start tracking another object

obj.track(target, {
  // Default options:
  offsetX          : 0,
  offsetY          : 0,
  trackRotation    : false,
  rotateOffset     : false,
  disableBodyMoves : true
})
  • obj is a Sprite or Emitter
  • target 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 tracking

An Emitter moves its launch point (emitX, emitY) to follow the target. A Sprite moves its position.

The object stops tracking only if

  • the target is destroyed; or
  • a Pointer target is deactivated; or
  • you call untrack

It doesn't stop tracking if the target is killed.

It will not track while its own exists is false.

Stop tracking

obj.untrack()

Change Log

  • 1.0.0 (2018-02-21) — Changed track arguments
  • 0.1.3 (2017-02-27) — First NPM release

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    0
  • 0.1.3
    0
  • 0.1.2
    0

Package Sidebar

Install

npm i phaser-track

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

8.94 kB

Total Files

4

Last publish

Collaborators

  • samme