0 votes

Hello, I would like to know how to print what i write? I would like to make a window with character name and make player to write his/hers name there, save it as variable or constant and display on every other game screens.

e.g.

There is a Box with text: "Choose Your Name"
and i click it and can write my character name. When I press "enter" it closed and save name. If I click again I can write diffrent name instead.

Can You tell me how to make it in GDScript in 2D window or send me a link to tutorial video?

asked Jan 13 in Engine by paseuda (14 points)

1 Answer

0 votes

You probably want to use Control nodes for that. There is a tutorial on the docs
about how to use them in general. In your specific case I believe you would want to use a TextEdit so the player can type.
After typing you are probably going to use a Button and connect it's button pressed signal to save the name and close the dialog, you can check the Title Screen tutorial in the docs for how to do that.
About where to save the name, it would probably go into a script at the top of your game tree so you don't lose it while changing scenes. I won't go into details here since it would be too long, but you can create a top level Node that is your game, which is responsible for the scene switching, title screen included, and maybe save states, and this node would also hold all the player information, including the name, because it is always there when the game is running.

answered Jan 13 by tastyshrimp (556 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.