soft-eng-practicum / ForkKnightGame

Fork Knight the Game
forkknightthegame.com
1 stars 0 forks source link

No attack = Push the enemy! #11

Open JamesVo1 opened 10 years ago

JamesVo1 commented 10 years ago

If perry doesn't attack a zombie, he can push them to a side.

This might not be fixed if we add a hitbox (maybe he takes dmg but the pushing aspect isn't an aspect we probably want)

Fix: make the fork only have a hitbox when he attack. If zombie touches fork, nothing should happen. if he touches perry, maybe force perry to jump back. or something to prevent him from pushing them

lyche9 commented 10 years ago

Fix: disable the circle collider 2D on the pitchfork game object (uncheck the box). The fork enables its box collider on space bar up. (Starts disabled)

To clarify:

Fix: make the fork only have a hitbox when he attack. If zombie touches fork, nothing should happen.

This is already implemented in the AttackBitches script, lines 24 and 41.

if he touches perry, maybe force perry to jump back. or something to prevent him from pushing them

I like this idea. It would be added in the ZombieAttack script as an OnCollisionEnter or something similar. If the BoxCollider2D detects a collision, addForce to object it collides with if it has tag "Player". The addForce would take a Vector2 parameter <1,0> * x-direction of the zombie (whether it's going left or right).