#6786 - cappeca - Mon Jun 02, 2003 8:10 pm
Hi,
I'm doing a fight game on the GBA, and now I have to implement colision detection during combat. I'm going with the MUGEN approach here, so my player sprite will have a "box" for attack and 4 "boxes" of hit, meaning that whenever the vertices of the attack box of one player intersects with any of the hit boxes of the other player, there's a hit.
So I have the structures like this (pseudocode):
which are updated according to the player's current state.
My questions is: what is the fastest way to calculate an intersection between the points of one box against the four others? Do I test all "x" points then "y" points, should I go testing each at a time, or is there any way I could do an OR/AND/XOR comparision? Or is this a very wrong approach in first place?
Thanks for any help.
Cesar.
I'm doing a fight game on the GBA, and now I have to implement colision detection during combat. I'm going with the MUGEN approach here, so my player sprite will have a "box" for attack and 4 "boxes" of hit, meaning that whenever the vertices of the attack box of one player intersects with any of the hit boxes of the other player, there's a hit.
So I have the structures like this (pseudocode):
Code: |
struct collision_box [5] { struct pointA { x; y; }; struct pointB { x; y; } } |
which are updated according to the player's current state.
My questions is: what is the fastest way to calculate an intersection between the points of one box against the four others? Do I test all "x" points then "y" points, should I go testing each at a time, or is there any way I could do an OR/AND/XOR comparision? Or is this a very wrong approach in first place?
Thanks for any help.
Cesar.