Cross Platform Mobile Game Development

Uploaded on

Developing games with Cocos2d-x

Developing games with Cocos2d-x

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads


Total Views
On Slideshare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. Cross Platform Mobile Game Development Saturday, August 24, 13
  • 2. About Me • Allan Davis • • • Saturday, August 24, 13 Email: Twitter: @cajun_code
  • 3. Agenda Saturday, August 24, 13
  • 4. • Graphics • • • • Tools Bitmap: Gimp, Photoshop, Pixelmator Vector: Inkscape, iDraw 3D: Blender, 3D Studio Max Other: TexturePacker • Audio • Saturday, August 24, 13 • • Audacity: Musescore: Frameworks
  • 5. Mobile Game Frameworks Landscape • Corona • Unity • Cocos2d-X • Many others ... Saturday, August 24, 13
  • 6. Corona • • • • • • Saturday, August 24, 13 2d Game Framework iOS, Android Lua Closed Source Free to use Starter version • Does allow publishing
  • 7. Unity 3d • 3d Environment for creating games • Desktop, iOS, Android Blackberry • C#, Javascript or Boo Script • Closed Source • Free to develop and publish • Saturday, August 24, 13
  • 8. Cocos2d-x • 2D Game Framework • iOS, Android, Windows Phone, Desktop • Open Sourced • C++ 11 (3.0 alpha) • Saturday, August 24, 13
  • 9. Demo: Getting Started Saturday, August 24, 13
  • 10. Game loop Setup Game Get User Input Update Game Objects Update Display Done? No Saturday, August 24, 13 Yes Shut Down
  • 11. Director Class that creates and handle the main Window and manages how and when to execute the Scenes. The Director is also responsible for: • • • • • initializing the OpenGL context setting the OpenGL pixel format (default on is RGB565) setting the OpenGL buffer depth (default one is 0-bit) setting the projection (default one is 3D) setting the orientation (default one is Portrait) Saturday, August 24, 13
  • 12. Node Anything that gets drawn or contains things that get drawn is a Node. The most popular Nodes are: Scene, Layer, Sprite, Menu. The main features of a Node are: • They can contain other Node nodes (addChild, getChildByTag, removeChild, etc) • They can schedule periodic callback (schedule, unschedule, etc) • They can execute actions (runAction, stopAction, etc) Saturday, August 24, 13
  • 13. Scene • Scene an Node are almost identical with the difference that Scene has it's anchor point (by default) at the center of the screen. Saturday, August 24, 13
  • 14. Layers Layer is a subclass of Node that implements the TouchEventsDelegate protocol. All features from Node are valid, plus the following new features: • It can receive iPhone Touches • It can receive Accelerometer input Saturday, August 24, 13
  • 15. Sprite Saturday, August 24, 13
  • 16. Sprite Sprite is a 2d image ( ) Sprite can be created with an image, or with a sub-rectangle of an image. If the parent or any of its ancestors is a SpriteBatchNode then the following features/ limitations are valid • Features when the parent is a BatchNode: ◦ MUCH faster rendering, specially if the SpriteBatchNode has many children. All the children will be drawn in a single batch. • Limitations ◦ Camera is not supported yet (eg: OrbitCamera action doesn't work) ◦ GridBase actions are not supported (eg: Lens, Ripple, Twirl) ◦ The Alias/Antialias property belongs to SpriteBatchNode, so you can't individually set the aliased property. ◦ The Blending function property belongs to SpriteBatchNode, so you can't individually set the blending function property. ◦ Parallax scroller is not supported, but can be simulated with a "proxy" sprite. Saturday, August 24, 13
  • 17. Sprite Batch Node SpriteBatchNode is like a batch node: if it contains children, it will draw them in 1 single OpenGL call (often known as "batch draw"). A SpriteBatchNode can reference one and only one texture (one image file, one texture atlas). Only the Sprites that are contained in that texture can be added to the SpriteBatchNode. All Sprites added to a SpriteBatchNode are drawn in one OpenGL ES draw call. If the Sprites are not added to a SpriteBatchNode then an OpenGL ES draw call will be needed for each one, which is less efficient. Limitations: • The only object that is accepted as child (or grandchild, grand-grandchild, etc...) is Sprite or any subclass of Sprite. eg: particles, labels and layer can't be added to a SpriteBatchNode. • Either all its children are Aliased or Antialiased. It can't be a mix. This is because "alias" is a property of the texture, and all the sprites share the same texture. Saturday, August 24, 13
  • 18. Action Saturday, August 24, 13
  • 19. Demo: FTL Effect: Invasion Saturday, August 24, 13
  • 20. Resources • Webiste: • • Tutorials: • • Book: •, August 24, 13
  • 21. Questions? Saturday, August 24, 13