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

Chapter 3. Focusing on Physics

This chapter is for those of you who want to incorporate physics into your games. Whether you're building a mini golf game that uses realistic wall bounces or a platformer with endless gravity, this chapter is for you. It will have tutorials on the physics side of games, as well as show you how to use a physics engine without gravity.

In this chapter, we will cover the following topics:

  • How Chipmunk works

  • Setting up a project and creating basic objects

  • Setting gravity by tilting the device

  • Handling collisions in Chipmunk

Note

You must use Chipmunk for collision detection only (and not physics). Not all games need (or should even consider using) a physics engine. Sometimes, it's better to leave it out. However, if you feel your game will either be more polished or be produced faster, then by all means use it. That being said, the project in this book will not need a physics engine. So, instead of following the project here, we will create a small project that has many...