Jump to content

find sprite by key


alflashy
 Share

Recommended Posts

Hi 

I have loaded sprite in loop and hidden all of them. I want to show them one by one on click actions
How can i get each sprite by key id and show one at time

for (var i = 1; i < 4; i++){
var personSelection = this.add.sprite(game.world.centerX, game.world.centerY, 'bw'+i);
personSelection.anchor.set(0.5)
personSelection.inputEnabled = true;
personSelection.input.useHandCursor = true;
personSelection.events.onInputDown.add(this.startScene, this);
personSelection.visible = false;
console.log(personSelection)
}
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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