Raiper34 Posted August 6, 2015 Share Posted August 6, 2015 Hi, What is difference between this.add.sprite() and game.add.sprite() in State? Thanks. Link to comment Share on other sites More sharing options...
rich Posted August 6, 2015 Share Posted August 6, 2015 Absolutely nothing - both of them are references to the GameObjectFactory. The only real difference is that 'game.add.sprite' uses a global (window level) "game" object in order to add the sprite, where-as "this.add" uses a State level reference to the GameObjectFactory instead. You should nearly always use 'this.add', especially if packaging games up in wrappers or for native. LearningPhaser9, Tilde, VitaZheltyakov and 2 others 5 Link to comment Share on other sites More sharing options...
LearningPhaser9 Posted August 6, 2015 Share Posted August 6, 2015 This is amazing for beginners like me. Link to comment Share on other sites More sharing options...
jaevelgames Posted September 3, 2015 Share Posted September 3, 2015 Hmm.. I'm trying to add some bitmap text to my extended sprite class like this: this.label = game.add.bitmapText(0, 0, 'font', 'some text, 16);I then add 'this.label' as a child to the parent. This works fine, but after reading this I became worried since I'm going to wrap it up later on. Shouldn't I use 'game.add...' in this case? Using 'this' dont seem to work. Link to comment Share on other sites More sharing options...
demisephi Posted September 3, 2015 Share Posted September 3, 2015 offtopic: is there a free tutorial/guide for packaging game for mobile (android) Link to comment Share on other sites More sharing options...
Recommended Posts