iphone and ipad development game with cocos2d

Download Iphone and Ipad development Game with Cocos2D

Post on 08-May-2015




2 download

Embed Size (px)


  • 1.


  • Intro to IOS App Development
  • Intro Cocos2D
  • Lets make a Cocos2D game
  • Conclusion
  • Resources


  • IOS 2D Gamming

4. -120 million ios devices -250 apps sold every second -250000 total apps

  • Why IOS?


  • So, what do you need to get started


  • IOS Technology Stack


  • Why Cocos2D?

-iOS game development framework based on original cocos2d for python developed by Ricardo Quesada Based on OpenGL 1.1 -Open Source, latest version -Multiplatforms: iOS, uPhone, Win32. Coming soon: Bada, Android cocos2d-x, in C++, multiplatform cocos2d-android-1, in Java, for Android cocos2d-javascript, in Javascript, for Web cocos2d-iphone, in Python for iphone and ipad - It is easy to use, to create simple graphics applications 8.

  • Why Cocos2D?

-Active community http://www.cocos2d-iphone.org/forum/ 9.

  • Why Cocos2D?

-Wiki http://www.cocos2d-iphone.org/wiki/doku.php/ 10. -Features / Engine Model 11. -Quick intro to Objective-C Apples object oriented implementation of C Influenced by Smalltalk style messaging Originally built for NeXTSTEP Used for Mac OS X and IOS development Moderate 12. -Type files Header files. Header files contain class, type, function, and constant declarations. Source files. This is the typical extension used for source files and can contain both Objective-C and C code. Source files. A source file with this extension can contain C++ code in addition to Objective-C and C code. This extension should be used only if you actually refer to C++ classes or features from your Objective-C code. .h .m .mm When you want to include header files in your source code, you typically use a #import directive 13. -Declarate Objects 14. -Class Interfaces When you want to include header files in your source code, you typically use a #import directive 15. -Call Methods 16. -Methods declarate syntax 17. -Class implementation 18. -Example 1 - Class #import class Hello { private: id greeting_text;// holds an NSString public: Hello() { greeting_text = @"Hello, world!"; } Hello(const char* initial_greeting_text) { greeting_text = [[NSString alloc] initWithUTF8String:initial_greeting_text]; } void say_hello() { printf("%sn", [greeting_text UTF8String]); } }; @interface Greeting : NSObject { @private Hello *hello; } - (id)init; - (void)dealloc; - (void)sayGreeting; - (void)sayGreeting:(Hello*)greeting; @end @implementation Greeting - (id)init { self = [super init]; if (self) { hello = new Hello(); } return self; } - (void)dealloc { delete hello; [super dealloc]; } - (void)sayGreeting { hello->say_hello(); } - (void)sayGreeting:(Hello*)greeting { greeting->say_hello(); } @end 19. -Example 1 - Main int main() { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; Greeting *greeting = [[Greeting alloc] init]; [greeting sayGreeting];// > Hello,world! Hello *hello = new Hello("Bonjour, monde!"); [greeting sayGreeting:hello];// > Bonjour,monde! delete hello; [greeting release]; [pool release]; return 0; } 20. Structure -Game has Scenes -Each Scene has some nuber of Layer -Layers capture user interaction and contain sprites -Director manages the scenes 21. Director & Scenes Game made up of game screens calledScrenes EachScenecan be considered a separate app Director handles main windows and executesScenes 22. Director -Manages moving between Scenes-Pausing and running Scenes-Sets up OpenGL ES-Layer ask Director to move on 23. Scenes Each Scene contains several full screen Layers Layers define appearance, behavior and user input Yaers contain Sprites wich are the game elements 24. Layers -Take up the entire screen -Setup to handle touch and accelerometer -Can contain other layers and sprites 25. Important Classes -CocosNode -Scene -Layer -Director -AtlasSprite -AtlasSPriteManager 26. CocosNode -Lost of properties -Position, Scale, Camera, OpenGl z position, children -Most objects in cocos2d inherit form CocosNode 27. Scene 28. Layer 29. Director 30. AtlasSprite 31. AtlasSpriteManager 32. Sprite VS AtlasSprite -Sprite -AtlasSprite -In general, dontt use Sprites -AtlasSPrites way faster -Its all about the OpenGL ES 33. -Setup project -New project -Project Structure -Adding Background -Adding Our Hero -Adding Bad Guys (Game Logic) -Killing Bad Guys(Adding UI) -AnimatingOut Hero -Animating Bad Guys Dying -Adding Body Count -Adding Sound & Music 34. -New project -Execute Xcode, and selected new project cocos aplication 35. -Project structure -General 36. -Project structure AlphaGeeksAppDelegate.m 37. -Project structure HelloWordScene.h 38. -Project structure HelloWordScene.m 39. -Adding Background 40. -Adding Our Hero 41. -Adding Bad Guys (Game Logic) 42. -Killing Bad Guys(Adding UI) 43. -AnimatingOut Hero 44. -Animating Bad Guys Dying 45. -Adding Body Count 46. -Adding Sound & Music 47. http://developer.apple.com http://www.slideshare.net/360conferences/introtoduction-to-cocos2d?src=related_normal&rel=5237272 http://www.slideshare.net/Greenwell/iphone-and-ipad-game-development-with-cocos2d http://www.cocos2d-iphone.org/ http://cocos2d.org/