Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int __pure__ ChkCollision (Object *Obj1, Object *Obj2) {
- int LeftA, RightA, TopA, BottomA;
- int LeftB, RightB, TopB, BottomB;
- LeftA = Obj1->PosX>>8;
- RightA = LeftA+Obj1->Width-1;
- TopA = Obj1->PosY>>8;
- BottomA = TopA+Obj1->Height-1;
- LeftB = Obj2->PosX>>8;
- RightB = LeftB+Obj2->Width-1;
- TopB = Obj2->PosY>>8;
- BottomB = TopB+Obj2->Width-1;
- if(LeftA >= LeftB
- && LeftA <= RightB
- && TopA >= TopB
- && TopA <= BottomB)
- return 1;
- if(LeftB >= LeftA
- && LeftB <= RightA
- && TopB >= TopA
- && TopB <= BottomA)
- return 1;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement