Menu
CoddyTech

Print in Godot

Part of the Nodes and Scenes section of Coddy's Godot journey. Lesson 3 of 27.

print() can take several values, separated by commas. It writes them on one line, with nothing in between:

print("Lives: ", 3)

That prints Lives: 3. The space after the colon is inside the quotes, so it is printed too.

position is where a node stands. Printing it shows two numbers, how far right and how far down:

print(position)

For the robot this prints (320.0, 180.0). Printing values shows you what your game is doing.

challenge icon

Challenge

Easy

When the game starts, make the robot print where it is, as I am at (320.0, 180.0). Use position, not the numbers.

Try it yourself

extends Node2D

func _ready():
	print("I am at")
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Nodes and Scenes

Practice on your own: Godot playground