Friday, November 1, 2013

Street Fighter Knockback/Bounce in Construct 2 WIP

I've long been fascinated with that flying backwards and bouncing off of the ground feature in the Street Fighter games. I thought about it for a while and never quite figured it out. Well, I saw an interview with SF2's lead designer, Akira Nishitani, and he mentioned it in a tweet.

"The knockback a character undergoes when hit by an attack in SF2. As much as we tried, we couldn't get it to go the way we wanted with acceleration and deceleration formulas, so we ended up just plotting it out pixel-by-pixel on graph paper. We plotted out lots of other things pixel-by-pixel, too. Although it was just being fussy about details."

I never understood arrays. I remembered them in my XNA books and saw when Scirra added them to Construct 2. I just don't get them.

So I posed the problem on the boards and was told I could just trigger an X and Y vector and that will give me the arc I needed. Couple that with a counter that will trigger a second, smaller bounce and I'm set.

I gave it a shot, was unsuccessful and asked for some more help. Turns out that you need to set the character's "deceleration" to 0 during the knockback and then turn it back up to normal when he lands or else they will slide indefinitely.

I haven't got the counter in yet, but that will be my next step. I figure I could use the movement angle to trigger the animation and get something pretty cool. I'm hoping to have it figured and up on the blog soon.