Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int collision( void * sp1 , void * sp2 , int dx , int dy)
- {
- SPR_PTR b1 = sp1 , b2 = sp2 ;
- if ((b1->x > b2->x + b2->w - 1) || // is b1 on the right side of b2?
- (b1->y > b2->y + b2->h - 1) || // is b1 under b2?
- (b2->x > b1->x + b1->w - 1) || // is b2 on the right side of b1?
- (b2->y > b1->y + b1->h - 1)) // is b2 under b1?
- {
- // no collision
- return 0;
- }
- // collision
- return 1 ;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement