London Market 45 · Capture a clear market store preview

Market Day London · Lesson 45 of 50 · Publishing · About 36 min

A useful screenshot shows Nia collecting a real order. The stalls and awnings should keep their proportions on the store page.

Watercolour of Nia carrying a basket past the produce, bread and flower stalls at a London street market.
What you’ll make Capture the running game and compare how a landscape screenshot fits in differently shaped frames.

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/44 when the lesson builds on prior work, or copy the checkpoints/45 folder to try this lesson on its own. Read the file names in the steps before editing.

Plan. Select three moments. → Capture. Use the running build. → Fit. Keep one scale factor. → Verify. Check slot and caption.
Plan → Capture → Fit → Verify
Godot checkpoint window for Capture a clear market store preview
From the running Godot checkpoint.

Build it step by step

Language and tools in this lesson Vector2i, float(), minf(), roundi(), aspect ratio, screenshot captions.

  1. Choose the story

    Play a complete shift and identify three moments to show. Pick an order at the collection counter, show a basket containing relevant items and capture the handover or result.

    Why it works A sequence of real moments gives the viewer an idea of what they will do.

  2. Capture the running build

    Capture the game with your approved device or Godot's game view for a course example. Close private notifications. Keep originals dated and named with the tested build.

    Why it works An unedited copy keeps the action available to check later.

  3. Compare two frames

    Import checkpoint 45, open main.gd and press F5. Try both buttons. Note how two display shapes take the same 1280 × 720 source.

    Why it works Source and frame proportions can differ. Fit uses one scale in both directions.

  4. Trace the math

    Inspect fit(). Width and height each offer a scaling ratio. Use the smaller so the whole image fits. Predict what happens when the frame's width gets narrower.

    var scale := minf(width_scale, height_scale)

    Why it works The larger value would push part of the source outside its frame.

  5. Verify the actual store slot

    Read the current screenshot requirements for your game's supported devices and orientation. For each planned store upload, check the final file size and proportions. Recapture or make a faithful crop when needed.

    Why it works A classroom fit does not qualify a gameplay image for every store slot.

  6. Write useful captions

    For the course page or portfolio, describe the action visible in each image. For example, Nia stands at the apple stall with a two-item request on the clipboard. Review the text against the actual screenshot.

    Why it works A meaningful caption helps readers understand what is happening without relying on the image alone.

Watch the values change

  1. Fit into a landscape frame The source and frame share the same ratio.
    What you see. The result fills the frame.
  2. Fit into a portrait frame Its width is the tighter limit.
    What you see. The game keeps its shape with unused vertical space.
  3. Prepare the upload Check store device class and size requirements.
    What you see. Choose a correctly captured final file.

Predict before you run Would making the stalls taller without making them wider keep the original proportions?

Reveal the answer

One scale for both dimensions keeps the shape. Use a crop or another capture when the slot has a different shape.

Complete checkpoint

The wide frame fills at 1600 × 900. The portrait frame fits a 900 × 506 image with 1094 pixels of unused height.

main.gd

extends Control

const Lab = preload("res://release_lab.gd")
const TITLE = "Capture a clear market store preview"
var ui: VBoxContainer

func _ready() -> void:
	ui = VBoxContainer.new()
	ui.set_script(Lab)
	add_child(ui)
	ui.start(TITLE)
	build()

const SOURCE := Vector2i(1280, 720)

func build() -> void:
	ui.say("Compare two example frames using a landscape source.")
	ui.option("Fit to 1600 by 900", fit.bind(Vector2i(1600, 900)))
	ui.option("Fit to 900 by 1600", fit.bind(Vector2i(900, 1600)))

func fit(frame: Vector2i) -> void:
	if frame.x < 1 or frame.y < 1:
		ui.say("Choose a positive width and height.")
		return
	var width_scale := float(frame.x) / SOURCE.x
	var height_scale := float(frame.y) / SOURCE.y
	var scale := minf(width_scale, height_scale)
	var result := Vector2i(roundi(SOURCE.x * scale), roundi(SOURCE.y * scale))
	var spare := frame - result
	ui.say("Game image: %d × %d. Unused space: %d across and %d high." % [result.x, result.y, spare.x, spare.y])

release_lab.gd

