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
EasyWhen 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")
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Nodes and Scenes
1Your First Godot Game
What Is Godot?Ready Runs OncePrint in GodotThe Scene TreeSet a PositionMove a Node OncePractice on your own: Godot playground