From af754415ea650ce4b10e6e0c0b62854e7e54edf0 Mon Sep 17 00:00:00 2001 From: allylikesfrogs Date: Thu, 4 May 2023 21:08:48 -0700 Subject: [PATCH] fuckin with water --- Assets/Scenes/MainMenu.unity | 4 ++++ Assets/Scripts/PlayerBehavior.cs | 31 ++++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/Assets/Scenes/MainMenu.unity b/Assets/Scenes/MainMenu.unity index f93695b..eeb7636 100644 --- a/Assets/Scenes/MainMenu.unity +++ b/Assets/Scenes/MainMenu.unity @@ -912,6 +912,10 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: + - target: {fileID: 2527389465697474493, guid: ff99a7d0beeca415e911378b9b377de4, type: 3} + propertyPath: showDropdown + value: 1 + objectReference: {fileID: 0} - target: {fileID: 3422388587178177106, guid: ff99a7d0beeca415e911378b9b377de4, type: 3} propertyPath: m_Pivot.x value: 0 diff --git a/Assets/Scripts/PlayerBehavior.cs b/Assets/Scripts/PlayerBehavior.cs index 19eb6a3..2b21ee7 100644 --- a/Assets/Scripts/PlayerBehavior.cs +++ b/Assets/Scripts/PlayerBehavior.cs @@ -23,11 +23,13 @@ public class PlayerBehavior : MonoBehaviour public float bonk = 2f; private Vector2 saveVelocity; public bool isInWater = false; + //dont know if gravity matters public float dashForce = 1.2f; private float dashTime = 1.0f; private float dashInc = 0.1f; private float currentDash = 0.0f; Vector2 dashVec; + private bool lowSpeed = false; [Header("Grappling:")] [SerializeField] public Tutorial_GrapplingGun grapplingGun; @@ -126,6 +128,11 @@ public class PlayerBehavior : MonoBehaviour dashVec = Vector2.zero; playerInput.ActivateInput(); } + else + { + currentDash = 0.0f; + dashVec = Vector2.zero; + } } } @@ -231,21 +238,27 @@ public class PlayerBehavior : MonoBehaviour void Bounce() { - if(isDash) + Vector2 reflect; + if(lowSpeed) { - Vector2 reflect = new Vector2(saveVelocity.x,-(saveVelocity.y) * bonk); - _rb.AddForce(reflect, ForceMode2D.Impulse); - reflect = Vector2.zero; + 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); + _rb.AddForce(reflect, ForceMode2D.Impulse); + reflect = Vector2.zero; + isDash = false; } void Water() { - if(Mathf.Abs(_rb.velocity.y) < 2f) + if (Mathf.Abs(_rb.velocity.y) < 2f) { + lowSpeed = true; saveVelocity = Vector2.zero; - isInWater = true; } else { @@ -276,6 +289,7 @@ public class PlayerBehavior : MonoBehaviour } else if (col.tag == "water") { + isInWater = true; Water(); } } @@ -294,6 +308,8 @@ public class PlayerBehavior : MonoBehaviour else if (col.tag == "water") { isInWater = false; + isDash = false; + playerInput.ActivateInput(); saveVelocity = Vector2.zero; } } @@ -342,6 +358,7 @@ public class PlayerBehavior : MonoBehaviour audioSource.clip = deathSound; audioSource.loop = false; audioSource.Play(); + playerInput.ActivateInput(); // animate animator.Play("Die");