Presentation & Xcode Projects for 360iDev and Voices that Matter
I had the opportunity to do a presentation and hands-on session on Cocos2D and Box2d at the 360idev and the Voices that Matter conferences. It was a lot of fun to take the audience through Cocos2D and Box2D frameworks and have a working game in their hands by the end of the hour. The credit really goes to Ricardo Quesada and Erin Catto and the community for their excellent work on Cocos2D and Box2D.
The conferences were a blast, especially the GameJam that we had on 360idev. My head is still filled with ideas from what I learned there. If you are doing any iPhone development and have not gone… just go!
Some notes on the slides:
Slide 3: Yep, I’m working on a Cocos2D book that will be published by Pearson. Cover is just a mockup, final cover art will be different.
Slide 11: CCSprites are children of CCLayers, which are children of CCScenes
Slide 12: CCLayers can subscribe to receive the touch and accelerometer events
Slide 13: The CCDirector is used to setup and run the scenes, it runs your game loop
Slide 29: Sample Code != Production Code
Projects from the hands-on session:
Snowball Toss Physics Game
Launch snowballs at the penguin and try to knock him off his perch on top of the ice blocks.
Physics Game (updated)
The GameScene class contains the layers used in the game. Uncomment the layers to get the background and particle systems to show up.
GameplayLayer has the penguin, physics, and touch handling.
Change the ifdefs in the Constant.h file to turn on the graphics and sounds. Zero is OFF, One is ON.
Just Cocos2D and Sprite Touch Detection
Sprite Touch Test
Lastly, one of the questions I had at the talk was how to integrate just Box2D into a UIKit Project. The only magic is having your paths correct and making sure your Objetive-C files end in .mm (due to the Box2D C++ code).
Here is a sample project:
The UIKitBox2D sample just has flattened paths to the Box2D header files. In your project you might want to define the paths in Xcode instead.
Voices that Matter Conference
A Note on the Graphics and Artwork included
The graphics and artwork is copyrighted since we are using them in our games, but the source code you can do with whatever you would like, re-use in your own projects! See the license.GraphicsAndSound file in the Xcode projects for more detail.
Thank you everyone who attended my talks 🙂