samme

Phaser Scene Graph plugin

Recommended Posts

Here's a snippet to quickly look at a running game (run in 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();

 

Share this post


Link to post
Share on other sites

Now with filter and map:

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

 

Share this post


Link to post
Share on other sites

 

On 14/07/2016 at 7:51 PM, samme said:

Prints Phaser’s display tree in the console. Demo / Code

 

Nice, another addition to the available arsenal of Phaser Debugging tools.

I made a little modification to pass a config object to the initialiser and added a new property to the config to determine if the plugin dumps it's initialisation info to the console or not.  Do you want it, either the modified source file or via github PR.

Share this post


Link to post
Share on other sites
9 hours ago, samme said:

Sure, post the modified source.

 

Here it is.  Mostly I didn't want the plugin to affect the console when it initialises, but having it process a config object on initialisation could be useful anyway.

To initialise the plugin without it dumping to the console, you would do:

    game.plugins.add(Phaser.Plugin.SceneGraph, {'quiet':true});

SceneGraph.js

Share this post


Link to post
Share on other sites

There's now a "live" view of one level of the display tree with `game.debug.renderGraph()`. It can help you keep track of object pools (Weapons, Emitters, enemies) and also identify unusual situations (empty/dead groups, dead-but-existing sprites). Try the new demo. :)

invaders.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.