fix: Made it so that you can repeatedly bounce on bounce pads
This commit is contained in:
@@ -296,20 +296,25 @@ public class PlayerBehavior : MonoBehaviour
|
||||
{
|
||||
// Assign the player's velocity to zero so that the player can
|
||||
// bounce on the same jump pad
|
||||
this.playerController.RB.velocity = new Vector2(
|
||||
this.playerController.RB.velocity.x,
|
||||
0
|
||||
);
|
||||
// this.playerController.RB.velocity = new Vector2(
|
||||
// this.playerController.RB.velocity.x,
|
||||
// 0
|
||||
// );
|
||||
this.playerController.RB.velocity = Vector2.zero;
|
||||
Bouncepad pad = col.GetComponent<Bouncepad>();
|
||||
switch (pad.Direction())
|
||||
{
|
||||
case Bouncepad.Facing.Left:
|
||||
this.playerController.RB.AddForce(
|
||||
new Vector2(-pad.bounceForce, pad.bounceForce),
|
||||
new Vector2(-pad.bounceForce, pad.verticalMultiplier * pad.bounceForce),
|
||||
ForceMode2D.Impulse
|
||||
);
|
||||
break;
|
||||
case Bouncepad.Facing.Right:
|
||||
this.playerController.RB.AddForce(
|
||||
new Vector2(pad.bounceForce, pad.verticalMultiplier * pad.bounceForce),
|
||||
ForceMode2D.Impulse
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user