In my cocos2d app I am trying to make images fall from the top of the screen and detect when they are pressed. I am having a hard time. Can anyone help me achieve this? Thanks.
Once you have implemented some touch delegate you can easely tell if you touched your sprite or not using bounding boxes, doing something like:
I am going to do a language and platform independent approach here.
All images should be represented as rectangles. Rectangles are usually just 4 elements long arrays that look like this:
A click can be represented by two numbers, just the
Now, your problem is essentially checking whether the click happened inside the image. How do you do that?
Well, like this:
If you don't understand the code, tell me what is bothering you in a comment and I will explain further.