I was just wondering about this line:
var player_has_won: float = timer.time_left > 0.0
Wouldn't this return true or false rather than a float number?
Thanks for the help!
In connection to this issue, I've tried the following line of code:
var player_has_won := timer.time_left > 0.0
Imagining that it would infer the bool type for the player_has_won variable.
But instead, I got this error:
built-in:43 - Parse Error: The assigned value doesn't have a set type; the variable type can't be inferred.
Does it mean Godot doesn't return a bool for comparison operators e.g. the > above?
Godot does return a boolean for these expressions but this may be a type bug in the GDScript parser in the version of Godot you are using. It should infer the type properly.
If you don't have the latest stable version of Godot, then I invite you to download Godot 3.5 stable.
If it's happening with Godot 3.5, then you can add bool after the :.