I am trying to find collision detection between Two Sprits ( encircle with black color in below picture)
here is the code from which i m trying to find with the help by compairing x cordinate of both sprits but unsuccessful
have a look and tell me what is the mistake
- (void)update:(ccTime)dt {
NSLog(@"Target y %f, player y %f",target.position.y, player.position.y);
if(target.position.y==player.position.y)
// if((target.position.x==player.position.x)&&(target.position.y==player.position.y))
// if((sprite.position.y==player.position.y)||(sprite.position.y==player.position.y))
{
Nslog (@"Matched");
//do Something
}
}

The CCNode class which is the parent of the CCSprite class has a boundingBox property of type CGRect. Using this property of the player and target objects you can check for collisions using…