Game Development Reference
Nevertheless, the test cases document practically every feature of cocos2d. It can't hurt
to run each of the test cases once to see what's in them, or at least those that seem inter-
esting to you. For example, the test cases show off all the actions that cocos2d sup-
ports, including the 3D actions with ripple, wave, or page turn effects.
Cocos2d API Reference
The cocos2d API reference describes every class, every method, every property in
cocos2d. Finding out, for example, which varieties of initializer methods a class sup-
ports, or what properties it has, is very helpful. This is valuable information that can
help you plan your code ahead of time and learn more about the cocos2d API as you
stumble across methods and parameters you didn't know existed.
Whenever you have a question like “Can I do x with this class y?” you should consult
the API reference, look for class y, and see what properties and methods it has avail-
able to you. Take, for example, the CCNode class reference here: www.learn-
a condensed version of the CCNode section of this chapter. The API reference doesn't
tell you the why's and how's, but it does show you what's available.
The official cocos2d API reference is hosted here: www.cocos2d-iphone.org/
api-ref . Be sure to select the API reference for the cocos2d version you're using, as
there is at least one API reference for each minor version of cocos2d. Sadly, the
cocos2d API reference is incomplete and missing several classes, methods, and proper-
ties. In particular, most of the Mac OS X features are absent.
On the Learn Cocos2D web site, I host API references for all the libraries used in Ko-
bold2D, including cocos2d-iphone, the cocos2d-iphone-extensions project, Box2D, and
Chipmunk. The cocos2d API reference on my web site is a cleaned-up version of the
official API reference and includes all the undocumented classes, methods, and proper-
ties not found in the official API reference. The cocos2d API reference and many oth-
ers are also split into iOS and Mac OS X versions, so you won't be confused by refer-
ences to code that's not available on your target platform.
In addition, I find the Kobold2D API references easier to browse because they use a
tree-like class index and keep the relatively large class collaboration and inheritance
diagrams hidden by default. You can find the Kobold2D API references either at