0

Im developing one application.i.e, catch the apple using basket its similar to the apple catch app .Apples are animating from top to bottom , basket is present at bottom of the view.using that basket catch the apples. But im not get the intersection point of apple and basket image to catch the apple.

Thanks for help..

Pvni
  • 65
  • 7

1 Answers1

0

The shapes are rectangle:

You can use

CGRectIntersection((CGRect)r1, (CGRect)r2) 
CGRectIntersectsRect((CGRect)r1, (CGRect)r2)
CGRectContainsPoint((CGRect)rect, (CGPoint)point)
CGRectContainsRect((CGRect)rect1, (CGRect)rect2)

The shapes are non-rectangle:

UIKit:

You probably need some algorithmes: here is a really good site for the algorithmes of points, lines, shapes ... also here is a relevant question on SO

Cocos2d:

You can use Box2d for the collision detection, here is a good tutorial for Box2d -> How To Use Box2D For Just Collision Detection with Cocos2D iPhone

Community
  • 1
  • 1
swang
  • 250
  • 1
  • 11
  • Now im working on cocoaTouch.so,pls can you tell the solution using cocoa Touch.Here basket and image both are image objects only. – Pvni Jan 11 '13 at 04:31