diff --git a/ldjam50/Assets/Scripts/Character.cs b/ldjam50/Assets/Scripts/Character.cs index 5d2c9f6..aecc7ac 100644 --- a/ldjam50/Assets/Scripts/Character.cs +++ b/ldjam50/Assets/Scripts/Character.cs @@ -22,8 +22,8 @@ public class Character : MonoBehaviour [SerializeField] private GameObject HealthBar; - private float horInpt; - private float verInpt; + private float horInput; + private float verInput; public struct StatReturn { @@ -33,44 +33,23 @@ public struct StatReturn } private void Start() { - characterAnimator = characterSprite.GetComponent(); + characterAnimator = characterSprite.GetComponent(); } // Update is called once per frame - void Update() + private void Update() { - if (health > 240) - { - iconFull.SetActive(true); - iconHalf.SetActive(false); - iconDeath.SetActive(false); - } - if (health < 125 && health > 15) - { - iconFull.SetActive(false); - iconHalf.SetActive(true); - iconDeath.SetActive(false); - } - if (health < 15) - { - iconFull.SetActive(false); - iconHalf.SetActive(true); - iconDeath.SetActive(false); - } - - print(_gameplay.GetProcentsXP()); - // HealthBar.GetComponent().fillAmount = _gameplay.GetProcentsXP(); - - horInpt = Input.GetAxis("Horizontal"); - verInpt = Input.GetAxis("Vertical"); - if (moveSpeed > horInpt || horInpt > moveSpeed) + + horInput = Input.GetAxis("Horizontal"); + verInput = Input.GetAxis("Vertical"); + if (moveSpeed > horInput || horInput > moveSpeed) { characterAnimator.SetBool("IsRun", true); - transform.position += new Vector3(horInpt * moveSpeed,0,0); - if (horInpt > 0) + transform.position += new Vector3(horInput * moveSpeed,0,0); + if (horInput > 0) { characterSprite.transform.localScale = new Vector3(1, 1, 1); } - if (horInpt < 0) + if (horInput < 0) { characterSprite.transform.localScale = new Vector3(-1, 1, 1); } @@ -79,10 +58,10 @@ void Update() { characterAnimator.SetBool("IsRun", false); } - if (-0.1f > verInpt || verInpt > 0.1f) + if (-0.1f > verInput || verInput > 0.1f) { characterAnimator.SetBool("IsRun", true); - transform.position += new Vector3(0,verInpt * moveSpeed,0); + transform.position += new Vector3(0,verInput * moveSpeed,0); } MoveCamera();