samme Posted August 31, 2016 Share Posted August 31, 2016 I made a generic Sprite + Arcade Physics controller so you don't have to. Demo / Code // Create var sprite = game.add.sprite(); // … var gui = new SpriteGUI(sprite); // Shutdown gui.destroy(); drhayes, Tanikaze and stupot 3 Link to comment Share on other sites More sharing options...
samme Posted September 3, 2016 Author Share Posted September 3, 2016 Now with methods! Kill and revive your sprites at your whim. Link to comment Share on other sites More sharing options...
stupot Posted September 3, 2016 Share Posted September 3, 2016 Very nice Samme, a few questions: - Can you change the sprite being controlled - You could also display the input properties if available. Link to comment Share on other sites More sharing options...
samme Posted September 3, 2016 Author Share Posted September 3, 2016 Hi @stupot, you can add a separate GUI for each sprite. Maybe I can add a second one in the demo. I'll look at the input properties, I can at least add `input.enabled`. Link to comment Share on other sites More sharing options...
stupot Posted September 4, 2016 Share Posted September 4, 2016 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. Link to comment Share on other sites More sharing options...
samme Posted September 8, 2016 Author Share Posted September 8, 2016 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; }); } }); Link to comment Share on other sites More sharing options...
samme Posted February 20, 2017 Author Share Posted February 20, 2017 Added sprite.animations (paused, really) and sprite.input. Link to comment Share on other sites More sharing options...
samme Posted September 9, 2017 Author Share Posted September 9, 2017 Added tilePosition and tileScale (demo). Should work with CommonJS/webpack now too. TODO: pivot. stupot and nkholski 2 Link to comment Share on other sites More sharing options...
Recommended Posts