If a layer has 10*6 sprites,how to get the selected the sprite?

If a layer has 10*6 sprites,how to get the selected the sprite ??

Hi,

What do you mean by “get”, you want to detect which sprite should react for a touch event or you want just retrieve the sprite from layer’s children?
In the first case, you can listen the events in layer, and check every sprite’s position in order to know which one should respond
In the last case, you can add the sprite to layer with a tag, and later you can retrieve it with this tag.

Huabin

Hi,

What does “get the selected the sprite” mean?
Does it mean get the selected the sprite by click or touch?

If it is right, please reference /samples/tests/TouchesTest/Paddle.js

Bests
David

i mean get the selected the sprite by touch