8-level progression with scaling difficulty and a finale

Maze size grows +2/level from 7x7 to 21x21 (cap MAX_MAP_SIZE=21, reached
at level 8). Additional difficulty axes scale with level:
- +1 ghost per level (up to MAX_ENEMIES=8); enemy state moved to arrays,
  enemy_logic.c rewritten as a multi-entity loop (own AI, render at OAM
  2+i*2, staggered cooldowns).
- Ghost cooldown shrinks: 60 -> ~11 frames between steps.
- Stamina recharge slows: 60 -> 144 frames per point.
- Fog tightens to 3x3 (fog_radius=1) from level 7.
Fog rendering uses a dynamic 16-row centered flush (with wrap) instead of
the fixed rows 2-17 / full 32x32, so the fog stays correct on big mazes
without the multi-frame stall of the full flush.

Game ends after level 8: reaching the hatch at level 8 sets game_over=3
(finale) instead of 2. Finale screen reloads the IBM font and writes
'YOU ESCAPED / THE DARKNESS / LEVEL 8 CLEARED / PRESS START' into the BG
map; START returns to the title (new game starts at level 1).

Verified via PyBoy: sizes 7..21, fog 2->1 at L7, enemies 1..8 (distinct,
on floor, can catch the player), cooldown/recharge scaling, L1 hatch ->
game_over=2, L8 hatch -> game_over=3, finale renders + START->title->L1.
This commit is contained in:
2026-06-24 13:04:39 +02:00
parent 5e8709ade0
commit 4968d2e885
10 changed files with 317 additions and 264 deletions
+5 -3
View File
@@ -33,9 +33,10 @@ static uint8_t das_active = 0;
*/
void update_player_movement(uint8_t keys, uint8_t prev_keys) {
// --- Gestione della Stamina ---
// Ricarica la stamina di 1 punto al secondo (60 frames su Game Boy)
// Ricarica la stamina di 1 punto ogni `stamina_recharge_rate` frame (1/s al livello 1,
// piu' lento ai livelli alti). `stamina_recharge_rate` e' impostato in engine_init.
stamina_recharge_timer++;
if (stamina_recharge_timer >= 60) {
if (stamina_recharge_timer >= stamina_recharge_rate) {
stamina_recharge_timer = 0;
if (stamina < 100) {
stamina++;
@@ -87,7 +88,8 @@ void update_player_movement(uint8_t keys, uint8_t prev_keys) {
// Controllo Casella Vittoria (ID 2)
if (maze[player_ly][player_lx] == 2) {
game_over = 2; // Stato 2 = Vittoria
// Livello 8 completato -> finale (gioco finito); altrimenti Going Deeper (lvl successivo).
game_over = (level >= 8) ? 3 : 2;
game_over_timer = 30; // Piccolo ritardo prima che la scena cambi
update_stamina_display();