collision check in punch/kick animation on foes

Get help using Construct 2

Post » Mon Oct 21, 2013 6:06 pm

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?
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,469

Post » Mon Oct 21, 2013 6:25 pm

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
B
20
S
6
G
4
Posts: 347
Reputation: 4,451


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, brunopalermo, Jackriduk and 23 guests