Cocos 2d is an open source game engine for the iPhone / iPod Touch. However, there is no primer guide to start learning the game engine. So I jot down my study note here, that beginner can follow this guide to start learning game programming using iPhone SDK and cocos 2d.
Prerequisite
You need
1) Intel Mac with Leopard 10.6.2 or above for iPad Simulator 3.2 or iPhone 4.0
2) Intel Mac with Leopard 10.5.7 or above for iPhone Simulator 3.0 or above
The current version of iPhone SDK is for Snow Leopard only
For iPhone SDK 3.1.3 Leopard(10.5.7 or above), you can download from this link
iPhone SDK 3.1.3 with XCode 3.1.4 for Leopard
http://developer.apple.com/iphone/downl ... m2809a.dmg
Download cocos2d source
1) Goto to
http://code.google.com/p/cocos2d-iphone/downloads/listand download the project source, the current version is cocos2d-iphone-0.99.2.tar.gz
2) Untar the download file, you will get the directory cocos2d-iphone-0.99.2
Installation of cocos2d documentation
1) download doxygen from
http://www.stack.nl/~dimitri/doxygen/do ... #latestsrc
2) The latest one for Leopard is Doxygen-1.6.3.dmg
3) Mount the download image and drag the Doxygen to Applications folder of your Mac
4) Launch Xcode and and open the cocos2d-iphone.xcodeproj in cocos2d-iphone-0.99.2
5) Select cocos2d-documentation in Active Target and click build
6) Then you can access the documentation in Help -> Documentation (cocos2d for iPhone API reference) in Xcode (Leopard only)
For snow Leopard, you can open it directly from here
cocos2d-iphone-0.99.2/build/cocos2d-iphone.build/Debug-iphonesimulator/cocos2d-documentation.build/doxygen_output/html/index.html
7) Now select
Active Target -> ActionsTest
Active Executable -> ActionsTest
and build and Go to iPhone Simulator to test your Xcode Environment
There are several tests in the project like HelloSample, you can try them all.
for iPad Simulator 3.2, you have to modify several Project Settings
(a) Base SDK change to
iPhone Simulator 3.2(b) Architectures change to
Optimised(c) Target Device Family changed to
iPadInstall cocos2d Xcode Template and create a New Project for cocos2d
1) Launch Terminal in Mac and change directory to the cocos2d-iphone-0.99.2
e.g.
代碼:
cd ~/Downloads/cocos2d-iphone-0.99.2
2) Install Xcode Template (it will install to /Library/Application Support/Developer/Shared/Xcode/Project Templates)
type
代碼:
sudo ./install-templates.sh
3) Launch and create a project called T01 and select cocos2d Application from User Templates
for iPad Simulator 3.2, you have to modify several Project Settings
(a) Base SDK change to
iPhone Simulator 3.2(b) Architectures change to
Optimised(c) Target Device Family changed to
iPad4) Build and Go to iPhone Simulator
5) You are done with the installation of development environment and can start reading the documentation