extends VBoxContainer

var output: Label

func start(title_text: String) -> void:
	set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
	offset_left = 32.0
	offset_top = 28.0
	offset_right = -32.0
	offset_bottom = -28.0
	add_theme_constant_override("separation", 12)
	var background := ColorRect.new()
	background.color = Color("#20342e")
	background.mouse_filter = Control.MOUSE_FILTER_IGNORE
	get_parent().add_child(background)
	background.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
	get_parent().move_child(background, 0)
	var title := Label.new()
	title.text = title_text
	title.add_theme_font_size_override("font_size", 32)
	title.add_theme_color_override("font_color", Color("#f3c991"))
	add_child(title)
	output = Label.new()
	output.custom_minimum_size.y = 151.0
	output.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
	output.add_theme_font_size_override("font_size", 19)
	add_child(output)

func say(message: String) -> void:
	output.text = message

func option(label: String, command: Callable) -> void:
	var button := Button.new()
	button.text = label
	button.custom_minimum_size.y = 46.0
	button.add_theme_font_size_override("font_size", 19)
	button.pressed.connect(command)
	add_child(button)

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
  1. extends ControlStarts with Godot's Control type. This script gets the abilities of that type and adds the game's own rules.
  2. const Lab = preload("res://release_lab.gd")Creates a constant named Lab. The expression prepares a resource at a fixed project path when the script is loaded.
  3. const TITLE = "Capture a clear market store preview"Creates a constant named TITLE. The expression uses the text inside the quotes.
  4. var ui: VBoxContainerDeclares ui for later use. A colon followed by a type says which kind of value belongs here.
  5. func _ready() -> void:Godot calls this once after the scene and its children are ready. Use it to set up the room and connect controls.
  6. ui = VBoxContainer.new()Stores the new value in ui. The expression creates a new VBoxContainer object.
  7. ui.set_script(Lab)Calls ui.set_script with the values in its parentheses.
  8. add_child(ui)Adds the new node to the scene tree so that Godot can run and draw it.
  9. ui.start(TITLE)Calls ui.start with the values in its parentheses.
  10. build()Calls build with the values in its parentheses.
  11. const SOURCE := Vector2i(1280, 720)Creates a constant named SOURCE. The expression packs whole-number x and y into one grid position. Godot infers the type from the first value.
  12. func build() -> void:Defines build, a reusable set of instructions. Parameters between the parentheses receive inputs. A return type after the arrow tells you which kind of result to expect.
  13. ui.say("Compare two example frames using a landscape source.")Calls ui.say with the values in its parentheses.
  14. ui.option("Fit to 1600 by 900", fit.bind(Vector2i(1600, 900)))Calls ui.option with the values in its parentheses.
  15. ui.option("Fit to 900 by 1600", fit.bind(Vector2i(900, 1600)))Calls ui.option with the values in its parentheses.
  16. func fit(frame: Vector2i) -> void:Defines fit, a reusable set of instructions. Parameters between the parentheses receive inputs. A return type after the arrow tells you which kind of result to expect.
  17. if frame.x < 1 or frame.y < 1:Checks frame.x < 1 or frame.y < 1. The indented instructions below run only if this test passes.
  18. ui.say("Choose a positive width and height.")Calls ui.say with the values in its parentheses.
  19. returnFinishes the function right here. Any later instructions in this function are skipped.
  20. var width_scale := float(frame.x) / SOURCE.xCreates a variable named width_scale. The expression converts a suitable value to a number that can include a fractional part. Godot infers the type from the first value.
  21. var height_scale := float(frame.y) / SOURCE.yCreates a variable named height_scale. The expression converts a suitable value to a number that can include a fractional part. Godot infers the type from the first value.
  22. var scale := minf(width_scale, height_scale)Creates a variable named scale. The expression calls minf with the values in its parentheses. Godot infers the type from the first value.
  23. var result := Vector2i(roundi(SOURCE.x * scale), roundi(SOURCE.y * scale))Creates a variable named result. The expression packs whole-number x and y into one grid position. Godot infers the type from the first value.
  24. var spare := frame - resultCreates a variable named spare. The expression calculates a new value from the expressions on either side of the operator. Godot infers the type from the first value.
  25. ui.say("Game image: %d × %d. Unused space: %d across and %d high." % [result.x, result.y, spare.x, spare.y])Calls ui.say with the values in its parentheses.
