PLECK lesson 19 · suggested week 4, day 4
Diagnose a collision systematically
Objective. Isolate a bug with reproducible steps instead of random edits.
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.
Physics bodies, visible walls, layers and collision diagnosis
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-L018.
A useful bug report states setup, action, expected result and observed result. For a wall-pass-through bug, check that Player is a CharacterBody2D, the wall is a StaticBody2D, both colliders are enabled, shapes overlap the intended pixels, and masks include the relevant layers. Change one cause at a time. A parse error can stop a script before physics runs at all, so read the first error in Debugger before editing geometry. Keep the last working backup untouched.
Worked example
A wall is a StaticBody2D with matching rectangle art and collider. A player standing next to it should be stopped by geometry, not by a special if statement checking the wall’s screen color. Scaffold C-BODY — Reusable top-down player with collision Setup: Create CharacterBody2D root Player at (80,180); add CollisionShape2D with CircleShape2D radius 14. Attach this script to Player and save Player.tscn. Use C-FREE-MOVE input actions. Root collision layer 1, mask 2. Create a separate StaticBody2D Wall on layer 2 mask 1 with RectangleShape2D collision and a Polygon2D rectangle as visible child. Instance both under an unscaled Node2D World. Do not put a body inside another physics body. ```gdscript extends CharacterBody2D @export var speed: float = 160.0 func _draw() -> void: draw_circle(Vector2.ZERO, 14.0, Color.CORNFLOWER_BLUE) draw_line(Vector2(-8, 0), Vector2(8, 0), Color.WHITE, 3.0) func _physics_process(_delta: float) -> void: velocity = Input.get_vector("move_left", "move_right", "move_up", "move_down") * speed move_and_slide() ```
Reusable top-down player with collision
GDScript (Godot 4, not Scratch, Python, JavaScript or C#). Scaffold C-BODY. Copy starts from this text. The desk does not run it.
Scene and node setup
Create CharacterBody2D root Player at (80,180); add CollisionShape2D with CircleShape2D radius 14. Attach this script to Player and save Player.tscn. Use C-FREE-MOVE input actions. Root collision layer 1, mask 2. Create a separate StaticBody2D Wall on layer 2 mask 1 with RectangleShape2D collision and a Polygon2D rectangle as visible child. Instance both under an unscaled Node2D World. Do not put a body inside another physics body.
extends CharacterBody2D
@export var speed: float = 160.0
func _draw() -> void:
draw_circle(Vector2.ZERO, 14.0, Color.CORNFLOWER_BLUE)
draw_line(Vector2(-8, 0), Vector2(8, 0), Color.WHITE, 3.0)
func _physics_process(_delta: float) -> void:
velocity = Input.get_vector("move_left", "move_right", "move_up", "move_down") * speed
move_and_slide()
Checks to run in the editor
- Player stops at the wall rather than passing through.
- Diagonal speed matches horizontal speed.
- Do not multiply velocity by delta before move_and_slide.
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.
Pocket Orchard starter, as text files. Open the files in Godot on the family computer. This page does not download a zip or run the project.
Diagnose a collision systematically — evidence task
- 1. Introduce one known fault: disable the wall collider.
- 2. Write a four-part report, verify the cause, restore the collider and repeat the same action.
Deliverable. Bug report and fixed project checkpoint.
Acceptance checks
- VGC-L019-T1. The report reproduces the failure from a fresh run.
- VGC-L019-T2. The identical test passes after the single fix.
Understanding question. Why should the same reproduction steps be used after the fix?
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 a single rectangle wall and C-BODY. Enable visible collision shapes in the Debug menu before redesigning the level. Start with the first assigned task and re-run its acceptance test before adding the remaining feature.
Optional extra. Compare two collider sizes and explain how perceived fairness changes. 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.
- Godot step by step: nodes, scenes, GDScript, input, signals
Free public documentation, no account. Same class help is available within the desktop editor.
· Opening this link does not submit the lesson.
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.
