I am using Godot 3.2.1 and I am making a turret scene, which rotates and shoots when it's pointing at a player. rotation
is a property of Area2D
and target_dir
is the value of rotation which points at the player. I want the turret to shoot when these values are equal to each other plus-minus 0.1 uncertainty
if target_dir - 0.1 < rotation < target_dir + 0.1: # this line has error
print("bang!!!")
if can_shoot:
shoot()
The application fails immediately after running it. When I printed position
and target_dir
they were both floats, though the error states
Invalid operands 'bool' and 'float' in operator '<'.