Video Game Design and Coding

PLECK lesson 7 · suggested week 2, day 2

Use names and types that explain the game

Objective. Choose sensible integer, float, Boolean and string values.

Godot Engine Standard desktop editor 4.7.2-stable, GDScript (Godot 4), Compatibility renderer. Headless Godot 4.7.2.stable.official.ed1daf0bf passed 106 assertions on the supplied scaffolds, including malformed JSON saves. Audio used the Dummy driver and a synthetic WAV, not a speaker. The visual editor, browser export, and signed-in submission were not tested. The desk still does not run a student's own upload.

About 55 minutes. The due date is chosen by a parent.

Values, types, expressions, branches and repeatable experiments

Suggested pace: Recall and predict 5 min; Read instruction and scaffold 12 min; Build or design the assigned artifact 25 min; Run acceptance tests 8 min; Explain and checkpoint 5 min.

Materials: Godot Standard 4.7.2 desktop editor (GDScript, Compatibility renderer), Local course folder and prior checkpoint, No paid assets or public account required.

Comes after VGC-L006.

An integer counts whole objects, a float measures quantities such as seconds, a Boolean stores true or false, and a string stores text. In your Lab script, add lives as an int, elapsed_seconds as a float, delivered as a bool, and route_name as a String. Names should describe meaning rather than an arbitrary letter. A string containing “3” is text, not the integer 3. Print each variable from _ready to inspect its value. Assignment replaces a value; equality comparison asks whether two values match.

Worked example

A counter lab can store parcels as an int and route_title as a String. print exposes intermediate values; a function such as double_points(n) returns n*2 without needing any artwork. Scaffold C-HELLO — An observable first script Setup: Create a Node scene, name root Lab, attach lab.gd. Save as lab.tscn. Run current scene (editor clapboard/Run Current Scene). Output panel shows print output. All unindented lines belong to the script and indented lines belong to the function. ```gdscript extends Node var deliveries: int = 0 func _ready() -> void: deliveries += 1 print("Deliveries: ", deliveries) ```

An observable first script

GDScript (Godot 4, not Scratch, Python, JavaScript or C#). Scaffold C-HELLO. Copy starts from this text. The desk does not run it.

Scene and node setup

Create a Node scene, name root Lab, attach lab.gd. Save as lab.tscn. Run current scene (editor clapboard/Run Current Scene). Output panel shows print output. All unindented lines belong to the script and indented lines belong to the function.

extends Node
var deliveries: int = 0
func _ready() -> void:
    deliveries += 1
    print("Deliveries: ", deliveries)

Checks to run in the editor

  • Run once: Deliveries: 1
  • Stop and run: value is 1, not 2.

Native Godot 4.7.2.stable.official.ed1daf0bf headless compile and representative node-tree/runtime tests passed; see native-qa-results.json. Visual UI, audible output, exports and website submission still need separate checks.

Use names and types that explain the game — evidence task

  1. 1. Declare and print four appropriately typed courier variables.
  2. 2. Add one sentence explaining why elapsed time uses a float rather than a whole-number count.

Deliverable. Edited Lab project and a four-row type table.

Acceptance checks

  • VGC-L007-T1. All four declarations parse in GDScript.
  • VGC-L007-T2. Quoted route text is distinct from numeric values.

Understanding question. What is the difference between lives = 3 and lives == 3?

Include a downloadable project ZIP with project.godot, .tscn, .gd and original asset files when code changes. A private, teacher-accessible download link to that ZIP is equivalent. Screenshots or a playthrough do not replace editable source.

If this is still shaky. Return to C-HELLO and change one value per run. Write the expected output before running. Start with the first assigned task and re-run its acceptance test before adding the remaining feature.

Optional extra. Create another small numeric example and predict the result without executing it first. Document one changed parameter, your prediction, and the observed effect; optional, not required for completion.

Turn in typed notes and a JPEG, PNG, or WebP screenshot. One https address is stored as text and is not opened, extracted, or run. An MP3, WAV, M4A, MP4, or WebM file up to 4 MB can show a demo. The demo does not replace editable source. Zip and code files are refused. If there is no private link, keep the project on the family computer and review the code in person.

This is a preview. A parent assigns the lesson and chooses the due date after the student is enrolled. The answer key is not on this page.

Print this lesson