Hi all,
Can anybody tell me why no matter how I change the plusses and minuses around, My car will still steer Left when I press right arrow and vice versa.
player_direction refers to the direction the car is facing
player_steer is the steering input amount.
select controller_input
case 0:
player_speed = player_speed + ((GetRawKeyState(32) * 0.002)) - 0.001
if player_speed > 2 then player_speed = 0.2
if player_speed < 0 then player_speed = 0
if GetRawKeyState(37) = 1
player_steer = player_steer + 2
endif
if GetRawKeyState(39) = 1
player_steer = player_steer - 2
endif
if player_steer > 50 then player_steer = 50
if player_steer < -50 then player_steer = -50
if player_steer > 0 then player_steer = player_steer - 1
if player_steer < 0 then player_steer = player_steer + 1
player_direction = player_direction - player_steer
player_x = player_x + Cos(player_direction)*player_speed
player_z = player_z - Sin(player_direction)*player_speed
SetObjectPosition(301,player_x,0.5,player_z)
SetObjectRotation(301,0,player_direction,0)
SetCameraPosition(1,player_x,player_y + 2,player_z)
SetCameraLookAt(1,player_x + Cos(player_direction),player_y + 1.25,player_z - Sin(player_direction),1)
endcase
case 1:
endcase
case 2:
endcase
endselect
I have been on it for an hour now.
Thank you for your help.
Nick