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;}
SDL Collision Library
This function is all I've ever needed:
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
Popular Topics
Advertisement