Book Image

Learning iPhone Game Development with Cocos2D 3.0

By : Kirill Muzykov
Book Image

Learning iPhone Game Development with Cocos2D 3.0

By: Kirill Muzykov

Overview of this book

Table of Contents (19 chapters)
Learning iPhone Game Development with Cocos2D 3.0
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – handling touches


Let's add the code that will allow us to handle touches:

Note

In this and the subsequent chapters, we're going to build on top of the Cocohunt project we started in the previous chapter. If you've completed the code of the previous chapter, simply continue from the point where you left.

If you skipped some part of the book or don't have the code for some reason, you can take the final project of the previous chapter from the book supporting files. For this chapter, you can take the code from the Chapter_04/Cocohunt_04_Final folder.

You can download the book's supporting files at http://www.packtpub.com/support and follow the instructions.

Perform the following steps:

  1. Open the Xcode project at the point where we left it at the end of the previous chapter. After opening the project, open the GameScene.m file and add the following methods below the update: method:

    -(void)touchBegan:(UITouch *)touch withEvent:(UIEvent *)event
    {
        CCLOG(@"finger down at : (%f, %f...