Archive of cocos2d

Wrapping Box2D Debug into a Cocos2D Layer

Posted by John Wordsworth on September 09, 2011 in iOS Development tagged with , , ,

When I first started integrating Box2D into my Cocos2D project, I found the whole process a little jarring. While I'd used C++ before, this was the first time I'd seen it mixed with Objective-C. This code snippet simply wraps the standard Box2D Debug calls from GLES-Render.h (included with Cocos2D) in it's own CCLayer, so that you can implement it quickly and easily. It also allows you to turn the layer on an off easily as you would any other CCLayer.

Continue ReadingView Comments (3)

Loading Cocos2D Sprite Frame Animations from Plist Files

Posted by John Wordsworth on July 07, 2011 in iOS Development tagged with , , ,

In a game that a friend and I are working on (Knight Terrors) we wanted a system to pre-load animations into CCAnimationFrameCache without having to hardcode any of that configuration. This means that our designer and artist, Jackson Matthews, can add and remove frames from a creature's animation without having to come back to me with a frame list to paste back into the code. I will assume you have knowledge of CCSpriteFrameCache and CCAnimations within cocos2d before embarking on this. If not, you can read up on them through the provided links.

Continue ReadingView Comments (4)