Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Cocos2D Introduction (Melbourne Cocoaheads 20111013)

1,563 views

Published on

A brief introduction to the Cocos2D game engine for iOS devices covering some of the basic architecture and usage.

Published in: Technology, Travel
  • Be the first to comment

Cocos2D Introduction (Melbourne Cocoaheads 20111013)

  1. 1. Cocos2D: An introductionRob Caporetto (@rob_caporetto)www.rob-caporetto.com
  2. 2. Caveats
  3. 3. What is Cocos2D?
  4. 4. Getting Up & Running
  5. 5. Installing Visit the Cocos Page & download Run the installer to install the Xcode Templates
  6. 6. Installing Visit the Cocos Page & download Run the installer to install the Xcode Templates
  7. 7. Concepts
  8. 8. Scenes, Layers, NodesScenes Conceptually a View Controller Managed by the CCDirector
  9. 9. Scenes, Layers, NodesLayers Logical Separation of elements in the scene
  10. 10. Scenes, Layers, NodesEverything is a CCNode Sprites, UI Items. Allows for Parent/Child relationships
  11. 11. Input
  12. 12. Touch InputiOS 3 Style Callbacks -ccTouchesBegan:withEvent: -ccTouchesMoved:withEvent: -ccTouchesEnded:withEvent: -ccTouchesCancelled:withEvent:Enable with isTouchEnabled on Layer
  13. 13. Touch InputNo Gesture RecognizersBest to dig up that legacy code…
  14. 14. Accelerometer InputUses existing UIKit callback -accelerometer:didAccelerate:Enabled via isAccelerometerEnabled property
  15. 15. Gyro Input?Not out of box :(BUT, CoreMotion is EASY!
  16. 16. Audio
  17. 17. AudioCocosDenshion Primary Includes SimpleAudioEngine wrapperAlternate is ObjectAL
  18. 18. SimpleAudioEngineObtain SimpleAudioEngine instancePreload, Play or Unlock [audioEngine preloadEffect:filename] [audioEngine playEffect:filename] [audioEngine unloadEffect:filename]
  19. 19. SimpleAudioEngine (cont)Obtain SimpleAudioEngine instancePreload or Play Music [audioEngine preloadBackgroundMusic:filename] [audioEngine playBackgroundMusic:file loop:YES] [audioEngine stopBackgroundMusic:filename]
  20. 20. The Demo Game
  21. 21. Conclusion
  22. 22. Resources (Code)Cocos2D: http://www.cocos2d-iphone.org/ShooterDemo: https://github.com/robc/ShooterDemo
  23. 23. Resources (Tools)cfxr: http://thirdcog.eu/apps/cfxrTexturePacker: http://www.texturepacker.comGlyphDesigner: glyphdesigner.71squared.com
  24. 24. Resources (Books)Learning Cocos2D: http://cocos2dbook.com/Learn Cocos2D Game Development*: http://www.learn-cocos2d.com/store/book-learn-cocos2d/

×