change: Added second level to MushroomVillage and implemented jump pads
This commit is contained in:
@@ -239,13 +239,13 @@ public class PlayerBehavior : MonoBehaviour
|
||||
void Bounce()
|
||||
{
|
||||
Vector2 reflect;
|
||||
if(lowSpeed)
|
||||
if (lowSpeed)
|
||||
{
|
||||
reflect = new Vector2(saveVelocity.x,-(saveVelocity.y) * 0.75f);
|
||||
reflect = new Vector2(saveVelocity.x, -(saveVelocity.y) * 0.75f);
|
||||
}
|
||||
else
|
||||
{
|
||||
reflect = new Vector2(saveVelocity.x,-(saveVelocity.y) * bonk);
|
||||
reflect = new Vector2(saveVelocity.x, -(saveVelocity.y) * bonk);
|
||||
}
|
||||
//reflect = new Vector2(saveVelocity.x,-(saveVelocity.y) * bonk);
|
||||
_rb.AddForce(reflect, ForceMode2D.Impulse);
|
||||
@@ -292,6 +292,27 @@ public class PlayerBehavior : MonoBehaviour
|
||||
isInWater = true;
|
||||
Water();
|
||||
}
|
||||
else if (col.tag == "bouncePad")
|
||||
{
|
||||
// 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
|
||||
);
|
||||
Bouncepad pad = col.GetComponent<Bouncepad>();
|
||||
switch (pad.Direction())
|
||||
{
|
||||
case Bouncepad.Facing.Left:
|
||||
this.playerController.RB.AddForce(
|
||||
new Vector2(-pad.bounceForce, pad.bounceForce),
|
||||
ForceMode2D.Impulse
|
||||
);
|
||||
break;
|
||||
case Bouncepad.Facing.Right:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnTriggerExit2D(Collider2D col)
|
||||
@@ -367,7 +388,8 @@ public class PlayerBehavior : MonoBehaviour
|
||||
|
||||
// this.stateController.SetDeathCanvasActive(true);
|
||||
|
||||
if (grapplingRope.isGrappling) {
|
||||
if (grapplingRope.isGrappling)
|
||||
{
|
||||
LetGoOfGrapple();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user