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

Spritesheets and animation


We've learnt that Cocos2D provides a convenient way to display sprites on the screen using the CCSprite class. However, we must understand that no matter what wrapper classes are provided by the game engine for rendering, they are just hiding all the technical details from us and making our life easier. In the end, it all comes down to interacting with the graphics drivers. In the case of iOS and many other mobile platforms, this means using the OpenGL ES API internally, because this is as close as you can get to the metal.

OpenGL ES is a topic for a separate book, and you don't need to know it to start making games, but there is one aspect that is worth mentioning. When we render sprites using Cocos2D, it is like saying to OpenGL, "hey, we have an image, please draw this whole image in this rectangle area on the screen". Refer to the following screenshot:

Rendering an image to the rectangle area on the screen

Each render of the image takes one call to the OpenGL...