If I were you, I would calculate the "combat" aspect (i.e. hitting, blocking, taking/dealing damage) completely irrespective of sprite collision or sprite frame. I would have a set of states and then change the sprite frames based on the states. For example state 1 could be idle, state 2 could be block, state 3 = walk left, state 4 = walk right, state 5 = punch, etc.... this would make it simpler to do checks if actions are available or what the results of the actions would be.
For example,
p1_state = 2
p2_state = 5
if they are colliding then p2 is punching p1, but p1 is blocking, so deal no damage, deal small damage, reduce stamina, whatever the design of your game dictates.
if they are both punching and colliding then you could reduce damage from each player, or if you are deadset on whoever hits first gets the damage, you could have a state called just_got_hit. In this state the player could recoil from the blow and be unable to hit back, that way if p1 and p2 go to hit each other at ALMOST the exact same time, whoever was quicker would deal damage and the others attack would be nullified.
This would also make animating much easier. create a UDT with frame numbers and state numbers like so:
type anim_type
start_frame as integer
end_frame as integer
endtype
number_of_states = 20
dim anim(20) as anim_type
anim(0).start_frame = 1 : anim(0).end_frame = 8 `idle
anim(1).start_frame = 9 : anim(0).end_frame = 16 `block
anim(2).start_frame = 17 : anim(0).end_frame = 22 `walk left
anim(3).start_frame = 23 : anim(0).end_frame = 28 `walk right
Then all you need to do is create a animation handler that updates animations ever so often (30 FPS is every 33ms) and cycle thru animation frames. Once you hit the last frame then loop back to the first frame, IF it is a looping animation. example idle would be looping, walking would be looping, blocking would be looping, but attacks, death, etc wouldnt be looping, you would want to return to the idle state after these animations. you could define a part of your UDT using "looping as boolean". In your animation handler if it is a looping animation you start back at the start frame. if it is not a looping animation then set state back to idle.
Thats how I would do it. Sorry my thoughts were kind of all over the place. This system also works quite well handling 3D animation sets. I would give credit where credit is due but I do not recall who introduced this system to me. Most likely Green Gandolf or BatVink.
edited spelling
Sadly, programming is only a hobby for me right now. As it turns out, driving a 70 ton, 7 million dollar Abrams tank requires less qualification than pecking away at a keyboard. Who\'da thunk it?