Take a look at range_lerp()
. That'll map a given value within some input range to a corresponding value within some output range.
https://docs.godotengine.org/en/stable/classes/[email protected]#class-gdscript-method-range-lerp
I'm not sure I follow your example exactly, but it seems that you're trying to map a value in the range of -2000 to 2000 to the range of 0 to 360. Here's an example of that:
print(range_lerp(2000, -2000, 2000, 0, 360))
print(range_lerp(0, -2000, 2000, 0, 360))
print(range_lerp(-1000, -2000, 2000, 0, 360))
Output:
360
180
90