How to simplify the code that checks if the joystick is near the center

Rather than checking both the positive and negative possibilities separately, we can just compare the absolute value of the joystick position.
A little math can help simplify your code. Learn to use it well.