In Apple’s Xcode, how do you test for collisions between two possibly moving objects?
My current code is this:
if (rock.center.x >= player.frame.origin. x && rock.center.x <= player.frame.size. width &&
rock.center.y >= player.frame.origin.y && rock.center.y <= player.frame.size.height) {
but something is off, the code is not working. I do not know what is wrong- it looks correct. Can someone tell me how to correctly test for collisions in Xcode?