level design etc
This commit is contained in:
parent
0151304d05
commit
4036b5f07e
13 changed files with 460 additions and 21 deletions
40
src/main.c
40
src/main.c
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue