DemoProductions / fighter

2 stars 1 forks source link

add knockback based on kick #15

Closed flip40 closed 8 years ago

flip40 commented 8 years ago

Branch for issue #14 Knockback vector is set in Sanji.kick(). This vector is then used by the player to determine where he goes during knockback.

Made a few small adjustments to gravity physics as well to make this work. Note that knockback also sets the players jump to one. This is in part to avoid a physics problem due to how I am stopping gravity when on a surface, but is also conveniently also a feature of smash (you get one ground jump and one air jump. Being launched into the air then gives 1 air jump, not two).

Description of the physics problem: If jumps = 0 and you try to leave a box, your yvelocity is getting set to 0 due to the "onCollisionStay2D". I avoided this by just not using onCollisionStay2D and having gravity stop when jumps = 0, which of course had its own repercussions. Now gravity is always going, but so long as you are colliding with the floor, it gets set back to 0. Sticking to walls will still be a thing we need to work out at some point, but we also currently don't have any walls to stick to. I'll make an issue noting that. I could give a better description in person, but there is some annoying problems with the order of methods being called that makes escaping the onCollisionStay2D a bit of a pain.

flip40 commented 8 years ago

Merge closes #14