bali33 Posted January 9, 2015 Share Posted January 9, 2015 Hello, I'm new to phaser and I'm a bit lost with the API. For what I can see so far there is multiples way to create a Sprite or an Image : game.make.sprite(0, 0, 'mummy');game.add.sprite(0,0,'mummy');game.create(0,0,'mummy'); Is that right ? What are the differences between them ? Thank you. Link to comment Share on other sites More sharing options...
rich Posted January 9, 2015 Share Posted January 9, 2015 The first one will create the sprite but NOT add it to the world / display list, leaving it up to you to do. The second one will create the sprite and add it to the game world (so it renders immediately) The third one will crash I think you meant game.world.create() - in which case that is the same as calling Group.create (because World is a Group). Link to comment Share on other sites More sharing options...
bali33 Posted January 9, 2015 Author Share Posted January 9, 2015 Hi, Thank you for your answer. So if I understand correctly Group.create is the same as Group.add.sprite ? Link to comment Share on other sites More sharing options...
rich Posted January 9, 2015 Share Posted January 9, 2015 Group.add will add an existing sprite to the Group. That is a sprite object you have already created. Group.create will create the actual sprite object for you, add it to the Group and then return it Link to comment Share on other sites More sharing options...
PapaPuck Posted November 3, 2016 Share Posted November 3, 2016 How do you add a sprite to the world / display list after using the make command to initialize it? Link to comment Share on other sites More sharing options...
rich Posted November 3, 2016 Share Posted November 3, 2016 From within a State: this.world.add(sprite); Link to comment Share on other sites More sharing options...
Recommended Posts