singersinger
asked on
collision detection
Hi guys there...I'm actually working on a 2D fighting game ..sort of street fighter..I'm just wondering how can I write the codes for collision detections between the characters? thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Even if it is a 3d simulation using 2d methods you would still be detecting collisions in a 2d plane. Doing a pixel by pixel computation is going to be a lot slower than using a bounding box(or circle). Granted a pixel by pixel method would be more accurate but a trade off with speed needs to be considered. The faster computers today might be able to run a pixel method without a hitch but an older computer might not. Boxes would probably fit a human shaped body better than circles and by using either of these methods you can check collisions from both front and back with relative ease. You might try attaching a pointer to a list of your objects to each frame of animation in order to define the collison regions for each frame.
try looking for this webpage for a more detailed description and implementation:
http://www.gamedev.net/reference/articles/article735.asp
http://www.gamedev.net/reference/articles/article735.asp
ASKER