项目作者: samme

项目描述 :
Let things follow things
高级语言: CoffeeScript
项目地址: git://github.com/samme/phaser-track.git
创建时间: 2017-02-23T02:55:27Z
项目社区:https://github.com/samme/phaser-track

开源协议:

下载


Screenshot

Demo

Use

Start tracking another object

  1. obj.track(target, {
  2. // Default options:
  3. offsetX : 0,
  4. offsetY : 0,
  5. trackRotation : false,
  6. rotateOffset : false,
  7. disableBodyMoves : true
  8. })
  • 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

  1. obj.untrack()

Change Log

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