Book Image

Cocos2d Game Development Blueprints

By : Jorge Jordán
Book Image

Cocos2d Game Development Blueprints

By: Jorge Jordán

Overview of this book

Table of Contents (15 chapters)
Cocos2d Game Development Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Introducing Chipmunk


Chipmunk (http://chipmunk-physics.net) is an easy-to-use physics engine and has been fully integrated in Cocos2d-Swift since version 3.0 of the framework. Now, including physics in Cocos2d games is as easy as creating instances of the CCPhysics* family of classes. In addition, the Objective-C wrapper for Chipmunk physics, Objective-Chipmunk, is now free so there is no need to write C or C++ code anymore.

The CCNode class now has a physicsBody property that allows us to add gravity behavior, manage collisions, and combine nodes with joints easily, and in case you need more powerful physics, we can take advantage of the Objective-Chipmunk library.

In this last release of Chipmunk, a debug rendering has been included that draws a debug overlay and collision shapes, as well as new collision detection modes that we will see in detail throughout the chapter.

Now we'll describe the main classes that take part in game physics and take a look at their properties.

CCPhysicsNode

CCPhysicsNode...