September 2014
Beginner
266 pages
5h 38m
English
The touch function gives us some basic functions; they can be used to create gestures such as TAP, DOUBLE TAP, and SWIPE, which are used in majority of the handheld games these days. Using these functions, we can also create custom gestures depending on the needs of the game.
We can enable touch on a layer by calling the setTouchEnabled() function on the layer and setting it to true so that the layer starts listening to touches; without this, the gestures won't be recognized.
Cocos2d-x comes with the following four functions to create different control schemes:
TouchesBegan(): This function is called whenever a finger touches the screen. Whenever a user touches the screen, a tap is triggered. This is one of the easiest ...Read now
Unlock full access