Menu
CoddyTech

Print in Godot

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

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

Make the robot say where it stands.

  1. In _ready(), give print("I am at ") a second value after a comma: position.
  2. Use position itself, not the numbers.

Press Play: the Console shows I am at (320.0, 180.0). Then Check.

Try it yourself

extends Node2D

func _ready():
	print("I am at ")

All lessons in Nodes and Scenes

Practice on your own: Godot playground