Car 2d movement help

Hello my script is below. How would i be able to make the car not go left when going right, vice versa.
Same as up down. So the only way to move in those directions is to turn the car.
The mechanic i`m going for is similar to super pixel racers/Showdown miami.

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

public class Drive : MonoBehaviour
{

    public Rigidbody2D rb;

    public Animator anim;

    public float moveSpeed;

    public float x, y;
    public bool moving;

    private Vector3 moveDir;

    private void Start()
    {
        rb = GetComponent<Rigidbody2D>();
    }

    private void Update()
    {
        x = Input.GetAxisRaw("Horizontal");
        y = Input.GetAxisRaw("Vertical");

        if (x != 0 || y != 0)
        {
            anim.SetFloat("X", x);
            anim.SetFloat("Y", y);

            if (Input.GetAxisRaw("Horizontal") > 1 || (Input.GetAxisRaw("Horizontal") < 1) || (Input.GetAxisRaw("Vertical") > 1 || (Input.GetAxisRaw("Vertical") < 1)))
            {
                moving = true;
                anim.SetBool("isMoving", moving);
            }
        }
        else
        {
            moving = false;
            StopMoving();
        }

        moveDir = new Vector3(x, y).normalized;
    }

    private void FixedUpdate()
    {
        if (moving == true)
        {
            rb.velocity = moveDir * moveSpeed * Time.deltaTime;
        }
    }

    private void StopMoving()
    {
        rb.velocity = Vector3.zero;
        rb.Sleep();
    }
}

There’s almost nothing in the code above… it just reads and drives input to a Rigidbody, no momentum or anything.

Definitely start with some tutorials on making a 2D racing game, such as this one:

Here’s another GREAT series for a more 3D yet lowpoly approach:

Learn from others who have actually taken the time to produce usable videos.

Thank you, i think i should be more clear.
I`m creating a 2d game, so the top down 2d is no good for 8 directional sprites
as those tutorials rotate a static sprite, does this make sense ?
Yes the script is simple i might add smoothness, but for now it sets the sprites on a blend tree
depending on direction of the x. y values.

If you have 8-directional sprites, first debug the animation blend tree thing you have set up.

Remove the input reading and just type in the fields in your public x/y variables until the sprites are correct.

Getting the sprites correct (left-to-left, right-to-right, etc.) should be entirely in the animator / animation setup.

I already have that setup, i need to add some sort of constraints, if you watch the videos like shakedown miami and super pixel racers you will notice how the vehicles move to the sprites not rotating a static image.
At the moment if i press up, i can flip the car on the spot to go down i dont want this, same for if im going left
and press right it will flip it on the spot.