We have an attacking animation, where we have several punches and kicks in succession. Recall Metal Gear Solid's Snake's attacks when he does a forward punch twice followed with a kick? Something like that.
The thing is, we create an invisible damage hitbox object (for checking collision on enemy) at the animation frames where the hands and leg reach out at farthest.
But here comes trouble: on a fast computer, the invisible damage hitbox object is created multiple time. I see that because variable framerate. This could be fixed with a little logical check.
BUT here comes the second trouble: on a slow computer, when we have frameskipping really bad, if that frame does not show, we will not be creating the invisible damage hitbox object at all. Thus, resulting in enemies receiving no damage with the punches/kicks during some slower fps.
I was thinking of a workaround, such as creating something like a timer and create the hitbox respectively. But well, it's a workaround and it's not so clean, so don't we have a better method? Anybody got some idea?
Develop games in your browser. Powerful, performant & highly capable.
You could use dt(delta time) in your calculation for creating the hitbox. Then you are not depending on the framerate.
You can find more info on dt here