项目作者: samme

项目描述 :
Inspect and manipulate Phaser Sprites (via dat.gui). Phaser 2/CE
高级语言: JavaScript
项目地址: git://github.com/samme/phaser-sprite-gui.git
创建时间: 2016-08-31T02:23:06Z
项目社区:https://github.com/samme/phaser-sprite-gui

开源协议:

下载


Screenshot

Inspect and manipulate Phaser Sprites (via dat.gui). Demo

Install

Bower

  1. bower install -S samme/phaser-sprite-gui

NPM

  1. npm install -S phaser-sprite-gui

If dat.gui/index.js doesn’t compile, use dat.gui/build/dat.gui.js instead.

CommonJS / Webpack

It should work. The exported constructor is identical to Phaser.SpriteGUI.

Drop-in install

Add dat.gui.js and index.js before your game scripts.

Use

  1. // In create():
  2. var sprite = game.add.sprite();
  3. // …
  4. var gui = new Phaser.SpriteGUI(sprite);
  5. // In shutdown():
  6. gui.destroy();

Options

Pass GUI params

  1. // Example: 320px wide panel
  2. var gui = new SpriteGUI(sprite, {width: 320});

Filter sprite properties

  1. // Example: Show all properties *except* `body`
  2. var gui = new SpriteGUI(sprite, null, {exclude: ['body']});
  3. // Example: Show *only* `body.velocity.x`, `body.velocity.y`
  4. var gui = new SpriteGUI(sprite, null, {include: ['body', 'velocity', 'x', 'y']});

For nested properties, include must contain every name in the property chain.