me_is_big_brain wrote:

im trying to make a fighting game engine, but i'm facing an issue with the hitboxes

normally, hitting an opponent will immediately apply any effects the attack may have, which works fine. however, if the opponent is laying down, attacks that shouldn't reach them will wait until they get up, and THEN they'll be attacked, despite the hitbox being long gone.

i have zero idea why this is happening! i've attempted a few fixes, but none of them worked, so i'm resorting to the forums of shame. if you can help, please do!



to replicate:
attack the opponent with the first ability to get them laying down. then, use the third ability before they can get up.




https://scratch.mit.edu/projects/988927025/

My idea would be to add a check, this would check if the opponent is “laying down” and then either hit/miss the attack.

when I receive [Opponent Lay Down v]
set [Opponent Status? v] to [Laying Down]

when I receive [Opponent Get Up v]
set [Opponent Status? v] to [Standing]

Then, you can use something like this in the attack script:

forever
wait until <key [space v] pressed?> // Just a random boolean to signal when the player attacks. Completely arbitrary.
wait until <not <key [space v] pressed?>>
if <(Opponent Status?) = [Laying Down]> then
Attack animation
Send out a projectile
Miss the opponent
else
Attack animation
Send out a projectile
Hit the opponent
end
end