Book Image

Mastering Cocos2d Game Development

By : Alex Ogorek
Book Image

Mastering Cocos2d Game Development

By: Alex Ogorek

Overview of this book

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

Setting up a project and creating basic objects


The Chipmunk physics engine is fairly well integrated within the Cocos2d library. It works within SpriteBuilder as well as programmatically within Cocos2d. As with the rest of this book, we will be focusing on creating the project with code, and only using SpriteBuilder as the tool for project creation. So, create a new project in SpriteBuilder and publish it. If you've forgotten how to do this, feel free to go back and reference the project creation in the first chapter.

Setting up Cocos2d for use with physics

First, we need to lay down the groundwork so that we can begin to code with it, as the published SpriteBuilder project uses the SpriteBuilder files and not the actual coded scenes. Similar to the previous chapter, open AppDelegate.m and add the following line of code to the top of the file:

#import "MainScene.h"

Then, in the startScene method of the AppDelegate.m file, replace that one line of code that already exists with the following...