SDL Collision Library

Started by
21 comments, last by somebodykulj 16 years ago
This function is all I've ever needed:

int Collide(const SDL_Rect * a, const SDL_Rect * b) {	if ( b->x + b->w < a->x ) return 0;	if ( b->x > a->x + a->w ) return 0;	if ( b->y + b->h < a->y ) return 0;	if ( b->y > a->y + a->h ) return 0;	return 1;}
Advertisement
Just a quick note that SDL_collide has moved to SourceForge.
Rob Loach [Website] [Projects] [Contact]
DO any of you guys know of a collision function for mario type games? for non tile objects, see i have made a good tile collision system but i messed up big triing to follow those N tutorials... SO is there a SDL example? or code that some would like to share with me?

This topic is closed to new replies.

Advertisement