How do you test for collisions in Xcode?

In Apple’s Xcode, how do you test for collisions between two possibly moving objects?

My current code is this:

if ( >= player.frame.origin. x && <= player.frame.size. width && >= player.frame.origin.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?

This question is answered in the cComments section, powered by Yahoo! Answers:

1 comment

  1. float dx = rockl. frame. origin. x – player. frame. origin. x;float dy = rock. frame. origin. y – player. frame. origin. y;float d = sqrt(dx*dx + dy*dy);suppose radius of rock is 10if (d< 10){//collision}

Leave a comment