From 527d1b8f8d9be296b6e160ff5a2ad45d20908023 Mon Sep 17 00:00:00 2001 From: Trevor Boddy Date: Sat, 24 Sep 2022 13:15:36 -0400 Subject: [PATCH] some stage work --- res/font.png | Bin 3467 -> 3467 bytes src/enemies.h | 3 +- src/stage.h | 112 +++++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 93 insertions(+), 22 deletions(-) diff --git a/res/font.png b/res/font.png index c0e7aadebc61bc6aac9c37081454278c33d6949a..79822dfa3b20aa2810b6d9b6b19f9eb4c3614706 100644 GIT binary patch delta 167 zcmeB{?v~#0g^9}~#L&>n#K6kXaPmJUWn`{4bES%fX;NB>g^7u7Y6_4rF*ZomwXifv z)J;t@Pc%v~v#>NYP27Bf`5v3vj6}(uP;gf delta 167 zcmeB{?v~#0g^9~J#L(Qz$kfWnX!1WMWn`{4bEQh6k)d&-kx{a)L0Ynru8E;Vs&0~@ zv4O6oS!#;8X`)4vnWf3*6U_IRU5Qbtq)=SqT2^9Jo{^eot7K$gWTb0gscVGfgm^Z+ T$&wuPEXS>mFWfwb<2?%i5aKT< diff --git a/src/enemies.h b/src/enemies.h index 9ec91a1..f021a9d 100644 --- a/src/enemies.h +++ b/src/enemies.h @@ -72,9 +72,8 @@ static void enemyAnimate(s16 i){ SPR_setHFlip(enemies[i].image, 0); } } - if(enemies[i].flipClock > 0){ + if(enemies[i].flipClock > 0) enemies[i].flipClock--; - } } // loop diff --git a/src/stage.h b/src/stage.h index 44b7eca..9b7a76d 100644 --- a/src/stage.h +++ b/src/stage.h @@ -29,6 +29,10 @@ final boss at 30 seconds left */ +s16 stageClock, + nextClock; + + // groups static void waveSine(bool right){ @@ -239,16 +243,65 @@ static void waveBig4(bool right, bool second){ spawnEnemy(spawner, updater, EMPTY); } +static void waveBig5(bool right){ + struct enemySpawner spawner = { + .angle = 256, + .speed = FIX16(0.75), + .x = 80, + .y = -16, + .image = &fairyRed, + .offX = 16, + .offY = 16, + .health = 6 + }; + if(right) spawner.x = GAME_W - spawner.x; + spawner.bools[0] = right; + void updater(s16 i){ + + if(enemies[i].clock > 0 && enemies[i].clock % 60 == 30 && enemies[i].clock < 240){ + struct bulletSpawner spawner = { + .x = enemies[i].pos.x, + .y = enemies[i].pos.y, + .image = &bigBullet, + .big = TRUE, + .angle = enemies[i].bools[0] ? 512 : 0, + .speed = FIX16(1.5) + }; + spawner.angle += enemies[i].bools[0] ? enemies[i].ints[0] : -enemies[i].ints[0]; + spawner.bools[0] = enemies[i].bools[0]; + void updater(s16 j){ + if(bullets[j].clock > 30 && bullets[j].clock % 16 == 0){ + bullets[j].angle += bullets[j].bools[0] ? -32 : 32; + updateBulletVel(j); + } + } + for(u8 j = 0; j < 5; j++){ + if(j > 0) spawnBullet(spawner, updater); + spawner.angle += enemies[i].bools[0] ? -64 : 64; + } + enemies[i].ints[0] += 56; + } + if(enemies[i].clock == 120 || enemies[i].clock == 180){ + enemies[i].speed = fix16Sub(enemies[i].speed, FIX16(0.1)); + enemies[i].angle += enemies[i].bools[0] ? -64 : 64; + updateEnemyVel(i); + } + + } + spawnEnemy(spawner, updater, EMPTY); +} + + // bosses -#define BOSS_MOD_Y FIX16(16) +#define BOSS_MOD_Y FIX16(8) #define BOSS_MOD_X FIX16(64) fix16 bossLimitY, bossLimitH, bossLimitX, bossLimitW; static void bossIntro(s16 i){ enemies[i].last.x = enemies[i].pos.x; enemies[i].clock = -1; - if(clock % 30 == 0){ + if(clock % 32 == 0){ enemies[i].speed = fix16Sub(enemies[i].speed, FIX16(0.25)); if(enemies[i].speed <= 0){ bossLimitY = fix16Sub(enemies[i].pos.y, BOSS_MOD_Y); @@ -264,21 +317,36 @@ static void bossIntro(s16 i){ } } -s16 bossAnimateClock; +#define BOSS_FLIP_MOD 15 +s16 bossAnimateClock, bossFlipClock; static void bossAnimate(s16 i){ - - if(enemies[i].last.x > enemies[i].pos.x){ - SPR_setAnim(enemies[i].image, 1); - SPR_setFrame(enemies[i].image, 0); - SPR_setHFlip(enemies[i].image, 0); - } else if(enemies[i].last.x < enemies[i].pos.x){ - SPR_setAnim(enemies[i].image, 1); - SPR_setFrame(enemies[i].image, 0); - SPR_setHFlip(enemies[i].image, 1); - } else { + if(enemies[i].flipClock == 0){ + if(enemies[i].last.x > enemies[i].pos.x){ + enemies[i].flipClock = BOSS_FLIP_MOD; + SPR_setAnim(enemies[i].image, 1); + SPR_setFrame(enemies[i].image, 0); + SPR_setHFlip(enemies[i].image, 0); + } else if(enemies[i].last.x < enemies[i].pos.x){ + enemies[i].flipClock = BOSS_FLIP_MOD; + SPR_setAnim(enemies[i].image, 1); + SPR_setFrame(enemies[i].image, 0); + SPR_setHFlip(enemies[i].image, 1); + } else { + enemies[i].flipClock = BOSS_FLIP_MOD; + bossFlipClock = 0; + SPR_setAnim(enemies[i].image, 0); + SPR_setHFlip(enemies[i].image, 0); + } + } + if(enemies[i].flipClock > 0) + enemies[i].flipClock--; + if(enemies[i].last.x == enemies[i].pos.x){ if(bossAnimateClock % 10 == 0) SPR_nextFrame(enemies[i].image); - SPR_setAnim(enemies[i].image, 0); - SPR_setHFlip(enemies[i].image, 0); + } else { + if(bossFlipClock >= 90) SPR_setFrame(enemies[i].image, 0); + else if(bossFlipClock >= 30) SPR_setFrame(enemies[i].image, 1); + else SPR_setFrame(enemies[i].image, 0); + bossFlipClock++; } bossAnimateClock++; } @@ -414,17 +482,14 @@ static void waveMidboss1(){ void suicide(s16 i){ bossHealth = 0; killBullets = TRUE; + nextClock = stageClock + 120; } spawnEnemy(spawner, updater, suicide); } // loop -s16 stageClock, - nextClock; - -s16 currentWave = 42; - +s16 currentWave = 43; static void updateWaves(){ if(stageClock == nextClock){ @@ -494,10 +559,17 @@ static void updateWaves(){ nextClock += currentWave == 41 ? 210 : 30; } + // midboss else if(currentWave == 42){ waveMidboss1(); } + // big from left and right + else if(currentWave < 45){ + waveBig5(currentWave == 44); + nextClock += 60; + } + currentWave++; } }