Skip to Main Content
Learning iPhone Game Development with Cocos2D 3.0
book

Learning iPhone Game Development with Cocos2D 3.0

by Kirill Muzykov
June 2014
Beginner to intermediate content levelBeginner to intermediate
434 pages
9h 49m
English
Packt Publishing
Content preview from Learning iPhone Game Development with Cocos2D 3.0

Time for action – detecting and ignoring collisions

It is time to detect when the stone hits the hunter. When the stone collides with the hunter, the player will lose.

In addition to this, we're going to detect when the stone hits the ground. In this case, we're going to ignore the collision and let the stone fall through the ground. We need to do this to avoid a lot of stones lying on the ground and hurting the hunter's legs. Just joking, he has shoes, right? The real reason is that the large number of stones on the level will simply block our hunter at some point. Refer to the following steps:

  1. Open the PhysicsHunter.m file and in the createPhysicsBody method, set the body.collisionType property to @"hunter", as shown in the following code:
    -(void)createPhysicsBody ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Swift Games Development for iOS: Develop 2D and 3D games Using Apple's SceneKit and SpriteKit

Beginning Swift Games Development for iOS: Develop 2D and 3D games Using Apple's SceneKit and SpriteKit

James Goodwill, Wesley Matlock

Publisher Resources

ISBN: 9781782160144Supplemental Content