How can i distinguish between touch?

i have three sprites named sprite1.png,sprite2.png,sprite3.png of same size (200*200)
and drawed one after another on same position.sprite3.png is on top of screen or visible.when i touch only the sprite3.png but it detect all three sprites are touched.how can i restrict sprite1 and sprite2 ???/

You need to show us code. As of v3.x, Sprites can have touch events of their own (well Node actually).

We have a Programmers Guide and here is what you need to look at.

You need an event listener then you have to set swallow touches to true. It’s detailed on the guide that Jason linked for you.
listener1->setSwallowTouches(true);

1 Like