Implement run mechanic and level progression with top-left HUD indicator

Run (B + direction):
- player_logic.c: while holding B + direction with stamina >= 10, each tile
  takes 8 frames instead of 16 (move_progress += 2, LERP >>4 unchanged) and
  costs 10 stamina per tile. DAS_REPEAT_RUN=2 chains tiles fluidly.
- Falls back silently to normal walk when stamina < 10.

Level progression:
- New global 'level' (starts at 1). title->game resets to 1; reaching the
  hatch (victory/Going Deeper) + START increments before engine_init (new
  maze); defeat + START resets to 1.
- Top-left HUD 'L<n>' via 3 sprites (OAM 23-25) from new level.png asset
  (glyphs L, 0-9), generated by scripts/generate_level.py and converted
  with png2asset -keep_duplicate_tiles for predictable tile ordering.
- VRAM base aligned to an EVEN index (8x16 hardware ignores tile LSB) and
  placed after the stamina load claim to avoid the shared BG tile block.
- update_level_display() called every frame; hides during game over/title.

Docs: README, doc/gameplay.md and the technical report updated.
This commit is contained in:
2026-06-24 11:56:19 +02:00
parent ae0706ccfb
commit 36e52d4d1a
15 changed files with 506 additions and 12 deletions
+6 -1
View File
@@ -47,6 +47,7 @@ extern uint8_t player_dir; // 0=DR, 1=DL, 2=UL, 3=UR
// Shared variables for interpolated movement (walking/jumping)
extern uint8_t is_moving;
extern uint8_t is_jumping;
extern uint8_t is_running; // B+direction: step in 8 frames instead of 16, costs 10 stamina/tile
extern uint8_t move_progress; // 0 to 16, tracks the sub-tile animation progress
extern int8_t start_lx, start_ly;
extern int8_t target_lx, target_ly;
@@ -54,10 +55,14 @@ extern int16_t start_px, start_py;
extern int16_t target_px, target_py;
// --- Stamina System ---
// Stamina powers the jump mechanic. 100 = full. Recharges over time.
// Stamina powers the jump/run mechanic. 100 = full. Recharges over time.
extern uint8_t stamina;
extern uint8_t stamina_recharge_timer;
// --- Level Progression ---
// Current level (starts at 1, increments each time the hatch is reached).
extern uint8_t level;
// --- Enemy State ---
extern uint8_t enemy_lx;
extern uint8_t enemy_ly;