PaulHMason Posted January 4, 2018 Share Posted January 4, 2018 I'm busy playing around with creating custom game objects (UI elements) - are there any samples or documentation on how to write and register something like "Image" or "Sprite"? Thanks Link to comment Share on other sites More sharing options...
rich Posted January 15, 2018 Share Posted January 15, 2018 When you say "register" what do you mean exactly? Like have it register with the Factory, so you can do 'this.add.customThing()' in your code? Link to comment Share on other sites More sharing options...
PaulHMason Posted January 16, 2018 Author Share Posted January 16, 2018 5 hours ago, rich said: When you say "register" what do you mean exactly? Like have it register with the Factory, so you can do 'this.add.customThing()' in your code? Yes - it's easy enough to add something to the Phaser source, but I'm a bit unclear about how to do it as an addon. Link to comment Share on other sites More sharing options...
RashaMatt Posted January 24, 2018 Share Posted January 24, 2018 I'm also interested in the answer to this. Neither could I find an overview anywhere about how addons are structured in Phaser CE. Link to comment Share on other sites More sharing options...
YuPi Posted January 26, 2018 Share Posted January 26, 2018 I would like to know that too. It would be nice if I could create my own object and register it with the GameObjectCreator and GameObjectFactory. I have some objects extending e.g. Sprite that offer some extra functionality/display styles. That way I could make my code cleaner by using this.add.something and it would use and process config objects with some extra parameters that I use for configuration. As Paul said it is not a problem if you edit the Phaser source, but I couldn't find a way to register objects with a Factory without changing the Phaser source. GameObjectCreator and GameObjectFactory are now probably "private" and therefore can not be used outside of Phaser source. I hope things are not too crazy in the final week before the release. Good luck! Link to comment Share on other sites More sharing options...
Recommended Posts