-cocos2d is one of the most popular open source projects for the iphone
- over 100 games shipped, with a number of them in the top 10
- This introductory course will get you up to speed on:
*basic architecture of the engine
*using Sprites and their more efficient counterpart, AtlasSprites
*user interaction (dealing with touch and multitouch events)
*particle system
*screen transitions
*actions
4. Why cocos2d?
• Well over 200 games shipped
• Great licensing
• Lots of features
• Extremely active community
• What’s your business?
Thursday, October 1, 2009
6. Beginner Hurdles
• Objective-C and Memory
• Setting Up a cocos2d Project
• Running Samples and Tests
• Understanding Tests
Thursday, October 1, 2009
7. Learn Objective-C
Read: “Learning Objective-C: A Primer”
Thursday, October 1, 2009
8. Learn Memory
Management
Read: “Memory Management Programming
Guide for Cocoa”
Thursday, October 1, 2009
9. cocos2d Project Setup
• Super easy ... now
• sudo ./install_template.sh
Thursday, October 1, 2009
13. Running Samples & Tests
• Wonderful source of examples that people
seem to overlook
• Once noticed, folks have issues running
Thursday, October 1, 2009
21. Tests
• Not games
• Meant to exercise some specific functionality
• Useful for figuring stuff out
Thursday, October 1, 2009
22. Tests
• Structured very similarly
• Some base test class
• Instantiate new test by advancing through
NSStrings using NSClassFromString
Thursday, October 1, 2009
23. Tests
• Let’s look at AtlasSpriteTest and
EaseActionsTest
Thursday, October 1, 2009
25. cocos2d Basics
• Game has Scenes
• Each Scene has some number of Layers
• Layers capture user interaction and contain
sprites
• Director manages the scenes
Thursday, October 1, 2009
26. Scenes
• Screens in your game
• Can almost think of them as separate apps
Thursday, October 1, 2009
27. Layers
• Take up the entire screen
• Setup to handle touch and accelerometer
• Can contain other layers and sprites (and
other stuff)
Thursday, October 1, 2009
29. Director
• Manages moving between Scenes
• Pausing and running Scenes
• Sets up OpenGL ES
• Layer asks Director to move on
Thursday, October 1, 2009
35. CocosNode
• Lots of properties
• position, scale, camera, OpenGL z position,
children
• Most objects in cocos2d inherit from
CocosNode
Thursday, October 1, 2009