Topic was automatically imported from the old Question2Answer platform.
Asked By
Ackro
I want to learn godot as a game engine and i starded follow gdquest tutorial and i get this thing i don’t know how to call it bc isn’t a error pls can anyoane help me?
The error is saying that the assignment of the value can’t be done because the thing on the left-side of the assignment doesn’t have the desired property. That is, some variable doesn’t have the “.y” property. The problem could be with this line:
_velocity.y += gravity * _delta
The _velocity variable (in this case) appears to be a floating point number rather than a vector (a vector, BTW, does have the “.y” property).
If that’s not the error, then this line may be at fault:
move_and_slide() returns a Vector2, your _velocity variable should always be a Vector2. In your version of code you were assigning your _velocity variable to the y component (just a float or floating point number) of the Vector2 returned by the move_and_slide() function. Then on the next _physics_process() call
_velocity.y += gravity * _delta
failed because a float doesn’t have a y component, it’s just a number, thus giving you the error.