Expected indented block after "if" block

Hello everyone. I wanted to show an error I get in scripting my character’s movement. I am following a youtube video(which I will link) in order to learn. I can’t figure out how to fix line 20.
Thanks in advance for the answers

2D Platformer Quick Start Guide ~ Godot 4 GameDev Tutorial for Beginners (youtube.com)

Add one more tab to the marked line. A block after if must be indented.


i tried but it doesn’t work

It must work. Move the cursor to the line 20 just before velocity.y. Press the tab key. Voilà!


I am really stupid, I apologize and thank you very much again for the solution

1 Like

No worries. Good luck with your game.

1 Like

I don’t know why but it doesn’t recognize my Input Action Up and Down

It’s get_vector not get_axis, see the error message

1 Like

thank you

I can’t get the RUN animation to start when my character moves. What am I doing wrong? in the video I am following it works

Do you get any error messages when you play the game and move the character?

No, there is not any error messages

In the debugger section, i got this entry: editor/editor_node.cpp:8185 - Condition “plugins_list.has(p_plugin)” is true

Well, that makes it harder to figure out. Some things you can investigate:

  • Try printing the values of animation_locked and direction.x to see if both of those variables contain what you expect.
  • Take a look at your sprite animations and check that the "run" animation is named exactly that (including being all lower case).

Does the idle animation work? Does it keep playing when the character moves?

1 Like

thank you very much for your patience, I solved it, it was wrong lower case of “Run”

This stuff happens. Best advice I can give is to stick to naming all animations, files, input action names etc. in lower case (or some other convention, the main thing is to be systematic with it) :wink:

1 Like