feat: HUD overlay via UIScene — health bar, quick slots, inventory info (Phase 4.7)

UIScene renders as overlay on top of GameScene:
- Health bar (top-left) with color transitions green→yellow→red
- 4 quick slots (bottom-center) with active highlight, item symbols and counts
- Inventory weight/slots info (bottom-right)
- Controls hint (top-right)

GameScene pushes state to Phaser registry each frame.
Phase 4 (Player Systems) complete — 222 tests passing.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Денис Шкабатур
2026-02-12 13:36:42 +03:00
parent d173ada466
commit 7e46d1ed1d
5 changed files with 308 additions and 18 deletions

View File

@@ -1,7 +1,7 @@
# Synthesis — Development Progress
> **Last updated:** 2026-02-12
> **Current phase:** Phase 3 ✅ → Ready for Phase 4
> **Current phase:** Phase 4 ✅ → Ready for Phase 5
---
@@ -48,23 +48,27 @@
- [x] 3.7 Minimap — canvas-based 160x160 overview, viewport indicator, border (`src/world/minimap.ts`)
- [x] Unit tests — 21 passing (`tests/world.test.ts`)
### Phase 4: Player Systems ✅
- [x] 4.1 Player entity + WASD controller (`src/player/input.ts`, `src/player/collision.ts`, `src/player/spawn.ts`, `src/player/factory.ts`)
- [x] 4.2 Inventory — weight-based, element stacking, AMU mass from registries (`src/player/inventory.ts`)
- [x] 4.3 Element collection from world objects — resource entities, proximity interaction, E key (`src/player/interaction.ts`, `src/world/resources.ts`)
- [x] 4.4 Crafting — chemistry engine integration, inventory consume/produce, condition checking (`src/player/crafting.ts`)
- [x] 4.5 Projectile system — throw elements toward mouse, lifetime + tile collision (`src/player/projectile.ts`)
- [x] 4.6 Quick slots — 4 hotkeys, auto-assign on pickup, active slot for throw (`src/player/quickslots.ts`)
- [x] 4.7 HUD — UIScene overlay: health bar, quick slots, inventory info, controls hint (`src/scenes/UIScene.ts`)
- [x] Unit tests — 39 player + 28 inventory + 12 interaction + 11 crafting + 13 projectile + 15 quickslots + 8 UI = 126 tests (222 total)
---
## In Progress
_None — ready to begin Phase 4_
_None — ready to begin Phase 5_
---
## Up Next: Phase 4Player Systems
## Up Next: Phase 5Creatures & AI
- [ ] 4.1 Player entity + WASD controller
- [ ] 4.2 Inventory (weight-based, element stacking)
- [ ] 4.3 Element collection from world objects
- [ ] 4.4 Crafting (chemistry engine integration)
- [ ] 4.5 Projectile system (throw elements/compounds)
- [ ] 4.6 Quick slots (1-2-3-4 hotkeys)
- [ ] 4.7 HUD (UIScene: health ring, inventory bar, element info)
_(See IMPLEMENTATION-PLAN.md for details)_
---
@@ -82,3 +86,4 @@ None
| 2 | 2026-02-12 | Phase 1 | Chemistry engine: 20 elements, 25 compounds, 34 reactions, engine with O(1) lookup + educational failures, 35 tests passing |
| 3 | 2026-02-12 | Phase 2 | ECS foundation: world + time, 5 components, movement + bounce + health systems, Phaser bridge (polling sync), entity factory, GameScene with 20 bouncing circles at 60fps, 39 tests passing |
| 4 | 2026-02-12 | Phase 3 | World generation: simplex noise (seeded), 80x80 tilemap with 8 tile types, Catalytic Wastes biome, camera WASD+zoom, minimap with viewport indicator, 21 tests passing (95 total) |
| 5 | 2026-02-12 | Phase 4 | Player systems: WASD movement + tile collision, weight-based inventory, resource collection, crafting via chemistry engine, projectile throw, 4 quick slots, UIScene HUD overlay (health bar, slots, inventory), 126 new tests (222 total) |