views:

1872

answers:

2

how do i start to implement a class for sprite collision

A: 

You want to use the chipmunk's physics engine, which is part of the cocos2d engine.

Example (iPhone)

arul
A: 

You can also perform very simple collision detecting by checking if two rectangles intersect. You can use the CGRectIntersectsRect function to do this. Basically, both rects are based on the position and dimensions of sprites you want to check for collisions. If CGRectIntersectsRect returns true, you know a collision occurred.

More info here: [http://icodeblog.com/2009/02/18/iphone-game-programming-tutorial-part-2-user-interaction-simple-ai-game-logic/%5D%5B1%5D

Eric Farraro