sorry again if i upset you in some way.
No worries, you didn't! In fact: I'm sorry if it came across any different!
I read that was made by one of the creators of Godot
That's correct. Ariel Manzur is one of the project's founders and George Marques is the current maintainer of GDScript. I don't own their book, so I cannot check if they really state that one can use a move()
-method without declaring it first in Godot 3.X, but if they do then that's simply not true! Consider contacting either of them e.g on Twitter or Discord: I'm sure they will be glad to find out about the mistake!
So just out of curiosity what is the best mode to do the automove script?
In Godot 3.X there are now move_and_collide
(docs) and move_and_slide
(docs).
As you're multiplying the up-vector with delta
in your example, you should replace the call to move
with a call to move_and_collide
(and change the script to extend a KinematicBody2D instead of a Sprite) and everything should work fine.
move_and_slide
does the multiplication with delta
implicitly and is slightly more advanced as it includes a more refined collision response: where a character using move_and_collide
will just stop when colliding with an obstacle, it would slide along that obstacle when using move_and_slide
which is often useful.