Can you please help me with my basic 2D top down script?

Godot Version

4.7

Question

I am following this tutorial from Godot 4.2 but it is not working.

this is the tutorial: Micheal games “Make a Basic Top Down Character // E01 // Make a 2D Action & Adventure RPG in Godot 4”

right now, I am following the script to the exact, but the character is not moving. This is the tutorial script:

And this is mine:

Any response would be great

Neither one should move.

  1. CharacterBodies must call move_and_slide() to move, you can add this to the last line of your function
  2. you can get direction much better with var direction := Input.get_vector("left", "right", "up", "down")
  3. This code should be in _physics_process, not _process
  4. For top-down games you should set the “Motion Mode” property to “Floating” instead of grounded.

what do you mean by motion

mode

Why didn’t you follow the tutorial to the very end? You missed out the entire last section (after 24:00).

I watched that part, but the guy removed the move and slide. Plus even with move and slide, it still doesn’t work

There is some weird editing in that video. He takes it out, but then it actually comes back in again, if you look carefully just before he runs the game.

Did you try moving the other code into _physics_process() instead, as @gertkeno suggested?

If it isn’t working even with the move_and_slide(), it’s possible you missed one of the earlier steps, but hard to say which one. For e.g., confirm that you have entered the input mappings as shown earlier in the video.

can you add the move_and_slide(), and remove the * delta in calculating velocity

from the very end of the video, i can see that he removed the * delta
besides that, im pretty sure that move_and_slide() will already use the delta automatically, based in the docs

I will try right now