level design etc

This commit is contained in:
t. boddy 2026-02-17 17:40:34 -05:00
parent 0151304d05
commit 4036b5f07e
13 changed files with 460 additions and 21 deletions

View file

@ -23,22 +23,58 @@ static void loadInternals(){
VDP_setTextPriority(1);
}
void clearLevel(){
for(s16 i = 0; i < BULLET_COUNT; i++)
if(bullets[i].active) killBullet(i, FALSE);
for(s16 i = 0; i < ENEMY_COUNT; i++)
if(enemies[i].active){ enemies[i].hp = 0; killEnemy(i); }
for(s16 i = 0; i < HUMAN_COUNT; i++)
if(humans[i].active) killHuman(i);
humanBeingCarried = FALSE;
collectedCount = 0;
// black out everything
SPR_setVisibility(player.image, HIDDEN);
VDP_clearTileMapRect(BG_A, 0, 0, 128, 32);
VDP_clearTileMapRect(BG_B, 0, 0, 128, 32);
}
void loadGame(){
loadBackground();
loadPlayer();
loadChrome();
loadStage();
loadLevel(0);
started = TRUE;
}
static void updateGame(){
updateChrome();
updateSfx();
if(levelClearing){
levelClearClock++;
if(levelClearClock == 1){
clearLevel();
}
if(levelClearClock >= 120){
levelClearing = FALSE;
loadBackground();
loadChrome();
loadLevel(level + 1);
SPR_setVisibility(player.image, VISIBLE);
}
return;
}
if(!paused){
updatePlayer();
if(clock % 2 == 0){
updateEnemies();
if(!gameOver && enemyCount == 0) gameOver = TRUE;
if(!gameOver && enemyCount == 0){
if(level >= LEVEL_COUNT - 1){
gameOver = TRUE;
} else {
levelClearing = TRUE;
levelClearClock = 0;
}
}
updateHumans();
} else {
updateBackground();