Mobile Game 48 · Plan a one-time paid game

Museum of Lost Lights · Lesson 48 of 50 · Publishing · About 30 min

Your first release is a small paid game with a short set of polished puzzles. Plan what the buyer gets and explain the price clearly.

A gouache painting of a Space Gallery with celestial exhibits, a midnight-blue floor and a domed ceiling.
What you’ll make Compare a few fictional prices and learn who sets the real store price and what the purchase unlocks.

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

Choose what ships. Every paid download gets the described content. → Test example prices. Use whole pence and fictional orders. → Set live pricing. The adult publisher configures the store account. → Write the listing. State what the buyer receives clearly.
Choose what ships → Test example prices → Set live pricing → Write the listing

Build it step by step

Language and tools in this lesson integer pence, multiplication, typed int, if expression, formatted strings, publisher responsibilities.

  1. Open the checkpoint in Godot

    Extract the course files. In Godot Project Manager, choose Import and point it to this lesson’s project.godot. Double-click main.gd in FileSystem to open the script. Press F6 to run the current scene once main.tscn is open, or F5 to run the project. Pick a practice price and change the number of example buyers. No shopping or real payments happen here.

    const UI = preload("res://lesson_ui.gd")

    Why it works This small project lets you see one release skill at a time. The finished Museum of Lost Lights is a second, independent project. Keep both projects in their own folders.

  2. Decide what the download includes

    On paper, write what comes with the buyer’s single purchase. For example: three galleries, twelve puzzles, an offline tutorial and progress that saves on the device. Prepare a separate note on how the publisher will handle support and updates.

    Why it works Keeping the release scope clear helps you finish the game and helps buyers understand what they receive.

  3. Track a price using whole pence

    Find price_pence near the top of the script. The example stores pounds as a whole number of pence. Set it to 249 in your copy and test two orders.

    var price_pence := 199

    Why it works A whole number makes this simple example easy to check: 249 pence means £2.49. No decimals are needed for counting pence.

  4. Calculate example gross sales

    Read the multiplication ahead of the label. Follow one fictional purchase from price_pence to subtotal. Change the sample order count and predict the next gross amount before clicking.

    var subtotal := price_pence * units

    Why it works Gross sales here means the total of the example prices before fees, taxes, refunds or other adjustments. It isn’t a forecast or payout calculator.

  5. Set a real price with the publisher

    The publisher can set pricing in the game’s store console. Apple’s Account Holder signs the Paid Apps Agreement and completes required business details. On Google Play the publisher sets up its payments profile and selects paid pricing in Play Console. Check regional price options and local requirements with the adult.

    Why it works The stores collect the app charge. This game design has no in-game shop or purchase code.

  6. Choose the release model before going live

    Use fictional prices for class practice. Before publishing, agree on free or paid release and the storefront territories with the adult. Google Play states that once an app has been offered for free, the same app cannot be changed to paid.

    Why it works Choosing the model before public release keeps the store setup consistent with what buyers are promised.

  7. Read the result, then apply it to your game

    Write one store sentence about price and what it includes. Put the payment and contract questions on the adult publisher’s checklist, along with ongoing support for buyers.

    Why it works The checkpoint shows what to look for. Your game’s real result comes from testing your own build, assets and settings.

Watch the values change

  1. Open price desk 199 pence and 1 sample order.
    What you see. The example gross amount is 199 pence.
  2. Add two sample orders 199 pence and 3 orders.
    What you see. The example gross amount is 597 pence.
  3. Choose 299 pence Three sample orders at 299 pence.
    What you see. The example gross amount becomes 897 pence.

Predict before you run At 250 pence each, what is the practice gross amount for four purchases?

Reveal the answer

1,000 pence, or £10 before fees, taxes and refunds. Multiplying 250 by 4 gives 1,000.

Complete checkpoint

The sample prices, order count and calculation update at once. The label always identifies the result as fictional gross sales.

