0 votes

So I have been following a tutorial made by GDQuest called Make your first 2D game with Godot. I have made it far into the tutorial, but when it came to interrupting the jump, I put in the same code the GDQuest person put in, but I ended up getting the error "The assigned value doesn't have a set type: the variable type can't be inferred". I have re-watched that section of the tutorial multiple times, making sure I haven't missed anything I should have put in prior to the code, but I couldn't find anything, I even re-entered the code making sure I didn't make any typos, but there was no typo and the error still pops up. This is the code that's giving me some major trouble:

var is_jump_interrupted: = Input.is_action_just_released("jump") and velocity.y < 0.0
Godot version 3.3
in Engine by (32 points)

1 Answer

+2 votes
var is_jump_interrupted = Input.is_action_just_released("jump") and velocity.y < 0.0

Remove the colon. The colon tells Godot what kind of variable to expect, in this case it's not really useful.

var my_vector : Vector2

will make it so it gives you a warning if you do something like this later:

my_vector = 12
by (3,389 points)

That worked. Thank you so much!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.