Setting up the Develop Environment¶
- Mac OSX users can refer to:
- The best one, Getting Started with Cocos2d-x for iOS and Android, written by Jean-Yves Mengant, using Xcode and Eclipse.
- This tutorial wirtten by SuperSuRaccon also works, and it has a video on youtube
- Windows users
- We mostly have headache with the complication of installing Android NDK and Cygwin in NDK r6 and before, try this tutorial How to setup Cocos2d-x
- Since Android NDK r7, developers can build NDK source files on Windows without Cygwin, so install a windows dev env without cygwin is possible, This blog describe how to achieve it. Note that
ndk-gdbdoes not work on Windows, so you still need Cygwin to debug.
- Linux users can
- Finally, Installation and First run listed how to run HelloWorld and Test, how to create cocos2d-x project form scripts on each supported platform
Concepts You Need to Know¶
- Cocos2d Basic Concepts are universally among all cocos2d branches, including cocos2d-iphone, cocos2d-x and cocos2d-html5. You can refer to cocos2d-iphone's Programming Guide for more details
- Many developers are confused by Standard Touch Delegate & Targeted Touch Delegate,
- Cocos2d-x used reference count for Memory Management in Cocos2d-x. It's similar to Objective-C's NSAutoreleasePool mechanic. You should carefully use retain/release/autorelease to prevent from crashing.
Step by Step Coos2dxSimpleGame Series¶
- Chapter 1 - How to Create a New cocos2d-x project on multi-platforms
- Chapter 2 - How to Add a sprite
- Chapter 3 - How to Move a sprite
- Chapter 4 - How to Fire some Bullets
- Chapter 5 - How to Detect the Collisions
- Chapter 6 - How to Play Music and Sound Effect
- Chapter 7 - Some Icing on the Cake
After you finished this SimpleGame series tutorial, you have managed the basic usage of cocos2d-x!
- Creating a hybrid project such as HelloWorld and Tests cannot be automatically isn't supported by IDEs such as Xcode and Visual Studio. If you need one, please refer to gmeit.ro's Creating hybrid project
- You should know some platform limitations when writing a multi-platform game
- multi-touch, multi-resolution is frequently asked in the forum
- You should know How to use jni if you want to wrap android sdk APIs to C++. It's VERY IMPORTANT !
- Work with CocosBuilder will speed up your development evidently.
- Integrating 3rd party SDK
- Integrate cocos2d-x opengl views into an UIViewController on iOS / UIKit
- Integrate cocos2d-x activities into a classic Java Android application
- Maybe you would like to Play a video on iOS under cocos2d-x
- Work with Box2D
- Scrolling scenes, using CCParallaxNode, refer to Space game example on raywenderlich.com
- InfiniteParallax Class, to repeat same backgrounds all time.
- Slider code and its video. If you're using v2.0 and higher version, I suggest you to use extensions/CCControlExtension/CCControlSlider
- Split Screen using 2 layers
- Sharped Label TTF, better labels
- Clawoo's examples