Learn cocos2d 2: Game Development for iOS

Learn cocos2d 2: Game Development for iOS

Steffen Itterheim

Language: English

Pages: 531

ISBN: B00ACC69GK

Format: PDF / Kindle (mobi) / ePub

Learn cocos2d 2: Game Development for iOS

Steffen Itterheim

Language: English

Pages: 531

ISBN: B00ACC69GK

Format: PDF / Kindle (mobi) / ePub


Create compelling 2D games with Learn cocos2d 2: Game Development with iOS. This book shows you how to use the powerful new cocos2d, version 2 game engine to develop games for iPhone and iPad with tilemaps, virtual joypads, Game Center, and more.  It teaches you:

  • The process and best practices of mobile game development, including sprite batching, texture atlases, parallax scrolling, touch and accelerometer input.
  • How to enhance your games using the Box2D and Chipmunk physics engines and other cocos2d-related tools and libraries.
  • How to add UIKit views to cocos2d and how to add cocos2d to UIKit apps.
  • The ins and outs of the Kobold2D development environment for cocos2d and its pre-configured libraries, including cocos3d and Lua.

Best of all, this book will have you making games right from the very start. It guides you step-by-step through the creation of sample games. These fun examples are modeled after popular App Store games and teach you key concepts of the new cocos2d 2 game engine and relevant tools like TexturePacker (texture atlas), PhysicsEditor (physics collision shapes), Particle Designer (particle effects), Glyph Designer (bitmap fonts), and others.

This book offers a rock-solid introduction to creating games made entirely with cocos2d and little or no iOS SDK and OpenGL code. It also details alternative implementations, identifies the best free and commercial tools for cocos2d game development, features coverage of the author’s improved cocos2d game engine (Kobold2D), and even helps you enhance your game’s marketability on the App Store.


What you’ll learn

  • The process and best practices of mobile game development, including sprite batching, texture atlases, parallax scrolling, touch and accelerometer input.
  • How to enhance your games using the Box2D and Chipmunk physics engines and other cocos2d-related tools and libraries.
  • How to add UIKit views to cocos2d and how to add cocos2d to UIKit apps.
  • The ins and outs of the Kobold2D development environment for cocos2d and its pre-configured libraries, including cocos3d and Lua.


Who this book is for

The book is aimed at beginning game developers looking for an easier and even more powerful way to create compelling 2D graphics using OpenGL and Objective-C. It is assumed that the reader will have some knowledge of object-oriented programming and the Apple and iPhone/iPad developer environment.

Computer Animation: Algorithms and Techniques (3rd Edition)

Programming in Objective-C (6th Edition)

Programming iOS 7

Gradle in Action

C++ Quick Syntax Reference

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

It’s Objective, See? Cocos2d is written in Objective-C, Apple’s native programming language for writing iOS apps. It’s the same language used by the iOS SDK, which makes it easy to understand Apple’s documentation and implement iOS SDK functionality. A lot of other useful APIs, such as Facebook Connect and OpenFeint, are also written in Objective-C, which makes it easy to integrate those APIs, too. Note I advise learning Objective-C, even if you prefer some other language. I have a strong C++

development. And because it’s been a big source of confusion, I’ll explain how to enable automatic reference counting (ARC) in a cocos2d project. At the end of this chapter, you’ll have a first cocos2d project based on one of the cocos2d project templates up and running. What You Need to Get Started In this section, I’ll quickly walk you through the requirements and necessary steps to get started. Getting registered as an iOS developer and creating the necessary provisioning profiles are both

place you’ll create a scene is at the end of the app delegate’s applicationDidFinishLaunching method. You use Director to start the first scene with the runWithScene method: // only use this to run the very first scene [[CCDirector sharedDirector] runWithScene:[HelloWorld scene]]; CHAPTER 3: Essentials 63 For all subsequent scene changes, you must replace the existing scene with the aptly named replaceScene method: // use replaceScene to change all subsequent scenes [[CCDirector sharedDirector]

alternative to SoundConverter is the command-line tool afconvert. Familiarity with Terminal is recommended. You can do a lot with afconvert, but being a command-line tool, you’ll also have to type a lot. To get help for afconvert, open the Terminal app and type the following: afconvert -h The preferred audio format for iOS devices is 16-bit, little endian, linear PCM packaged as CAF file (Apple CAF audio format code: LEI16), according to Apple’s Audio Coding How To, which contains generally

should take away three things from this: Encapsulate commonly used code by defining your own methods. Use Objective-C categories to add methods to existing classes. Define resource filenaming conventions to support your code. Working with Texture Atlases Texture atlases help conserve precious memory and speed up the rendering of sprites. Because a texture atlas is nothing but a big texture, you can render all the images it contains using a CCSpriteBatchNode, thus reducing the draw call overhead.

Download sample

Download