External Tutorials¶
Beginner¶
Setting up the Develop Environment¶
- Multi-platform:
- 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. - Jesus Bosch wrote a good tutorial for setting up android + win32 cocos2d-x development environment on win7
- [spanish] Tutorial based on posts of Jesús Bosch and Jean-Yves Mengant Developing mobile apps for cross-platform
- 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.
Start Coding¶
- 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.
Intermediate¶
- Using CocosBuilder on Cocos2D-X games by Jesus Bosch
- Integrating 3rd party SDK
- OpenFeint, you can refer to MolioApp's Blog
- Game Center, please read this thread
- Flurry Analytics wrapper AnalyticX written by Diwu (Zynga China), or integration sample code written by Dmitry Matyukhin
- Scoreloop wrapper written by Marat Yakupov
- 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
- Build a simple prototype for Physics based Platformer game
- Build a Spinning Globe by using Masking
- Work with Box2D
Code Examples¶
Extensions¶
- 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
Games¶
- Clawoo's examples
- Simple Game Series Part1, Part2, Part3
- "BreakOut:https://github.com/clawoo/BreakoutCocos2D-x
- Pong
- Cute a pult
- TileBased Game
- Asteroids
- Francis Styck's examples
- Samsung Bada's official sample:
- Ballon Ride
- Space Shooter Episode, Part1, Part2
- Wudi (Zynga China)'s sample Tiny Wings Remake on Android using Cocos2d-X
- TweeJump port by Francis Styck
- Chris Wong's BTris is recently updated to cocos2d-x 1.0.1