What you'll learn in this section
- Create a Script in Godot Engine
- Learn how to print a "Text"
- The difference between _ready and _process
Make a 2D Scene
Click 2D scene button on scene window to create a new 2D scene.
Rename the Node
Change the name to "Player". You can rename by double click or pressing F2.
Adding Script to the Node
Click add script button to add new script to the node.
Attach Node Script Setting
The popup will shown. You can choose the place to save the file by set the path setting.
let's put it on res://player.gd.
Print Hello Godot!
Let's use the print function to print a text to the console output. Type print("Hello Godot").
Run the Game
You can test the code by clicking the play button on the top left corner. The blank game will run and the text will be printed on the output panel.
Output Console
Congratulation, you're a game programmer now! Output window is a tool to debug your game.
The Difference Between _ready and _process
Let's debug our code to see the difference between _ready() and _process() function. You can use print function to see the difference between this two function.
Debug the Game
This is the power of print function. We know that _ready function excecuted once and _process function excecuted per frame by printing a text to output panel.