Menu
CoddyTech

Ready Runs Once

Part of the Nodes and Scenes section of Coddy's Godot journey. Lesson 2 of 28.

Godot calls _ready() once for each node, when the node joins the game. Use it for what a node does when it appears, like setting its place or printing a greeting.

Lines inside a function run from top to bottom. These two print() calls write two lines in the Console, in this order:

func _ready():
	print("First")
	print("Second")

Every line inside a function starts with a tab (the Tab key). The tab tells Godot the line belongs to the function. A line with no tab is outside it, and Godot stops with an error such as Unexpected identifier "print" in class body.

challenge icon

Challenge

Easy

Make the robot print two lines when the game starts.

  1. Keep print("Robot online") as the first line of _ready().
  2. Under it, add a second print() with words of your own, for example Systems ready. Start it with a tab.

Press Play: the Console shows Robot online, then your line. Then Check.

Try it yourself

extends Node2D

func _ready():
	print("Robot online")

All lessons in Nodes and Scenes

Practice on your own: Godot playground