Gamepad rotation error

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Dudedude123

Im making the FPS rotation control for the gamepad


	rotation.x = Input.is_action_just_pressed("turn_left") - Input.is_action_just_pressed("turn_right")
	rotation.y = Input.is_action_just_pressed("look_up") - Input.is_action_just_pressed("look_down")

I keep getting this error
Parse Error: Invalid operand types (“bool” and “bool”) to operator “-”.

:bust_in_silhouette: Reply From: jgodfrey

You’re getting the error because is_action_just_pressed() returns a bool (so, true or false). And, since it’s not possible to subtract one bool from another, you get the error you mentioned. Maybe you’re looking for something like:

rotation.x = Input.get_action_strength("turn_left") - Input.get_action_strength("turn_right")

… or …

rotation.x = get_axis("turn_left", "turn_right")