main.gd

extends Control

const UI = preload("res://lesson_ui.gd")
var price_pence := 199
var units := 1
var summary: Label

func _ready() -> void:
	var column := UI.build(self, "Museum practice price desk", "Fictional prices and orders, for maths practice.")
	UI.button(column, "Try 199 pence", _choose_price.bind(199))
	UI.button(column, "Try 299 pence", _choose_price.bind(299))
	UI.button(column, "Add one sample order", _add_order)
	summary = UI.message(column, "")
	_render()

func _choose_price(pence: int) -> void:
	price_pence = pence
	_render()

func _add_order() -> void:
	units += 1
	_render()

func _render() -> void:
	var subtotal := price_pence * units
	summary.text = "%d pence × %d sample orders = %d pence gross before any adjustments." % [price_pence, units, subtotal]

lesson_ui.gd

extends RefCounted

static func build(screen: Control, heading: String, opening: String) -> VBoxContainer:
	var margins := MarginContainer.new()
	screen.add_child(margins)
	margins.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
	for edge in ["left", "right", "top", "bottom"]:
		margins.add_theme_constant_override("margin_" + edge, 24)
	var scroll := ScrollContainer.new()
	margins.add_child(scroll)
	var column := VBoxContainer.new()
	column.size_flags_horizontal = Control.SIZE_EXPAND_FILL
	scroll.add_child(column)
	column.add_theme_constant_override("separation", 12)
	var title := Label.new()
	title.text = heading
	title.add_theme_font_size_override("font_size", 30)
	column.add_child(title)
	message(column, opening)
	return column

static func message(column: VBoxContainer, text: String) -> Label:
	var line := Label.new()
	line.text = text
	line.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
	column.add_child(line)
	return line

static func button(column: Container, caption: String, action: Callable) -> Button:
	var control := Button.new()
	control.text = caption
	control.custom_minimum_size.y = 48
	control.pressed.connect(action)
	column.add_child(control)
	return control

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 UI = preload("res://lesson_ui.gd")Creates a constant named UI. The expression prepares a resource at a fixed project path when the script is loaded.
  3. var price_pence := 199Creates a variable named price_pence. The expression uses the whole number 199. Godot infers the type from the first value.
  4. var units := 1Creates a variable named units. The expression uses the whole number 1. Godot infers the type from the first value.
  5. var summary: LabelDeclares summary for later use. A colon followed by a type says which kind of value belongs here.
  6. 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.
  7. var column := UI.build(self, "Museum practice price desk", "Fictional prices and orders, for maths practice.")Creates a variable named column. The expression calls UI.build with the values in its parentheses. Godot infers the type from the first value.
  8. UI.button(column, "Try 199 pence", _choose_price.bind(199))Calls UI.button with the values in its parentheses.
  9. UI.button(column, "Try 299 pence", _choose_price.bind(299))Calls UI.button with the values in its parentheses.
  10. UI.button(column, "Add one sample order", _add_order)Calls UI.button with the values in its parentheses.
  11. summary = UI.message(column, "")Stores the new value in summary. The expression calls UI.message with the values in its parentheses.
  12. _render()Calls _render with the values in its parentheses.
  13. func _choose_price(pence: int) -> void:Defines choose price, 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.
  14. price_pence = penceStores the new value in price_pence. The expression reads pence.
  15. _render()Calls _render with the values in its parentheses.
  16. func _add_order() -> void:Defines add order, 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. units += 1Reads units, adds to its old value, then stores the result back in the same place.
  18. _render()Calls _render with the values in its parentheses.
  19. func _render() -> void:Defines render, 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.
  20. var subtotal := price_pence * unitsCreates a variable named subtotal. The expression calculates a new value from the expressions on either side of the operator. Godot infers the type from the first value.
  21. summary.text = "%d pence × %d sample orders = %d pence gross before any adjustments." % [price_pence, units, subtotal]Updates summary.text, which controls the words a player sees. The expression uses the text inside the quotes.
