How can I make the player step forward on mouse click?

Hello, Unity community. I am making a simple 2D game and i need my player to move forward a bit in the direction of the mouse cursor when you attack using the “Fire2” button (right mouse button), as if taking a step. I got it to work somewhat by using transform.Translate, but the player moves farther depending on how far the mouse is from the player, and this isn’t what I want. I think this is because I’m subtracting the players position from the mouse’s position to get the direction, but I don’t know any other way to get the direction. I was wondering if somebody here can help me out.

I never programmed in 2D with unity , I used to creat 2D games using construct , but I think u can just do the same thing I used to do with construct , U can store the position of the mouse compare it to the position of ur player then according to that position u add transform.translate or u can just do it using transfrom.position += new vector2(1,0) if mouving right , (-1,0) if mouving left , and ofc u decide wether mouving left or right according to the sign of Input.MousePosition.x-Player.transform.position.x , or Y not sure , just the horizontal axis , Sorry if this is uselss , just trying to help . I’m Talking about a platform kind of Games . if it’s 8 directions then just store both the X and Y and make ur own system with the same Idea

If you want it to always be the same distance…
After you’ve got the difference of Vector3 positions then…

var direction = (Vector3b - Vector3a).normalized;
//This returns the vector with a length of 1 unit