AdamRyanGameDev

Do sprite name identifiers have need to be unique...?

Recommended Posts

Just finding my feet directly in Phaser3 (no Phaser2 exp) [and indeed this forum! Hello there!]

The sprites created with 

this.load.image('sky', 'assets/skies/space3.png');

does the name need to be unique to 'game' or to the 'scene' or not at all? (which i imagine causes problems or is there also a 'spriteID' system too?)

Share this post


Link to post
Share on other sites

What you're doing there is loading an image into the Texture Manager, so yes the key given there needs to be unique across the whole game.

To create a sprite you use:

// this.add.sprite(x, y, key) =

this.add.sprite(300, 200, 'sky');

 

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.