Read release_lab.gd line by line
  1. extends VBoxContainerStarts with Godot's VBoxContainer type. This script gets the abilities of that type and adds the game's own rules.
  2. var output: LabelDeclares output for later use. A colon followed by a type says which kind of value belongs here.
  3. func start(title_text: String) -> void:Defines start, a reusable set of instructions. Parameters between the parentheses receive inputs. A return type after the arrow tells you which kind of result to expect.
  4. set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)Positions this Control relative to the bounds of its parent.
  5. offset_left = 32.0Stores the new value in offset_left. The expression reads 32.0.
  6. offset_top = 28.0Stores the new value in offset_top. The expression reads 28.0.
  7. offset_right = -32.0Stores the new value in offset_right. The expression reads -32.0.
  8. offset_bottom = -28.0Stores the new value in offset_bottom. The expression reads -28.0.
  9. add_theme_constant_override("separation", 12)Calls add_theme_constant_override with the values in its parentheses.
  10. var background := ColorRect.new()Creates a variable named background. The expression creates a new ColorRect object. Godot infers the type from the first value.
  11. background.color = Color("#20342e")Stores the new value in background.color. The expression builds a colour from these values.
  12. background.mouse_filter = Control.MOUSE_FILTER_IGNOREUpdates background.mouse_filter, which controls how this control participates in pointer and touch input. The expression reads Control.MOUSE_FILTER_IGNORE.
  13. get_parent().add_child(background)Calls get_parent with the values in its parentheses.
  14. background.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)Positions this Control relative to the bounds of its parent.
  15. get_parent().move_child(background, 0)Calls get_parent with the values in its parentheses.
  16. var title := Label.new()Creates a variable named title. The expression creates a new Label object. Godot infers the type from the first value.
  17. title.text = title_textUpdates title.text, which controls the words a player sees. The expression reads title_text.
  18. title.add_theme_font_size_override("font_size", 32)Calls title.add_theme_font_size_override with the values in its parentheses.
  19. title.add_theme_color_override("font_color", Color("#f3c991"))Calls title.add_theme_color_override with the values in its parentheses.
  20. add_child(title)Adds the new node to the scene tree so that Godot can run and draw it.
  21. output = Label.new()Stores the new value in output. The expression creates a new Label object.
  22. output.custom_minimum_size.y = 151.0Stores the new value in output.custom_minimum_size.y. The expression reads 151.0.
  23. output.autowrap_mode = TextServer.AUTOWRAP_WORD_SMARTStores the new value in output.autowrap_mode. The expression reads TextServer.AUTOWRAP_WORD_SMART.
  24. output.add_theme_font_size_override("font_size", 19)Calls output.add_theme_font_size_override with the values in its parentheses.
  25. add_child(output)Adds the new node to the scene tree so that Godot can run and draw it.
  26. func say(message: String) -> void:Defines say, a reusable set of instructions. Parameters between the parentheses receive inputs. A return type after the arrow tells you which kind of result to expect.
  27. output.text = messageUpdates output.text, which controls the words a player sees. The expression reads message.
  28. func option(label: String, command: Callable) -> void:Defines option, a reusable set of instructions. Parameters between the parentheses receive inputs. A return type after the arrow tells you which kind of result to expect.
  29. var button := Button.new()Creates a variable named button. The expression creates a new Button object. Godot infers the type from the first value.
  30. button.text = labelUpdates button.text, which controls the words a player sees. The expression reads label.
  31. button.custom_minimum_size.y = 46.0Stores the new value in button.custom_minimum_size.y. The expression reads 46.0.
  32. button.add_theme_font_size_override("font_size", 19)Calls button.add_theme_font_size_override with the values in its parentheses.
  33. button.pressed.connect(command)Links a signal to the function that should run when the event happens.
  34. add_child(button)Adds the new node to the scene tree so that Godot can run and draw it.

Find and fix a bug

If the basket and stall signs look stretched, compare the source's ratio to the edited copy and start from the original.

Try a change

Ages 10–12. Choose and caption three screenshots. Ages 13–16. Calculate a fit and decide what a crop would remove.

Official instructions