Market Day London · Lesson 03 of 50 · Beginner · About 23 min
Nia has more than one announcement to make. Instead of rewriting the whole sign, she sends the market board a short update.

Download the projects from the course page. In Godot’s Project Manager, choose Import, select project.godot, and use Run Project (F5). Start from checkpoints/02 when the lesson builds on prior work, or copy the checkpoints/03 folder to try this lesson on its own. Read the file names in the steps before editing.


Build it step by step
Language and tools in this lesson func, parameter, String, call, void, label refresh, Output.
-
Follow the boot order
Import Lesson 3 and open main.gd. In _ready, find the call made just after the two labels are added.
post_board("Stalls open")Why it works The screen exists before the call tries to change it. The call passes a different short message each time.
-
Find the named function
Scroll to post_board below _ready. Match the call name to the name in its func declaration.
func post_board(message: String) -> void:Why it works A function is a named group of instructions. Only a call runs this named group.
-
Identify the input
Read message: String and trace which argument enters message on the first call.
func post_board(message: String) -> void:Why it works String says the input is text. The arrow and void say that this function updates the sign without handing back an answer.
-
See the live read
Trace the signs formatted in post_board. Compare each placeholder with the matching field or parameter.
board.text = "%s • %s • Baskets waiting: %d" % [GUIDE, message, orders_waiting]Why it works The sign reads the current order count every time. You never need to update two separate versions of the sentence.
-
Compare the two calls
Press F5 and read the final notice. Stop and compare it with the two Output lines in order.
post_board("First basket collected")Why it works The second call happens after one practice order is collected. It has different words and a different count.
-
Change an announcement
Edit only the quoted words in the second call to Rain later today. Run again and look for the new words on the sign.
post_board("First basket collected")Why it works An argument fills the parameter for one call. The text in the first call stays the same.
Watch the values change
-
Call post_board with Stalls open. message is Stalls open and the count is 3.
What you see. Output contains the opening notice. -
Subtract one. The shared count becomes 2.
What you see. The code is ready to refresh the sign. -
Call post_board again. message is First basket collected.
What you see. The sign and the latest Output show 2 waiting.
Predict before you run What happens if you add a third call with post_board("Market closes soon") after the second one?
Reveal the answer
The market sign shows Market closes soon. Its count stays 2 since the new call does not change orders_waiting.
Complete checkpoint
The final board says First basket collected and 2 baskets waiting. Output shows both calls in the order they ran.
main.gd
extends Control
const NIGHT := Color("#0d2335")
const PANEL := Color("#17374b")
const CREAM := Color("#fff4da")
const MINT := Color("#9ce4ce")
const GOLD := Color("#ffd789")
var board: Label
const GUIDE := "Nia"
var orders_waiting: int = 3
func _ready() -> void:
var title := Label.new()
title.text = "Market Day London"
title.position = Vector2(42, 34)
title.add_theme_font_size_override("font_size", 34)
title.modulate = CREAM
add_child(title)
board = Label.new()
board.position = Vector2(45, 88)
board.add_theme_font_size_override("font_size", 22)
board.modulate = MINT
add_child(board)
post_board("Stalls open")
orders_waiting -= 1
post_board("First basket collected")
func _draw() -> void:
draw_rect(Rect2(Vector2.ZERO, get_viewport_rect().size), NIGHT)
draw_rect(Rect2(32, 120, 431, 316), PANEL)
draw_rect(Rect2(487, 120, 437, 316), PANEL)
func post_board(message: String) -> void:
board.text = "%s • %s • Baskets waiting: %d" % [GUIDE, message, orders_waiting]
print(board.text)
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 ControlAttach these screen-building instructions to a Godot Control. That gives the script positions, children and input events. -
const NIGHT := Color("#0d2335")Use this dark ink colour behind the market. The fixed colour is also used for lettering on the mint marker and brighter signs. -
const PANEL := Color("#17374b")Use one lighter shade to group the map and controls against the dark background. -
const CREAM := Color("#fff4da")Keep the title and labels light enough to read against dark panels. -
const MINT := Color("#9ce4ce")Use this accent to highlight the status label and Nia’s marker. -
const GOLD := Color("#ffd789")Mark utility labels and the collection point with a pale yellow that stands apart from the paving. -
var board: LabelSave the opening label so later methods can change it without needing to create a new one. -
const GUIDE := "Nia"Store the character name once, so announcements always identify Nia by the same name. -
var orders_waiting: int = 3Hold three practice collection baskets as a whole number. This number changes during the sample run. -
func _ready() -> void:Godot calls this once when the Market scene is ready to create the title, notice and controls. -
var title := Label.new()Create an unattached Label for the permanent title. It becomes visible when it is added to the scene. -
title.text = "Market Day London"Put the game name into the title label. The title stays fixed while smaller words underneath change. -
title.position = Vector2(42, 34)Leave a margin of 42 pixels from the left and 34 from the top. -
title.add_theme_font_size_override("font_size", 34)Set this title to a larger local font size. The rest of the labels can keep different sizes. -
title.modulate = CREAMSet the title’s drawing colour to the pale cream chosen above. -
add_child(title)Add the title to the running scene so Godot draws and maintains it. -
board = Label.new()Create the changing notice label and store it in the field used by other methods. -
board.position = Vector2(45, 88)Position the variable status words underneath the game name. -
board.add_theme_font_size_override("font_size", 22)Set a smaller font for status messages, which can be longer than the title. -
board.modulate = MINTTint the notice mint so it stands out as the changing information. -
add_child(board)Attach the notice beneath the title so the player sees the current message. -
post_board("Stalls open")Ask the notice method to format a message before the practice collection. -
orders_waiting -= 1Read the number, deduct one practice collection and write the resulting value back. This does not change an older string already on screen. -
post_board("First basket collected")Use the same notice method again after the basket count changes. -
func _draw() -> void:Paint this section when Godot refreshes the Control. Draw the background first and the frontmost details last. -
draw_rect(Rect2(Vector2.ZERO, get_viewport_rect().size), NIGHT)Fill the visible window so there is a consistent dark background behind the game panels. -
draw_rect(Rect2(32, 120, 431, 316), PANEL)Draw the dark rectangle under the tile map. -
draw_rect(Rect2(487, 120, 437, 316), PANEL)Draw an adjacent rectangle behind the controls and basket information. -
func post_board(message: String) -> void:Receive one short message and format it with the current basket count and guide name. -
board.text = "%s • %s • Baskets waiting: %d" % [GUIDE, message, orders_waiting]Fill the placeholders in order with Nia, the new notice words and the current order count. -
print(board.text)Send the current notice to Godot’s Output panel. This is a record developers can inspect independently of the game screen.
Find and fix a bug
If Godot cannot find the function, compare the spelling at the call and the declaration exactly. post_board needs the underscore.
Try a change
Ages 10–12 can add a third announcement. Ages 13–16 can add a second parameter for a short category such as Notice or Reminder.