I am new to cocos2d-x and i am developing a game using cocos2d-x in xcode. In my game I added player sprite and Obstacle sprite. Obstacle sprite is moving continuously from right to left. Now i am trying to add collision between the two sprites. So that I am using bounding box.Following is my code. but it is not working. this is first time that i am using bounding box.
if(obs1->boundingBox().intersectsRect(man->boundingBox()))
{
obs1->stopAllActions();
}
I created both the sprite in init() function and declare the above code in init function. Please help me to solve this.
you should be using if xxx->containsPoint()