Handling touches on layers with Cocos2d is pretty straightforward. As a matter of fact, it works just as it does in regular Cocoa applications. So if you have already worked on other applications, handling touches on iPhone won't be anything new.
We have already seen how to handle touches back in Chapter 2, but remember there were two ways of doing that. Either by giving your CCNodes
the ability to capture touches on themselves or by having the whole layer process them.
Here we are going to explore the second method. What we are going to do is make the GameLayer
touchable, so it can receive and process touches on it.
There are four possible methods to handle the touches over a CCLayer. They are as follows: