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

Winning, losing, and other states


Shooting birds infinitely will get you bored at some point. You have to be able to win or lose the game to make it interesting. Also, our hunter shoots the arrows too fast. We should fix these issues before we can call our game minimally playable.

A good way to fix all of our issues is by introducing states. It is very common in game development to think about game objects or even the whole game itself as state machines.

To use states, you need to think upfront what states can your object be in and write the code to transition from one state to another. Then, you can check the current state of the object and understand what it can or should do in its current state. It will get clearer when we do this for our game objects.