godotengine / godot-docs

Godot Engine official documentation
https://docs.godotengine.org
Other
3.81k stars 3.09k forks source link

"Your first 2D game" tutorial may have some instructions that don't work #9517

Closed r-owen closed 1 month ago

r-owen commented 3 months ago

Your Godot version:

4.2.2.stable.official

Issue description:

I can't get through "The main game scene" (though it may be user error). I ran into 4 problems, though 2 are likely the same underlying issue:

1: When I create Node (named Main) it then says to do this: “Click the Instance button (represented by a chain link icon) and select your saved player.tscn.”. When I try I get this error:

Cannot instantiate the scene ‘res://player.tscn' because the current scene exists within one of its nodes.”

2: The Player node is created first, so it is the root node. But on this page, after Main node is created the directions seem to think that it is the new root node. (I did figure out how to change the root to the Main node, but that caused other problems so I backed up)

3: mob.tscn does not exist (the only scene file is player.tscn), even though the Mob node exists. The file is assumed to exist in these directions:

Drag mob.tscn from the "FileSystem" dock and drop it in the Mob Scene property

I tried saving it explicitly using Save Branch as Scene but I have no idea if that's correct.

4: main.tscn does not exist, but again is assumed to do so here:

Let's also assign Main as our "Main Scene" - the one that runs automatically when the game launches. Press the "Play" button and select main.tscn when prompted.

I was not able to figure out how to proceed any further.

5: on an earlier page I was told to drag the animation images onto the area for them. But dragging them did not work (the green + appeared but no images were shown afterwards). I worked around this by using the folder toolbar icon to select them.

This also worked around a puzzle: each image shows up twice in the assets folder: one as a .png and one as a .png.import. I had no idea which one to drag, so I tried either and both, but nothing worked, However, fortunately the file dialog only showed one of these two, so no confusion.

URL to the documentation page:

https://docs.godotengine.org/en/stable/getting_started/first_2d_game/05.the_main_game_scene.html

If you know how to fix the issue you are reporting please consider opening a pull request. We provide a tutorial on using git here: https://docs.godotengine.org/en/stable/community/contributing/pr_workflow.html, writing documentation at https://docs.godotengine.org/en/stable/community/contributing/docs_writing_guidelines.html and contributing to the class reference here: https://docs.godotengine.org/en/stable/community/contributing/updating_the_class_reference.html

AThousandShips commented 3 months ago

2: You should create a new scene, as per the instructions:

Create a new scene and add a Node named Main.

3: You should have already created the mob scene in this step https://docs.godotengine.org/en/stable/getting_started/first_2d_game/04.creating_the_enemy.html

4: We could make it clearer that you should save the main scene as the default name it is given

r-owen commented 3 months ago

Good catch. I was creating nodes instead of scenes. My bad. That leaves item 5, which I reproduced again. Further information: if I drag images into the animations area a green + is shown, and the images are copied from where I dragged them into the root directory of my project, but do not appear in the animations area. I had the animations in an "art" subfolder of the main project folder, so copying was unnecessary. By contrast, if I use the open file icon, the images are shown and not duplicated, which is perfect.

I probably screwed something up on the 2nd round, as well, because the mobs were never shown. I guessed that they were being spawned off-screen, and so vanished immediately (and printing the mob position seems to confirm that -- coordinates of 1000 or so). I can't quite figure out how the Path2D in the Main scene is supposed to know about the window size, since a Node has no such knowledge. I hacked around it by changing Main from a Node to a Node2D (so I could ask it the window size), and constraining the mob spawn point to the window. Note that changing the type of Main crashed the editor the first time, but I tried again and it worked, though for whatever reason I had to re-establish the signal links to the Main script. So...lots of user error, and some remaining puzzles.

AThousandShips commented 3 months ago

For the 5th item that's something to look into

But for the rest of your problems I'd suggest asking in the forums first to get some tips and guidance

Piralein commented 1 month ago

I just checked the complete tutorial, 5. works perfectly fine. Are you sure you tried to drag&drop the images into the SpritesFrames Editor?

What exactly do you mean by green + is shown? Could you attach a screenshot of it, please?

r-owen commented 1 month ago

Since a stable version of 4.3 is out, I suggest we drop this. The drag and drop bug may have been fixed, and if it's not, I'll file a ticket against the engine.

Piralein commented 1 month ago

alright, closed. Lets hope it all works now!