From 596f7f2ec8e497e8dac9bad7e38538b128b7f10d Mon Sep 17 00:00:00 2001 From: Trevor Boddy Date: Sat, 24 Sep 2022 21:43:14 -0400 Subject: [PATCH] stage work --- src/stage.h | 190 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 182 insertions(+), 8 deletions(-) diff --git a/src/stage.h b/src/stage.h index abe875a..edf52af 100644 --- a/src/stage.h +++ b/src/stage.h @@ -301,8 +301,8 @@ static void waveBig6(bool right){ spawner.image = &bigBullet; } else { spawner.speed = FIX16(1.75); - spawner.light = TRUE; spawner.image = &smallBullet; + spawner.top = TRUE; } spawnBullet(spawner, EMPTY); } @@ -312,19 +312,39 @@ static void waveBig6(bool right){ spawnEnemy(spawner, updater, EMPTY); } - static void waveFormation(bool right){ struct enemySpawner spawner = { .angle = 256, - .speed = FIX16(0.75), - .x = 80, + .speed = FIX16(1), + .x = right ? (GAME_W - 48) : 48, .y = -16, - .image = &fairyRed, + .image = right ? &fairyRed : &fairyBlue, .offX = 16, .offY = 16, - .health = 6 + .health = 2 }; - // spawnEnemy(spawner) + void updater(s16 i){ + if(enemies[i].clock > 0 && enemies[i].clock % 60 == 0 && enemies[i].clock <= 180){ + struct bulletSpawner spawner = { + .x = enemies[i].pos.x, + .y = enemies[i].pos.y, + .image = &smallBullet, + .light = TRUE, + .speed = FIX16(1.5) + }; + spawner.vel = hone(enemies[i].pos, player.pos, spawner.speed, 16); + spawnBullet(spawner, updater); + } + if(enemies[i].clock == 90){ + enemies[i].speed = FIX16(0.75); + updateEnemyVel(i); + } + } + for(u8 i = 0; i < 4; i++){ + spawnEnemy(spawner, updater, EMPTY); + spawner.x += right ? -32 : 32; + spawner.y -= 32; + } } @@ -520,9 +540,140 @@ static void waveMidboss1(){ spawnEnemy(spawner, updater, suicide); } +static void waveMidboss2(){ + bossAnimateClock = 0; + struct enemySpawner spawner = { + .angle = 256, + .speed = FIX16(1), + .x = GAME_W / 2, + .y = -16, + .image = &cirno, + .offX = 24, + .offY = 28, + .boss = TRUE, + .health = 15 + }; + bossMax = spawner.health; + void updater(s16 i){ + bossAnimate(i); + if(enemies[i].bools[0]){ + bossHealth = enemies[i].health; + bossMove(i); + if(enemies[i].health >= 40){ + + // laser + if(enemies[i].clock % 30 == 0){ + struct bulletSpawner spawner = { + .x = enemies[i].pos.x, + .y = enemies[i].pos.y, + .image = &hugeBullet, + .huge = TRUE, + .speed = FIX16(2), + .angle = 256, + .light = TRUE + }; + spawnBullet(spawner, EMPTY); + } + + // homing + if(enemies[i].clock > 0 && enemies[i].clock % 15 == 10){ + struct bulletSpawner spawner = { + .x = FIX16(random() % (GAME_W - 64) + 32), + .y = FIX16(32 + random() % 32), + .image = &bigBullet, + .speed = FIX16(1.25), + .angle = 256 + }; + spawner.fixes[0] = spawner.speed; + void updater(s16 j){ + if(bullets[j].clock == 10){ + bullets[j].speed = 0; + updateBulletVel(j); + } + else if(bullets[j].clock >= 20 && bullets[j].clock % 20 == 0 && bullets[j].clock < 60) + bullets[j].vel = hone(bullets[j].pos, player.pos, bullets[j].fixes[0], 8); + } + spawnBullet(spawner, updater); + spawnExplosion(spawner.x, spawner.y, 3); + } + + } else if(enemies[i].health >= 20){ + + // ring + if(enemies[i].clock % 5 == 0){ + struct bulletSpawner spawner = { + .x = enemies[i].pos.x, + .y = enemies[i].pos.y, + .image = &bigBullet, + .light = TRUE, + .speed = FIX16(2), + .top = TRUE, + .angle = random() % 128 + (enemies[i].clock % 10 == 0 ? 128 : 256) + }; + void updater(s16 j){ + if(bullets[j].clock == 20){ + bullets[j].speed = FIX16(1.75); + updateBulletVel(j); + } else if(bullets[j].clock == 40){ + bullets[j].speed = FIX16(1.5); + updateBulletVel(j); + } + } + spawnBullet(spawner, updater); + } + + // lasers + if(enemies[i].clock % 15 == 0){ + struct bulletSpawner spawner = { + .x = enemies[i].pos.x + FIX16(enemies[i].clock % 30 == 0 ? 32 : -32), + .y = enemies[i].pos.y, + .image = &hugeBullet, + .huge = TRUE, + .speed = FIX16(2), + .angle = 256 + }; + spawnBullet(spawner, EMPTY); + } + + } else { + + if(enemies[i].clock % 5 == 0){ + struct bulletSpawner spawner = { + .x = enemies[i].pos.x, + .y = enemies[i].pos.y, + .image = &bigBullet, + .light = TRUE, + .speed = FIX16(2), + .top = TRUE, + .angle = random() % 128 + (enemies[i].clock % 10 == 0 ? 128 : 256) + }; + spawner.fixes[0] = FIX16(GAME_H - 8); + void updater(s16 j){ + if(bullets[j].pos.y >= bullets[j].fixes[0] && !bullets[j].bools[0]){ + bullets[j].bools[0] = TRUE; + SPR_setAnim(bullets[j].image, 0); + bullets[j].angle = 768; + updateBulletVel(j); + } + } + spawnBullet(spawner, updater); + } + + } + } else bossIntro(i); + } + void suicide(s16 i){ + bossHealth = 0; + killBullets = TRUE; + } + spawnEnemy(spawner, updater, suicide); +} + +static void waveBoss1(){} + // loop -s16 currentWave = 13; +s16 currentWave = 17; void updateStage(){ if(enemyCount == 0){ @@ -591,6 +742,29 @@ void updateStage(){ waveBig6(FALSE); waveFormation(TRUE); break; + // big from right, small formation + case 14: + waveBig6(TRUE); + waveFormation(FALSE); + break; + // big from left, small formation + case 15: + waveBig6(FALSE); + waveFormation(TRUE); + break; + // big from right, small formation + case 16: + waveBig6(TRUE); + waveFormation(FALSE); + break; + // midboss + case 17: + waveMidboss2(); + break; + // midboss + case 18: + waveBoss1(); + break; } currentWave++;