godot-docs icon indicating copy to clipboard operation
godot-docs copied to clipboard

The tutorial code error in the Godot introductory documentation causes the enemy animation to fail to play properly.

Open 598645026 opened this issue 10 months ago • 3 comments

In the "Getting Started - Your First 2D Game - Directory - Creating Enemies - Enemy Script" section of the code, the line $AnimatedSprite2D.animation = mob_types.pick_random() only randomly selects the enemy's movement state but does not play the enemy's animation. None of the subsequent code addresses this issue, which causes users following the documentation to end up with enemies that move along their paths but do not play animations. The above line of code should perhaps be changed to $AnimatedSprite2D.play(str(mob_types.pick_random())).

598645026 avatar Apr 27 '25 07:04 598645026

Additionally, when the game starts, the player character does not appear in the center of the screen. Perhaps the tutorial should mention resetting the player's position to the center of the screen?

598645026 avatar Apr 27 '25 07:04 598645026

Thanks for the report, this was fixed in March @ #10752, and I can see a working version in both the current latest and stable versions of the live docs.

jynus avatar Jun 02 '25 20:06 jynus

Regarding your second comment, I agree that it is never explicitly said to move the player near the center of the screen to its initial position. Due to the method it is suggested (instance button) it will appear by default at 0,0.

It would be nice to add a line adding your suggestion after instantiation.

jynus avatar Jun 02 '25 20:06 jynus