Tiny Shelf Studio · Lesson 01 of 50 · Beginner · About 15 min
A shoebox, three tiny cartons and an empty shelf are enough to start a collectible display. Your first job is to make an opening sign.

Download the projects from the course page. In Godot’s Project Manager, choose Import, select project.godot, and use Run Project (F5). Start from the blank shelf project in checkpoints/start. Keep the checkpoint ZIP intact and make edits in an extracted working copy.


Build it step by step
Language and tools in this lesson Control, extends, func, _ready, strings, Label, print.
-
Open the starter scene
Extract the offline pack. In the Godot Project Manager, import the project.godot file from checkpoints/start. Open main.tscn and select its root Control.
extends ControlWhy it works A scene holds nodes. Control is a node made for on-screen interfaces. Leave the starter copy safe so you can start again.
-
Name the sign
Open main.gd in Script. Add the bulletin declaration below the starting line. The complete checkpoint already includes a display palette and drawing helpers. Copy those helpers from the Complete checkpoint if you start with the blank scene.
var bulletin: LabelWhy it works var reserves a name for a value. The colon and Label describe which kind of node bulletin will hold.
-
Start when the scene is ready
Create the _ready function. In its indented block, make a title and an empty bulletin with make_label.
func _ready() -> void: make_label("TINY SHELF STUDIO", Vector2(49, 30), 35, NAVY) bulletin = make_label("", Vector2(51, 81), 21, NAVY)Why it works Godot calls _ready once when the node enters a ready scene. Indentation tells Godot which lines belong to that function.
-
Put a string on the screen
Copy the line assigning the bulletin text under its creation in _ready. Keep the message between quote marks.
bulletin.text = "The display is open!"Why it works A quoted string is text. Assign it to the label's text property using one equals sign.
-
Check the message in Output
Place print on the next indented line and press F5. Check the bulletin in the game window and the Output panel in the editor.
print(bulletin.text)Why it works The parentheses hold the value sent to print. It receives the same text currently on the label.
-
Connect the sign to its helper
Find make_label in the complete script. Try changing only the 35 in the title call to 30 and run again.
func make_label(text: String, point: Vector2, font_size: int, ink: Color) -> Label: var label := Label.new() label.text = text label.position = point label.modulate = ink label.add_theme_font_size_override("font_size", font_size) add_child(label) return labelWhy it works The helper creates a Label, places it, then adds it to the scene. The returned Label is how _ready can update bulletin later. The size argument changes only the title call.
Watch the values change
-
Run the scene. Godot enters _ready once.
What you see. The title appears above the display. -
Assign the bulletin text. bulletin.text receives "The display is open!".
What you see. The message appears under the title. -
Read Output. print receives bulletin.text.
What you see. The same message appears in the editor.
Predict before you run If you change the text assignment but leave print alone, will Output still show the old message?
Reveal the answer
No. print reads the label's current text when that line runs. Both places show your new message.
Complete checkpoint
A cream display board with three sample cartons appears. The bulletin and Output both say The display is open!
main.gd
extends Control
const NAVY := Color("#18243d")
const PAPER := Color("#fff5e7")
const SHELF := Color("#302e4b")
const CREAM := Color("#fff2d3")
const PINK := Color("#f58a9d")
const MINT := Color("#b4edce")
const GOLD := Color("#ffd575")
var bulletin: Label
func _ready() -> void:
make_label("TINY SHELF STUDIO", Vector2(49, 30), 35, NAVY)
bulletin = make_label("", Vector2(51, 81), 21, NAVY)
bulletin.text = "The display is open!"
print(bulletin.text)
make_label("Your first sign", Vector2(598, 181), 26, NAVY)
make_label("Run the project and read Output.", Vector2(599, 226), 15, NAVY)
func make_label(text: String, point: Vector2, font_size: int, ink: Color) -> Label:
var label := Label.new()
label.text = text
label.position = point
label.modulate = ink
label.add_theme_font_size_override("font_size", font_size)
add_child(label)
return label
func _draw() -> void:
draw_rect(get_viewport_rect(), PAPER)
draw_rect(Rect2(48, 126, 502, 360), SHELF)
draw_rect(Rect2(577, 126, 334, 360), Color("#f1ded4"))
draw_rect(Rect2(48, 126, 8, 360), PINK)
print_on_shelf("TRAINING DISPLAY", Vector2(67, 153), 14, MINT)
print_on_shelf("DISPLAY WORKBENCH", Vector2(597, 155), 14, NAVY)
print_on_shelf("Quesbo Coding / Godot practice", Vector2(49, 520), 16, NAVY)
draw_rect(Rect2(78, 398, 443, 10), Color("#b98278"))
draw_rect(Rect2(93, 409, 423, 9), NAVY)
draw_rect(Rect2(140, 263, 74, 135), GOLD)
draw_rect(Rect2(148, 290, 59, 56), CREAM)
draw_circle(Vector2(178, 318), 17.0, Color("#e59646"))
draw_rect(Rect2(257, 220, 102, 178), PINK)
draw_rect(Rect2(267, 265, 82, 62), CREAM)
draw_circle(Vector2(309, 297), 20.0, Color("#8176a9"))
draw_rect(Rect2(405, 294, 72, 104), MINT)
draw_rect(Rect2(412, 314, 58, 44), CREAM)
draw_circle(Vector2(440, 335), 15.0, Color("#46876d"))
func print_on_shelf(text: String, point: Vector2, font_size: int, ink: Color) -> void:
draw_string(ThemeDB.fallback_font, point, text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, ink)
GDScript line by line
Follow the line numbers, including the indent at the start of each line. Find the code the game will run first, then look for the function that reacts when you tap or change something.
Read main.gd line by line
-
extends ControlBase this script on a Godot Control. It can assemble text and buttons, receive input and draw directly into the scene. -
const NAVY := Color("#18243d")Give headings and package shadows a shared dark ink. The six-digit colour is read from a hexadecimal string. -
const PAPER := Color("#fff5e7")Use this warm, light colour behind the shelf and on front labels. -
const SHELF := Color("#302e4b")Set the dark display board colour. A constant lets later drawings refer to it by name. -
const CREAM := Color("#fff2d3")Use a light ink for numbers and letters placed against the dark display. -
const PINK := Color("#f58a9d")Add a warm edge to the display. This colour does not decide whether a slot is occupied. -
const MINT := Color("#b4edce")Use a light green marker in the workbench styling. -
const GOLD := Color("#ffd575")Reserve a high-contrast yellow for the frame around the selected slot. -
var bulletin: LabelKeep a reference to the text node so other functions can edit its words. -
func _ready() -> void:Godot calls this when the Control enters the ready scene. Set up the initial title, labels and buttons here. -
make_label("TINY SHELF STUDIO", Vector2(49, 30), 35, NAVY)Put the studio name near the top-left corner. The title uses 35-pixel dark text on the light background. -
bulletin = make_label("", Vector2(51, 81), 21, NAVY)Create a second label and keep it in bulletin. You can set its text after placement. -
bulletin.text = "The display is open!"Assign the opening sentence to the text property of the existing Label node. -
print(bulletin.text)Read the current words on the bulletin and send those same words to Godot's Output panel. -
make_label("Your first sign", Vector2(598, 181), 26, NAVY)Give the workbench one explanatory caption at the requested pixel position. -
make_label("Run the project and read Output.", Vector2(599, 226), 15, NAVY)Give the workbench one explanatory caption at the requested pixel position. -
func make_label(text: String, point: Vector2, font_size: int, ink: Color) -> Label:Accept a string, a point, a font size and an ink colour. This helper returns the new Label so the caller can keep updating it. -
var label := Label.new()Create a Label object. It needs to be added to the running scene before it can appear. -
label.text = textPut the helper's text argument into the new Label. -
label.position = pointPosition the label using the x and y pixel coordinates passed into the helper. -
label.modulate = inkTint the label with the colour passed into this call. -
label.add_theme_font_size_override("font_size", font_size)Override the theme's size for just this label. -
add_child(label)Make Godot manage and draw the new Label as a child of the Control. -
return labelGive the caller the Label for later changes. -
func _draw() -> void:Godot calls this when the view requires drawing. Draw from the current selection and catalogue without changing the data. -
draw_rect(get_viewport_rect(), PAPER)Cover the entire view with the chosen light background. -
draw_rect(Rect2(48, 126, 502, 360), SHELF)Place the main dark panel under the shelf. The numbers are x, y, width and height. -
draw_rect(Rect2(577, 126, 334, 360), Color("#f1ded4"))Place a separate panel behind the tools and item card. -
draw_rect(Rect2(48, 126, 8, 360), PINK)Draw a thin edge along the display board. -
print_on_shelf("TRAINING DISPLAY", Vector2(67, 153), 14, MINT)Draw the display's section label using a mint colour on the dark panel. -
print_on_shelf("DISPLAY WORKBENCH", Vector2(597, 155), 14, NAVY)Draw a dark section label on the light workbench panel. -
print_on_shelf("Quesbo Coding / Godot practice", Vector2(49, 520), 16, NAVY)Add a quiet footer below both panels. -
draw_rect(Rect2(78, 398, 443, 10), Color("#b98278"))Draw one visible part of the display using its x, y, width and height, then fill it with the supplied colour. -
draw_rect(Rect2(93, 409, 423, 9), NAVY)Draw one visible part of the display using its x, y, width and height, then fill it with the supplied colour. -
draw_rect(Rect2(140, 263, 74, 135), GOLD)Draw one visible part of the display using its x, y, width and height, then fill it with the supplied colour. -
draw_rect(Rect2(148, 290, 59, 56), CREAM)Draw one visible part of the display using its x, y, width and height, then fill it with the supplied colour. -
draw_circle(Vector2(178, 318), 17.0, Color("#e59646"))Place a round motif on the small product label using a centre point, radius and colour. -
draw_rect(Rect2(257, 220, 102, 178), PINK)Draw one visible part of the display using its x, y, width and height, then fill it with the supplied colour. -
draw_rect(Rect2(267, 265, 82, 62), CREAM)Draw one visible part of the display using its x, y, width and height, then fill it with the supplied colour. -
draw_circle(Vector2(309, 297), 20.0, Color("#8176a9"))Place a round motif on the small product label using a centre point, radius and colour. -
draw_rect(Rect2(405, 294, 72, 104), MINT)Draw one visible part of the display using its x, y, width and height, then fill it with the supplied colour. -
draw_rect(Rect2(412, 314, 58, 44), CREAM)Draw one visible part of the display using its x, y, width and height, then fill it with the supplied colour. -
draw_circle(Vector2(440, 335), 15.0, Color("#46876d"))Place a round motif on the small product label using a centre point, radius and colour. -
func print_on_shelf(text: String, point: Vector2, font_size: int, ink: Color) -> void:Name the text, position, size and colour for a painted line of text. -
draw_string(ThemeDB.fallback_font, point, text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, ink)Use Godot's fallback font. point places the baseline of the text, which is where its letters sit.
Find and fix a bug
If Godot says a line is outside a function, check the indent after _ready. The indented code should align with the lines already inside the function.
Try a change
Write a greeting for your own display. Use fewer than 30 letters and spaces, then check it fits on screen.