1.1.0 • Published 7 years ago

phaser-plugin-scene-graph v1.1.0

Weekly downloads
41
License
MIT
Repository
github
Last release
7 years ago

Prints the display tree. Demo

Install

If not using npm or bower, add SceneGraph.js after phaser.js.

Use 👾

game.plugins.add(Phaser.Plugin.SceneGraph);

Debug Canvas

Print on the debug canvas

game.debug.renderGraph(obj, x, y, font, lineHeight);

Console

Print to the browser console

game.debug.graph() // everything; or

game.debug.graph(obj) // 1 object & descendants

game.debug.graph(obj, { // options:
    collapse:        true,
    filter:          null, // function (obj) -> true | false
    map:             null, // function (obj) -> "description"
    skipDead:        false,
    skipNonexisting: false
});

Configure (optional)

game.plugins.add(Phaser.Plugin.SceneGraph, {
  css: {
    dead:          "text-decoration: line-through",
    nonexisting:   "color: gray",
    nonrenderable: "background: rgba(127, 127, 127, 0.125)",
    invisible:     "background: rgba(0, 0, 0, 0.25)"
  },
  quiet: false
});

Tips

Name your groups and emitters:

group.name = "invaders"

emitter.name = "stars"

For a quick look at a game in progress, run in the console:

(this.game || Phaser.GAMES[0]).load.script("SceneGraph", "https://samme.github.io/phaser-plugin-scene-graph/SceneGraph.js",
  function (){
    this.game.plugins.add(Phaser.Plugin.SceneGraph).graph();
  }).start();
1.1.0

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago