I am trying to code the interrupted jump as part of the 'Make your first 2D game with Godot'. I am getting an error that says 'the assigned value doesnt have a set type: the variable type cannot be inferred" for the line where the is_jump_interrupted variable is declared.Can anyone help me?
var is_jump_interrupted: = Input.is_action_just_released("jump") and velocity.y > 0.0
You can fix the error by adding the type `bool` between the : and the = sign.
var is_jump_interrupted: bool = #...
The ":=" operator tells the GDScript compiler to infer (figure out) the type of the expression on the right. Normally, it should see it's "bool", but GDScript's type checker has some limitations in Godot 3.2.
In particular, depending on the version you use, some of those errors pop up.
Whenever that's the case, you just need to specify the variable's intended type, like above.
Hopefully, Godot 4 and the rewrite of the GDScript compiler should bring improvements in that area.
Thank you so much, it worked!