Read lesson_ui.gd line by line
  1. extends RefCountedStarts with Godot's RefCounted type. This script gets the abilities of that type and adds the game's own rules.
  2. static func build(screen: Control, heading: String, opening: String) -> VBoxContainer: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.
  3. var margins := MarginContainer.new()Creates a variable named margins. The expression creates a new MarginContainer object. Godot infers the type from the first value.
  4. screen.add_child(margins)Adds the new node to the scene tree so that Godot can run and draw it.
  5. margins.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)Positions this Control relative to the bounds of its parent.
  6. for edge in ["left", "right", "top", "bottom"]:Repeats the indented instructions for each value in ["left", "right", "top", "bottom"].
  7. margins.add_theme_constant_override("margin_" + edge, 24)Calls margins.add_theme_constant_override with the values in its parentheses.
  8. var scroll := ScrollContainer.new()Creates a variable named scroll. The expression creates a new ScrollContainer object. Godot infers the type from the first value.
  9. margins.add_child(scroll)Adds the new node to the scene tree so that Godot can run and draw it.
  10. var column := VBoxContainer.new()Creates a variable named column. The expression creates a new VBoxContainer object. Godot infers the type from the first value.
  11. column.size_flags_horizontal = Control.SIZE_EXPAND_FILLStores the new value in column.size_flags_horizontal. The expression reads Control.SIZE_EXPAND_FILL.
  12. scroll.add_child(column)Adds the new node to the scene tree so that Godot can run and draw it.
  13. column.add_theme_constant_override("separation", 12)Calls column.add_theme_constant_override with the values in its parentheses.
  14. var title := Label.new()Creates a variable named title. The expression creates a new Label object. Godot infers the type from the first value.
  15. title.text = headingUpdates title.text, which controls the words a player sees. The expression reads heading.
  16. title.add_theme_font_size_override("font_size", 30)Calls title.add_theme_font_size_override with the values in its parentheses.
  17. column.add_child(title)Adds the new node to the scene tree so that Godot can run and draw it.
  18. message(column, opening)Calls message with the values in its parentheses.
  19. return columnFinishes the function and hands its result back to the caller. The expression reads column.
  20. static func message(column: VBoxContainer, text: String) -> Label:Defines message, 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.
  21. var line := Label.new()Creates a variable named line. The expression creates a new Label object. Godot infers the type from the first value.
  22. line.text = textUpdates line.text, which controls the words a player sees. The expression reads text.
  23. line.autowrap_mode = TextServer.AUTOWRAP_WORD_SMARTStores the new value in line.autowrap_mode. The expression reads TextServer.AUTOWRAP_WORD_SMART.
  24. column.add_child(line)Adds the new node to the scene tree so that Godot can run and draw it.
  25. return lineFinishes the function and hands its result back to the caller. The expression reads line.
  26. static func button(column: Container, caption: String, action: Callable) -> Button:Defines button, 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. var control := Button.new()Creates a variable named control. The expression creates a new Button object. Godot infers the type from the first value.
  28. control.text = captionUpdates control.text, which controls the words a player sees. The expression reads caption.
  29. control.custom_minimum_size.y = 48Stores the new value in control.custom_minimum_size.y. The expression uses the whole number 48.
  30. control.pressed.connect(action)Links a signal to the function that should run when the event happens.
  31. column.add_child(control)Adds the new node to the scene tree so that Godot can run and draw it.
  32. return controlFinishes the function and hands its result back to the caller. The expression reads control.

Find and fix a bug

If multiplying two values produces a surprising result, check that both inputs use whole pence and that you are displaying gross sales rather than claiming a payout.

Try a change

Ages 10–12: compare two example prices for two sales. Ages 13–16: add a labelled scenario showing how a hypothetical refund changes gross sales. Keep real deductions out of the practice model.

Official instructions