GetKeyDown don't move character

Hi, how can I create a way to when I slighty press A or LeftArrow my character dont move but just looks to the left, I tried using GetKey to movement and GeKeyDown to only make him face the other way but the characters keeps moving anyway, I want to do something like Pokemon where you can slightly press the key and the characters dont move and only rotates, this is my player controller:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController1 : MonoBehaviour
{
    public float moveSpeed;
    public Vector3 velocity = Vector3.zero;
    public LayerMask solidObjectsLayer;
    public LayerMask grassLayer;
    public Sprite esquerda;
    public Sprite direita;
    public Sprite cima;
    public Sprite baixo;

    private bool isMoving;
    private Vector2 input;
    private Animator animator;

    private void Awake()
    {
        animator = GetComponent<Animator>();
    }
    private void Update()
    {
       var imageComp = GetComponent<SpriteRenderer>();

        if (!isMoving)
        {


            input = Vector2.zero;
            if (Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.A))
            {
                input.x = -1;
            }
            if (Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.A))
            {
                imageComp.sprite = esquerda;
            }
            else if (Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKey(KeyCode.RightArrow) || Input.GetKeyDown(KeyCode.D) || Input.GetKey(KeyCode.D))
            {
                input.x = 1;
            }
            if (Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKey(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.W) || Input.GetKey(KeyCode.W))
            {
                input.y = 1;
            }
            else if (Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKey(KeyCode.DownArrow) || Input.GetKeyDown(KeyCode.S) || Input.GetKey(KeyCode.S))
            {
                input.y = -1;
            }

            if (input.x != 0)
            {
                input.y = 0;
            }


            if (input != Vector2.zero)
            {
                animator.SetFloat("moveX", input.x);
                animator.SetFloat("moveY", input.y);
                var targetPos = transform.position;
                targetPos.x += input.x;
                targetPos.y += input.y;
                if (IsWalkable(new Vector3(targetPos.x,targetPos.y-0.85f)))
                {
                    StartCoroutine(Move(targetPos));
                }
            }
        }

        animator.SetBool("isMoving", isMoving);
    }

    IEnumerator Move(Vector3 targetPos)
    {
        isMoving = true;
        while ((targetPos - transform.position).sqrMagnitude > Mathf.Epsilon)
        {
            transform.position = Vector3.MoveTowards(transform.position, targetPos, moveSpeed * Time.deltaTime);
            yield return null;
        }
        transform.position = targetPos;

        isMoving = false;

        CheckForEncounters();
    }

    private bool IsWalkable(Vector3 targetPos)
    {
        if (Physics2D.OverlapCircle(targetPos, 0.01f, solidObjectsLayer) != null)
        {
            return false;
        }
        return true;
    }

    private void CheckForEncounters()
    {
        if (Physics2D.OverlapCircle(transform.position, 0.2f, grassLayer) != null)
        {
            if (Random.Range(1,101) <= 10)
            {
                Debug.Log("Encountered a wild pokemon");
            }
        }
    }
}

One way would be to add a small delay to your movement:

  • Create a float variable with a nice descriptive name for a delay and set it to something small like 0.1
  • Create another float variable with a name that is good for time.
  • Have a condition for when the player taps the key in the direction opposite to where that character is lookin

  • The player is allowed to turn around right away, but not to move. Before he can move, some time must pass (your delay)

  • So as the key is tapped in that situation, start a counter and use time to store the time past, since the tapping of the key.

  • As soon as time > delay, allow the character to move.

This should result in the exact behaviour you wan't, though I'm no specialist in 2D games and don't know if there's a more standardized way of doing this or not, but I know what you mean from playing Super Mario.