samme

Phaser Sprite GUI (with dat.gui)

Recommended Posts

Hi Samme, I was thinking your spriteGUI would be useful if there was a method of changing the sprite whose properties were being displayed, maybe explicitly bing told which sprite to change to or even offering this ability itself, eg by passing in an array of sprites.

From my previous dealings with dat.gui I'm pretty sure it gets tricky trying to remove/reuse components, but I've a helper function somewhere that might be useful if you wanted to try this.

Share this post


Link to post
Share on other sites

Hi stupot, that would be neat but I'm not ready to dig into the dat.gui parts just yet. You might add sprites like this (not tested):

game.world.onChildInputDown.add(function(sprite) {
  if (!sprite.data.gui) {
    sprite.data.gui = new SpriteGUI(sprite);
    sprite.onDestroy.add(function() {
      sprite.data.gui.destroy();
      sprite.data.gui = null;
    });
  }
});

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.