saving progress
This commit is contained in:
		@@ -19,16 +19,17 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
 | 
			
		||||
    [Header("Clarinet:")]
 | 
			
		||||
    bool unlockedClarinet;
 | 
			
		||||
    // things for dash
 | 
			
		||||
    public bool isDash = false;
 | 
			
		||||
    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;
 | 
			
		||||
    // things for bounce
 | 
			
		||||
    public float reflectForce = 2f;
 | 
			
		||||
    private Vector2 saveVelocity;
 | 
			
		||||
    public bool isInWater = false;
 | 
			
		||||
    private bool lowSpeed = false;
 | 
			
		||||
 | 
			
		||||
    [Header("Cymbals:")]
 | 
			
		||||
@@ -113,8 +114,6 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
                isDash = true;
 | 
			
		||||
                playerInput.DeactivateInput();
 | 
			
		||||
                currentDash = 0.0f;
 | 
			
		||||
                // set so if in water dash will still be true
 | 
			
		||||
                // otherwise turn dash off 
 | 
			
		||||
            }
 | 
			
		||||
            if (!playerController.IsGrounded() && isDash && (currentDash < dashTime))
 | 
			
		||||
            {
 | 
			
		||||
@@ -133,7 +132,6 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
            else if (!isInWater)
 | 
			
		||||
            {
 | 
			
		||||
                isDash = false;
 | 
			
		||||
 | 
			
		||||
                currentDash = 0.0f;
 | 
			
		||||
                _rb.AddForce(-(dashVec), ForceMode2D.Impulse);
 | 
			
		||||
                dashVec = Vector2.zero;
 | 
			
		||||
@@ -264,32 +262,40 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void Bounce()
 | 
			
		||||
    {
 | 
			
		||||
    {/*
 | 
			
		||||
        Vector2 reflect;
 | 
			
		||||
        if (lowSpeed)
 | 
			
		||||
        if (Mathf.Abs(saveVelocity.y) < 1f)
 | 
			
		||||
        {
 | 
			
		||||
            reflect = new Vector2(saveVelocity.x, -(saveVelocity.y) * 0.75f);
 | 
			
		||||
            reflect = Vector2.zero;
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            reflect = new Vector2(saveVelocity.x, -(saveVelocity.y) * bonk);
 | 
			
		||||
            reflect = new Vector2(saveVelocity.x, -(saveVelocity.y) * reflectForce);
 | 
			
		||||
        }
 | 
			
		||||
        _rb.AddForce(reflect, ForceMode2D.Impulse);
 | 
			
		||||
        reflect = Vector2.zero;
 | 
			
		||||
        isDash = false;
 | 
			
		||||
        isDash = false;*/
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void Water()
 | 
			
		||||
    {
 | 
			
		||||
        /*if(isDash)
 | 
			
		||||
        {
 | 
			
		||||
            saveVelocity = _rb.velocity;
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        /*
 | 
			
		||||
        if (Mathf.Abs(_rb.velocity.y) < 2f)
 | 
			
		||||
        {
 | 
			
		||||
            lowSpeed = true;
 | 
			
		||||
            saveVelocity = Vector2.zero;
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            saveVelocity = _rb.velocity;
 | 
			
		||||
        }
 | 
			
		||||
        }*/
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void OnTriggerEnter2D(Collider2D col)
 | 
			
		||||
 
 | 
			
		||||
@@ -313,10 +313,10 @@ public class PlayerMovement : MonoBehaviour
 | 
			
		||||
            //Caps maximum fall speed, so when falling over large distances we don't accelerate to insanely high speeds
 | 
			
		||||
            RB.velocity = new Vector2(RB.velocity.x, Mathf.Max(RB.velocity.y, -Data.maxFallSpeed));
 | 
			
		||||
        }
 | 
			
		||||
        else if (playerBehavior.isInWater)
 | 
			
		||||
        /*else if (playerBehavior.isInWater)
 | 
			
		||||
        {
 | 
			
		||||
            SetGravityScale(0);
 | 
			
		||||
        }
 | 
			
		||||
        }*/
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            //Default gravity if standing on a platform or moving upwards
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user