hit detection acting really wonky
id: 750027
category: Help with Scripts
posts: 5
me_is_big_brain
loading
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, as long as the opponent is stunned, certain attacks WILL hit them; along with waiting until they're actually allowed to be damaged
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
(alternatively, push them away and then use a move quickly enough)
https://scratch.mit.edu/projects/988927025/
normally, hitting an opponent will immediately apply any effects the attack may have, which works fine. however, as long as the opponent is stunned, certain attacks WILL hit them; along with waiting until they're actually allowed to be damaged
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
(alternatively, push them away and then use a move quickly enough)
https://scratch.mit.edu/projects/988927025/
Cool_Dude2022
loading
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
me_is_big_brain
loading
i had this idea, but i figure that this would be too similar to just hard-coding it to work, which goes against the idea of making the engine easy to remix. i'll try and see if it works well though, this might be better than i think!
me_is_big_brain
loading
i did it… and it WAITED. the dummy literally waited until it was ALLOWED to be hurt?? i did learn some new info though. its PSYCHIC POWER, not even related to the hitbox at all, just if the move was used! however, it can be stopped if you use a different moveim 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
me_is_big_brain
loading
the only issue was that i was using “IF” blocks as opposed to “IF/ELSE” blocks