Posts Tagged ‘gaming’

view bounding boxes around sprites

Just found a useful thing in cocos 2D.

If you wanna see the bounding box around sprites..

go to the ccConfig.h file (it’s in libs –> Cocos2d) and towards the bottom there’s two options CC_SPRITE_DEBUG_DRAW and CC_SPRITEBATCHNODE_DEBUG_DRAW. Change the 0’s on both of those to 1’s and then a white box will show up around every sprite. If you are creating CGRect’s around your sprites for collision detection then you could add the code below to your .m file with the sprites you want to view the boxes on

It is very useful for me for debugging..

 

%d bloggers like this: