A retro-style Tetris-like game built on Godot 4.7+, designed for PC desktop in landscape (1280×720). Golden console aesthetic, pixel-art dino idle animation, DAS (Delayed Auto Shift) controls, scoring, level progression, and game state persistence — a complete project you can run, build, and study as an architecture template.
The entire project is built purely in code: main.tscn is only 3 lines of substance. The node tree, UI, styles, and arrow icons are all constructed by GDScript at runtime. view_config.gd manages layout via named constants with absolute pixel coordinates, and the console shell pattern is drawn with draw_rect calls. Reading the .gd files tells you everything.
.tscn black boxes — Scene tree built in code by view_builder.gd, read .gd files to understand the full pictureview_config.gd, avoiding verbose Container/anchorsFollowing the same Logic-View separation as Block Blast and Godot 2048 — replacing the common MVC pattern:
| Layer | Responsibility | Key Files |
|---|---|---|
| logic/ | Pure game logic. Game extends RefCounted, no scene-tree dependency, unit-testable. Block / Matrix are pure data classes. SaveData handles persistence. |
game.gd block.gd matrix.gd input_handler.gd save_data.gd |
| view/ | Pure rendering. All views read state via the game reference and auto-refresh through the state_changed signal. ViewConfig.draw_shell() code-draws the golden console shell. |
matrix_view.gd next_view.gd idle_hint.gd reset_dialog.gd |
| main.gd | Thin coordinator. Builds UI → creates Game → drives the state machine each frame with tick(delta) → wires Logic ↔ View signals. |
— |
Key insight: Game extends RefCounted instead of Node, so the logic layer can be unit-tested without a scene tree — no Timer or SceneTree dependencies; all state transitions are driven by a pure tick(delta) function.
The project ships with a lightweight test framework (no plugin dependencies), two tiers:
tests/test_*.gd) — covers gravity, line clearing, Game Over, save data, and all other core rules for Block / Matrix / Gametests/smoke_test.gd) — instantiates the real main scene and verifies startup and tick-driven operationRun them with:
godot --headless --path . --script res://tests/test_runner.gd # Unit tests
godot --headless --path . --script res://tests/smoke_test.gd # Smoke test
ViewConfig.draw_shell() draws the golden shell + screen border + panel background using draw_rectNOTIFICATION_APPLICATION_FOCUS_OUTuser://save.json, isolated per originuser://save.json| Lines Cleared | Score |
|---|---|
| 1 | 100 |
| 2 | 300 |
| 3 | 700 |
| 4 | 1500 |
10 + (speed_level - 1) × 2 per block locked| Action | Key | Virtual Button |
|---|---|---|
| Move Left | A / ← |
D-Pad Left |
| Move Right | D / → |
D-Pad Right |
| Soft Drop | S / ↓ |
D-Pad Down |
| Rotate | W / ↑ |
D-Pad Up |
| Hard Drop | Space |
N/A |
| Pause / Start | P |
Pause |
| Reset | R |
Reset |
| Mute / Unmute | M |
Sound |
block-fall-pc/
├── audio/ # Sound effects (.ogg)
│ ├── start.ogg # Game start
│ ├── move.ogg # Block move
│ ├── rotate.ogg # Block rotate
│ ├── clear.ogg # Line clear
│ ├── fall.ogg # Lock-in fall
│ └── gameover.ogg # Game Over
├── logic/ # Game logic layer (Logic)
│ ├── block.gd # Block data (shapes, rotation, movement)
│ ├── game.gd # Game logic + tick state machine (RefCounted pure logic)
│ ├── input_handler.gd # Keyboard/button input + DAS repeat logic
│ ├── matrix.gd # Grid logic (collision, merge, clear lines)
│ └── save_data.gd # Save/load (user://save.json)
├── view/ # Rendering layer (View)
│ ├── idle_hint.gd # Dino idle animation
│ ├── matrix_view.gd # Matrix rendering
│ ├── next_view.gd # Next block preview rendering
│ ├── reset_dialog.gd # Reset confirmation dialog (retro style)
│ ├── view_config.gd # Layout constants + draw_shell() shell drawing
│ └── view_builder.gd # Scene tree construction + view factories
├── tools/ # Asset generation tools
│ └── gen_block_fall_assets.py # Logo + splash screen generator
├── tests/ # Tests (no plugin dependencies)
│ ├── test_runner.gd # Unit test runner
│ ├── smoke_test.gd # Smoke test
│ ├── test_base.gd # Test base class
│ ├── test_block.gd # Block unit tests
│ ├── test_game.gd # Game unit tests
│ └── test_matrix.gd # Matrix unit tests
├── docs/ # Project documentation
│ ├── intro.md # This document (Chinese)
│ └── intro_en.md # English introduction
├── main.gd # Main coordinator (LV thin layer: wiring + tick + shell drawing)
├── main.tscn # Main scene (root node + script reference only)
├── project.godot # Engine configuration
├── export_presets.cfg # Export preset configuration
└── LICENSE.md # Paid license (see LICENSE_en.md for English version)
godot --path .)export_presets.cfgpython3 tools/gen_block_fall_assets.py
This project uses a paid custom license. After purchase you may modify the code and ship derivative games, but you may not redistribute the source code or sell it commercially. See LICENSE_en.md (or LICENSE.md for Chinese) for the full terms.