Jump to content

Get existing tileSprite by its key


adriantxu
 Share

Recommended Posts

I'm new with Phaser, and I dont know if its posible to get a specific tileSprite object by its key.

I got this:

this.add.tileSprite(0, 0, 800, 600, 'background');

is there something like:

var bg = this.get.tileSprite('background');

Thanks a lot.

Link to comment
Share on other sites

On 28/4/2017 at 5:13 PM, RubbleGames said:

Have you tried just storing your tilesprite in a variable as you crate it:

var bg = this.add.tileSprite(0, 0, 800, 600, 'background');

Yeah that worked! Thank you.

But isn't there a native way of doing it? What if I have to access from another state/class? It forces me to create another global variable.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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