Hello. I'm new to Godot, and am basically clueless despite some experience in GameMaker Studio. I'm currently doing the Your First 2D Game Tutorial documented here:
https://docs.godotengine.org/en/stable/getting_started/first_2d_game/03.coding_the_player.html
It says it is up to date for Godot 4.1, but maybe that's not entirely true. I'm specifically having trouble with this step:

if velocity.x != 0:
    $AnimatedSprite2D.animation = "walk"
    $AnimatedSprite2D.flip_v = false
    # See the note below about boolean assignment.
    $AnimatedSprite2D.flip_h = velocity.x < 0
elif velocity.y != 0:
    $AnimatedSprite2D.animation = "up"
    $AnimatedSprite2D.flip_v = velocity.y > 0

Minus the comment, I've tried using this exact same code, but I am greeted with this error.

E 0:00:08:0537   Player.gd:27 @ _process(): Node not found: "AnimatedSprite2d" (relative to "/root/Player").
  <C++ Error>    Method/function failed. Returning: nullptr
  <C++ Source>   scene/main/node.cpp:1620 @ get_node()
  <Stack Trace>  Player.gd:27 @ _process()

I've noticed that the error is mentioning C++, but I've not used C++ for any of the scripting. This is all plainly the GDScript examples. The nodes are the correct ones, the AnimatedSprite2D and CollisionShape2D, and are parented to the Player Area2D node.

This is what I'm looking at right now:

Is this tutorial still outdated and some syntax is wrong, or have I made a rookie mistake?

  • You a capital "D" in the name and a small"d" in the call. AnimatedSprite2"d"