Video Game Design and Coding · PLECK lesson
PLECK lesson 66 · suggested week 14, day 1
Activate a midpoint checkpoint
Objective. Store a safe global coordinate once the player reaches it.
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.
Progress markers, camera framing, collision feedback and limited forgiveness
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-L065.
A checkpoint changes where a future retry begins. Put an Area2D on the broad middle platform; its handler calls set_checkpoint with a safe Marker2D global_position. The marker should be above the platform, not at the trigger’s edge. Change the checkpoint’s visible symbol when activated and show a short text message. Re-entering it may repeat feedback but must not move the safe position into a wall. For now checkpoints last only for the current session.
Worked example
A checkpoint trigger and safe spawn marker serve different roles. The trigger notices arrival, while the marker specifies a collision-free return location above a platform. Scaffold C-CHECKPOINT — A safe checkpoint respawn Setup: Add this pattern to a separate Node2D level root with child Player using C-PLATFORM. Call set_checkpoint with a safe global position when a player reaches a checkpoint Area2D; call respawn when entering a fall zone. This code does not connect Area2D automatically; select the area body_entered signal in editor and call these methods from its handler after checking the player group. Respawn is deferred because a physics callback may be active. ```gdscript extends Node2D @onready var player: CharacterBody2D = $Player var checkpoint: Vector2 func _ready() -> void: checkpoint = player.global_position func set_checkpoint(safe_position: Vector2) -> void: checkpoint = safe_position func respawn() -> void: _apply_respawn.call_deferred() func _apply_respawn() -> void: player.global_position = checkpoint player.velocity = Vector2.ZERO ```
A safe checkpoint respawn
GDScript (Godot 4, not Scratch, Python, JavaScript or C#). Scaffold C-CHECKPOINT. Copy starts from this text. The desk does not run it.
Scene and node setup
Add this pattern to a separate Node2D level root with child Player using C-PLATFORM. Call set_checkpoint with a safe global position when a player reaches a checkpoint Area2D; call respawn when entering a fall zone. This code does not connect Area2D automatically; select the area body_entered signal in editor and call these methods from its handler after checking the player group. Respawn is deferred because a physics callback may be active.
extends Node2D
@onready var player: CharacterBody2D = $Player
var checkpoint: Vector2
func _ready() -> void:
checkpoint = player.global_position
func set_checkpoint(safe_position: Vector2) -> void:
checkpoint = safe_position
func respawn() -> void:
_apply_respawn.call_deferred()
func _apply_respawn() -> void:
player.global_position = checkpoint
player.velocity = Vector2.ZERO
Checks to run in the editor
- A fall returns to last safe point, not origin.
- Player has no leftover falling velocity on return.
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.
Activate a midpoint checkpoint — evidence task
- 1. Add a midpoint Area2D and safe Marker2D.
- 2. Activate, advance, fall and verify the new respawn location.
Deliverable. Checkpoint project and before/after fall tests.
Acceptance checks
- VGC-L066-T1. Before activation, falls return to start.
- VGC-L066-T2. After activation, falls return to the midpoint safely.
Understanding question. Why store the Marker2D global_position rather than its local position?
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. Use one checkpoint on a broad platform and keep the camera fixed until respawn is reliable. Start with the first assigned task and re-run its acceptance test before adding the remaining feature.
Optional extra. Compare start-only retries with a midpoint checkpoint using the same route. Document one changed parameter, your prediction, and the observed effect; optional, not required for completion.
- Your first 2D game
Free public tutorial; no account; external asset download is optional, not used by this course.
· Opening this link does not submit the lesson.
Name ____________________ Date ____________________