some stage work
This commit is contained in:
parent
3d47520e18
commit
527d1b8f8d
BIN
res/font.png
BIN
res/font.png
Binary file not shown.
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
@ -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
|
||||
|
|
112
src/stage.h
112
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++;
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue