36e52d4d1a
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.
34 lines
700 B
C
34 lines
700 B
C
#include <gb/gb.h>
|
|
#include "engine.h"
|
|
#include "globals.h"
|
|
|
|
uint8_t app_state = 0; // 0 = title, 1 = game
|
|
|
|
void main(void) {
|
|
title_init();
|
|
|
|
SHOW_BKG;
|
|
SHOW_SPRITES;
|
|
DISPLAY_ON;
|
|
|
|
uint8_t prev_keys = 0;
|
|
|
|
while (1) {
|
|
wait_vbl_done();
|
|
uint8_t keys = joypad();
|
|
|
|
if (app_state == 0) {
|
|
title_update(keys, prev_keys);
|
|
if ((keys & J_START) && !(prev_keys & J_START)) {
|
|
app_state = 1;
|
|
level = 1; // Nuova partita dal livello 1
|
|
engine_init();
|
|
}
|
|
} else {
|
|
engine_update(keys, prev_keys);
|
|
}
|
|
|
|
prev_keys = keys;
|
|
}
|
|
}
|