Book description
Harness the power of Cocos2D to create your own stunning and engaging games for iOS
In Detail
Cocos2D-iPhone (Cocos2D-Swift) is a robust yet simple-touse 2D game framework for iPhone. If you are just starting with game programming, Cocos2D will enable you to make your first game in no time. Even if you are a seasoned game developer, you will still be able to benefit from what Cocos2D offers.
This book will set you on the fast-track to game development with Cocos2D for iPhone. You will start by reviewing the basic classes and hierarchy, dive deep into animations and game flow, and finish by creating a complete game with UI using some advanced techniques.
You will begin the book with an empty Cocos2D project and build on it until you end up with a complete game. The book will teach you how to work on game logic, handling user input, controlling the character, and playing audio. Later, in the final part of the book, we'll have a working game on our hands, and we'll see how we can improve the game further
What You Will Learn
- Install Cocos2D and create projects using Cocos2D Xcode templates
- Understand the Cocos2D architecture and its main classes
- Render images and text, move and animate them
- Control your game using touches and a gyroscope
- Create a user interface and navigate between game screens
- Use the physics engine to apply forces and detect collisions
- Add sounds and music and change playback properties
- Integrate your game with Game Center and make In-App purchases
Table of contents
-
Learning iPhone Game Development with Cocos2D 3.0
- Table of Contents
- Learning iPhone Game Development with Cocos2D 3.0
- Credits
- About the Author
- About the Reviewers
- www.PacktPub.com
- Preface
- 1. All About Cocos2D
-
2. Hello Cocos2D
- Starting with Xcode
- Integrating Cocos2D with Xcode
- Time for action – downloading and installing Cocos2D
- Creating a Hello World project
- Time for action – creating a new project from a template
- Time for action – running the project on the simulator
- Modifying the project
- Time for action – creating a new scene
- Time for action – displaying the world
- Time for action – displaying the welcome label
- Reviewing Cocos2D distribution
- Time for action – running tests
- Summary
- 3. Cocos2D – Under the Hood
-
4. Rendering Sprites
- Creating the game project
- Time for action – creating the Cocohunt Xcode project
- Time for action – creating GameScene
- Adding sprites to your game
- Time for action – adding the background sprite
- Time for action – adding the player character
- Time for action – fixing z-order
- Adding more sprites and moving them
- Time for action – adding birds
- Time for action – making the bird move
- Understanding debug FPS labels
- Spritesheets and animation
- Time for action – creating a spritesheet
- Time for action – modifying the game to use spritesheets
- Time for action – animating the birds
- Summary
-
5. Starting the Action
- Making the hunter aim and shoot
- Time for action – handling touches
- Time for action – aiming at the touch position
- Time for action – shooting the arrow
- Adding more birds to the GameScene class
- Time for action – adding more birds
- Time for action – detecting if the arrow hits the bird
- Winning, losing, and other states
- Time for action – using states for the bird's life cycle
- Time for action – animating the shooting and limiting the shooting rate
- Time for action – winning or losing the game
- Improving the gameplay
- Time for action – limiting the aiming range
- Time for action – alternative control using a gyroscope
- Summary
- 6. Rendering Text
-
7. Animations and Particle Systems
- Using frame-based animation
- Time for action – exploding coconut
- Animating using actions
- Time for action – hitting the bird animation
- Skeletal animation
- Creating particle systems for advanced effects
- Time for action – adding the feathers explosion
- Time for action – adding a fire to the scene
- Time for action – using Particle Designer
- Summary
-
8. Adding Sound Effects and Music
- Creating AudioManager and playing sound effects
- Time for action – adding the AudioManager class
- Time for action – finding and playing our first sound effect
- Time for action – playing the remaining sound effects
- Music and background sounds
- Time for action – adding background sounds
- Time for action – adding music
- Enhancing Cocohunt sound effects
- Time for action – preloading sound effects
- Time for action – playing a sound at position
- Summary
-
9. User Interface and Navigation
- Using buttons
- Time for action – adding menu buttons
- Time for action – toggling sound and music
- Time for action – storing settings in NSUserDefaults
- Navigating between scenes
- Time for action – pushing AboutScene
- Time for action – using more transitions
- Time for action – using the scroll view to select levels
- Creating modal dialogs and using text input
- Time for action – pausing the game with a pause dialog
- Time for action – restarting and exiting the game
- Time for action – displaying stats when losing and winning
- Entering and displaying highscores
- Time for action – displaying highscores with CCTableView
- Time for action – using the text field
- Summary
-
10. Physics
- Creating a physics world
- Time for action – creating a game level with physics
- Time for action – adding ground to the scene
- Time for action – adding the hunter
- Time for action – fixing the hunter movement
- Detecting and filtering collisions
- Time for action – detecting and ignoring collisions
- Time for action – filtering collisions using a collision mask
- Time for action – filtering collisions using collision groups
- Applying forces and impulses and using joints
- Time for action – launching stones
- Time for action – adding angry birds
- Summary
-
11. Working with Tile Maps
- Creating tile maps
- Time for action – creating a tileset
- Time for action – creating a tile map
- Time for action – creating the Retina version of the tile map
- Using the tile maps
- Time for action – creating TilemapScene
- Time for action – moving and following the bird
- Time for action – using parallax scrolling
- Summary
-
A. Pop Quiz Answers
- Chapter 2, Hello Cocos2D
- Chapter 3, Cocos2D – Under the Hood
- Chapter 4, Rendering Sprites
- Chapter 5, Starting the Action
- Chapter 6, Rendering Text
- Chapter 7, Animations and Particle Systems
- Chapter 8, Adding Sound Effects and Music
- Chapter 9, User Interface and Navigation
- Chapter 10, Physics
- Chapter 11, Working with Tile Maps
- Index
Product information
- Title: Learning iPhone Game Development with Cocos2D 3.0
- Author(s):
- Release date: June 2014
- Publisher(s): Packt Publishing
- ISBN: 9781782160144
You might also like
book
Learning Cocos2d-x Game Development
Learn cross-platform game development with Cocos2d-x In Detail Cocos2d-x is one of the most popular cross-platform …
book
Beginning iPhone Development with Swift 2: Exploring the iOS SDK
The team that brought you the bestselling Beginning iPhone Development, the book that taught the world …
book
Beginning Android Games
Beginning Android Games offers everything you need to join the ranks of successful Android game developers. …
book
iPhone App Development: The Missing Manual
Anyone with programming experience can learn how to write an iPhone app. But if you want …