Menu
CoddyTech

Set a Position

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

A node's position is a Vector2: two numbers, x and y. x counts pixels to the right. y counts pixels down. The top left corner of the game is (0, 0), and this game is 640 pixels wide and 360 tall.

Set a position in _ready() to choose where a node starts:

func _ready():
	position = Vector2(500, 100)

That puts the robot near the top right. A bigger y means lower on the screen.

challenge icon

Challenge

Easy

Make the robot start at x = 100, y = 250, on the left just above the floor.

Try it yourself

extends Node2D

func _ready():
	pass
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