diff --git a/ldjam50/Assets/Scripts/Character.cs b/ldjam50/Assets/Scripts/Character.cs index 2a9af91..bd1f5ad 100644 --- a/ldjam50/Assets/Scripts/Character.cs +++ b/ldjam50/Assets/Scripts/Character.cs @@ -7,6 +7,7 @@ public class Character : MonoBehaviour [SerializeField] private float health; [SerializeField] private float damage; [SerializeField] private float moveSpeed; + [SerializeField] private GameObject characterSprite; private float horInpt; private float verInpt; @@ -30,6 +31,14 @@ void Update() if (-0.1f > horInpt || horInpt > 0.1f) { transform.position += new Vector3(horInpt * moveSpeed,0,0); + if(horInpt > 0 && characterSprite.transform.localScale.x > 0) + { + characterSprite.transform.localScale = new Vector3(-1, 0, 0); + } + if (horInpt < 0 && characterSprite.transform.localScale.x < 0) + { + characterSprite.transform.localScale = new Vector3(1, 0, 0); + } } if (-0.1f > verInpt || verInpt > 0.1f) {