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..

 

Advertisements

2 responses to this post.

  1. Hi Sai Kiran,
    My Name is Venkat. I am from Bay Area. I am working on designing and developing educational games for kids. I am looking to connect to people who are working on game development and share ideas and thoughts.

    Reply

  2. Posted by smartkiran on April 5, 2013 at 15:22

    Hey venkat, you can email me with your questions. I will try to answer them

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: