Learn cocos2d 2: Game Development for iOS

Book description

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.

    Table of contents

    1. Title Page
    2. Dedication
    3. Contents at a Glance
    4. Contents
    5. About the Authors
    6. About the Technical Reviewers
    7. Acknowledgments
    8. Preface
    9. Chapter 1: Introduction
      1. What’s New in the Third Edition?
      2. Why Use cocos2d for iOS?
      3. Why Use Kobold2D over cocos2d-iphone?
      4. Other cocos2d Game Engines
      5. This Book Is for You
      6. Prerequisites
      7. What You Will Learn
      8. What’s in This Book
      9. Questions and Feedback
    10. Chapter 2: Getting Started
      1. What You Need to Get Started
      2. The Anatomy of cocos2d and Kobold2D Applications
      3. Memory Management with ARC
      4. Changing the World
      5. What Else You Should Know
      6. Summary
    11. Chapter 3: Essentials
      1. The cocos2d Scene Graph
      2. The CCNode Class Hierarchy
      3. CCNode
      4. Director, Scenes, and Layers
      5. CCSprite
      6. CCLabelTTF
      7. Menus
      8. Actions
      9. Orientation, Singletons, Tests, and API References
      10. Summary
    12. Chapter 4: Your First Game
      1. Create the DoodleDrop Project
      2. Start with an ARC-enabled cocos2d Project
      3. Create the DoodleDrop Scene
      4. Adding the Player Sprite
      5. Simple Accelerometer Input
      6. First Test Run
      7. Player Velocity
      8. Adding Obstacles
      9. Collision Detection
      10. Labels and Bitmap Fonts
      11. Simply Playing Audio
      12. iPad Considerations
      13. Summary
    13. Chapter 5: Game Building Blocks
      1. Working with Multiple Scenes
      2. Working with Multiple Layers
      3. Subclassing Game Objects from CCSprite
      4. Composing Game Objects Using CCSprite
      5. Curiously Cool CCNode Classes
      6. Summary
    14. Chapter 6: Sprites In-Depth
      1. Retina Display
      2. CCSpriteBatchNode
      3. Sprite Animations the Hard Way
      4. Animation Helper Category
      5. Working with Texture Atlases
      6. Summary
    15. Chapter 7: Scrolling with Joy
      1. Advanced Parallax Scrolling
      2. A Virtual Joypad
      3. Summary
    16. Chapter 8: Shoot ’em Up
      1. Let’s Make Some Enemies
      2. The Component Classes
      3. Shooting Things
      4. A Healthbar for the Boss
      5. Summary
    17. Chapter 9: Particle Effects
      1. Example Particle Effects
      2. Creating a Particle Effect the Hard Way
      3. Particle Designer
      4. Shoot ’em Up with Particle Effects
      5. Summary
    18. Chapter 10: Working with Tilemaps
      1. What Is a Tilemap?
      2. Preparing Images with TexturePacker
      3. Tiled (Qt) Map Editor
      4. Using Orthogonal Tilemaps with Cocos2d
      5. Summary
    19. Chapter 11: Isometric Tilemaps
      1. Designing Isometric Tile Graphics
      2. Isometric Tilemap Editing with Tiled
      3. Isometric Game Programming
      4. Adding More Content to the Game
      5. Summary
    20. Chapter 12: Physics Engines
      1. Basic Concepts of Physics Engines
      2. Limitations of Physics Engines
      3. The Showdown: Box2D vs. Chipmunk
      4. Box2D
      5. Chipmunk
      6. Summary
    21. Chapter 13: Pinball Game
      1. Shapes: Convex and Counterclockwise
      2. Working with PhysicsEditor
      3. Programming the Pinball Game
      4. Summary
    22. Chapter 14: Game Center
      1. Enabling Game Center
      2. Game Kit Programming
      3. Summary
    23. Chapter 15: Cocos2d and UIKit Views
      1. What Is Cocoa Touch?
      2. Using Cocoa Touch and cocos2d Together
      3. Alert: Your First UIKit View in cocos2d
      4. Embedding UIKit Views in a cocos2d App
      5. Embedding the cocos2d View in Cocoa Touch Apps
      6. Summary
    24. Chapter 16: Kobold2D Introduction
      1. Benefits of Using Kobold2D
      2. The Kobold2D Workspace
      3. The Hello Kobold2D Template Project
      4. DoodleDrop for Mac with KKInput
      5. Summary
    25. Chapter 17: Out of the Ordinary
      1. Additional Resources for Learning and Working
      2. The Business of Making Games
      3. Summary
    26. Index

    Product information

    • Title: Learn cocos2d 2: Game Development for iOS
    • Author(s): Steffen Itterheim, Andreas Löw
    • Release date: September 2012
    • Publisher(s): Apress
    • ISBN: 9781430244165