Jump to content

Accessing Sprite Object indirectly


bondreal
 Share

Recommended Posts

I was looking around at the tutorials and the examples and I did not see anything about how to access via the game object or some other object a collection of the added sprites. I am new to Phaser so I might have missed it. I also searched the forums but I did not see anything. However, if you all know where a thread is or how do to it I would really appreciate a nudge in the right direction. 

Link to comment
Share on other sites

For finding one sprite/object, there is Group#getAt(index), Group#getByName(name), or just Group#children[index].

For iteration there is Group#forEach() and Group#children.

The game world (game.world) is also a Group so it has these methods too. But typically you would organize sprites in groups so you don't have to guess about where they are.

See phaser-ce/Phaser.Group.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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