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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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