Mar 232012
Quick Tip: Mixing OpenGL and Cocos2d (Triangle Fan)

Cocos2d and OpenGL Cocos2d hides most of the complexities of OpenGL, but every now and then you will be forced to write some custom OpenGL code. You can override the draw method of CCNode to perform your custom OpenGL drawing. You don’t have to write the code for scaling, rotating or translating inside the draw […]

 Posted by at 3:27 pm
Nov 142011

Tip: Quick tip to swap out the image of a sprite that has already been initialized with an image. CCSprite *sprite = [CCSprite spriteWithSpriteFrameName@”oldImage.png”]; [sprite setDisplayFrame:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:@”newImage.png”]];

 Posted by at 6:04 pm
Sep 132011

To Collide or Not to Collide When you create simple Box2d objects, they will collide with each other. But what if you do not want an object colliding with all other objects? What if you want certain objects colliding with only certain other objects? How do we achieve this finer grained control? Say that our […]

 Posted by at 9:03 am
Jan 072011
Beginning Box2D Physics Engine

What Is It? Cocos2d comes with two physics engines. One is called Chipmunk and the other is called Box2d. Chipmunk sounds cuter and is written in C, whereas Box2D is written in C++. I chose to learn Box2d because it seems to be the more popular and mature of the two. Instead of trying to […]