Shoot in the direction mouse is pointing

So i am trying to make the player shoot in the direction the mouse is pointing from my player. i have writen some code that gets me the angle. but i dont want the player to shoot at the mouse only straight up, left and right. like in the video below.
https://streamable.com/iy14yr

private void FixedUpdate()
    {
        Vector3 difference = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;

        difference.Normalize();

        float rotationZ = Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg;

        Debug.Log(rotationZ);
    }

the joystick im moving around is giving out values from -1 to 1 which seems easier but i dont know how i could make the screen cordinates into that. but let me know if you have a solution for that

the joystick im moving around is giving out values from -1 to 1 which seems easier but i dont know how i could make the screen cordinates into that. but let me know if you have a solution for that

You are correct that this is a fairly easy solution. Your joystick will actually give you 2 values, one for x and one for y. Each of these will go from -1 to 1… The -1 on the Y axis, for example, represents pulling the stick down. I would map each of these values to a direction your character can shoot in (except for the -y value).