Jump to content

How do I use the group.createMultiple with sprites from an atlas sprite sheet in phaser?


jemiloii
 Share

Recommended Posts

So I am preloading an atlasXML spritesheet

game.load.atlasXML('sheet', 'images/sheet.png', 'images/sheet.xml');

and I can create a sprite using:

game.add.sprite(game.world.centerX, game.world.centerY, 'sheet', 'playerShip1_orange.png');

I am trying not to use a for loop to create many sprites for a a sprite group I'm creating by using Group.createMultiple

Now if I'm just loading a sprite or image, I can do

this.meteorGrey = game.add.group();
this.meteorGrey.createMultiple(25, 'meteorGreyBig1.png');

Now when it's in a atlas sprite, this is where I'm running into trouble.

this.meteorGrey = game.add.group();
this.meteorGrey.createMultiple(25, 'sheet', 'meteorGreyBig1.png');

It ends up displaying nothing :(

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...