You should look into joystick curves:
For the code you are showing, that’s not a good way of doing drive control.