Is there a better way to do a slash with the mouse?

I have a game where the mouse does various things to attack enemies on screen.

If you are wondering, it’s a 2.5D game. The enemies are in 3D space and the mouse and it’s animations are 2D.

I want a slash animation that goes between the mouse initial click position to the release position.

Since it’s in 2D space, I know their positions in (x, y) and can therefore use trigonometry to set the angle of my animation with tangent (sine and cosine work too) but I need to figure out where the 2nd point is in relation to the 1st.

func _physics_process(delta):
    ...
    if (x1 < x2 and y1 < y2) or (x1 > x2 and y1 > y2):
        ang -= a
    else:
        ang += a
    if y1 < y2:
        ang += 180
    elif y1 == y2:
        if x1 < x2:
            ang += 90
        else:
            ang -= 90
    ...

Then the scale and position are done with more calculations.

Here’s a picture if you’re lost:

px is pixel size of the sprite. So, if Z=30 and px=30 then the scale should be 1, if Z=60 then it should be 2, etc.

The position is centered around the middle and all you have to do is make a smaller triangle to get the mid point or any other point really. This could also be used to check if there are enemies in the slash but only in 2D (there’s probably a better way anyway).

IN THEORY this should work (- some specific scenarios). But, I think there’s probably a better way of doing this that I don’t know about, that’s why I’m asking if anyone has better Ideas or knowledge about this.

Your description of the problem is not clear enough.

I’m no expert, but it might be simpler to use Input.get_axis()for finding the directional quadrant