stage work

This commit is contained in:
t. boddy 2022-09-25 11:03:50 -04:00
parent e4cae0cd74
commit 50a59a2df1
3 changed files with 155 additions and 29 deletions

View File

@ -19,7 +19,8 @@
#define INVINCIBLE_LIMIT 60 * 4
bool killBullets,
started;
started,
fiveMinuteMode;
s16 clock, timeLeft, enemyCount,
bossHealth, bossMax;

View File

@ -443,7 +443,7 @@ static void waveMidboss1(){
if(enemies[i].bools[0]){
bossHealth = enemies[i].health;
bossMove(i);
if(enemies[i].health >= 20){
if(enemies[i].health > 20){
// ring
if(enemies[i].clock % 90 == 0){
struct bulletSpawner spawner = {
@ -551,7 +551,7 @@ static void waveMidboss2(){
.offX = 24,
.offY = 28,
.boss = TRUE,
.health = 15
.health = 60
};
bossMax = spawner.health;
void updater(s16 i){
@ -559,8 +559,7 @@ static void waveMidboss2(){
if(enemies[i].bools[0]){
bossHealth = enemies[i].health;
bossMove(i);
if(enemies[i].health >= 40){
if(enemies[i].health > 40){
// laser
if(enemies[i].clock % 30 == 0){
struct bulletSpawner spawner = {
@ -574,7 +573,6 @@ static void waveMidboss2(){
};
spawnBullet(spawner, EMPTY);
}
// homing
if(enemies[i].clock > 0 && enemies[i].clock % 15 == 10){
struct bulletSpawner spawner = {
@ -596,9 +594,12 @@ static void waveMidboss2(){
spawnBullet(spawner, updater);
spawnExplosion(spawner.x, spawner.y, 3);
}
} else if(enemies[i].health >= 20){
} else if(enemies[i].health > 20){
if(!enemies[i].bools[7]){
killBullets = TRUE;
enemies[i].bools[7] = TRUE;
enemies[i].clock = -60;
}
// ring
if(enemies[i].clock % 5 == 0){
struct bulletSpawner spawner = {
@ -621,7 +622,6 @@ static void waveMidboss2(){
}
spawnBullet(spawner, updater);
}
// lasers
if(enemies[i].clock % 15 == 0){
struct bulletSpawner spawner = {
@ -634,14 +634,18 @@ static void waveMidboss2(){
};
spawnBullet(spawner, EMPTY);
}
} else {
if(!enemies[i].bools[6]){
killBullets = TRUE;
enemies[i].bools[6] = TRUE;
enemies[i].clock = -60;
}
if(enemies[i].clock % 5 == 0){
struct bulletSpawner spawner = {
.x = enemies[i].pos.x,
.y = enemies[i].pos.y,
.image = &bigBullet,
.big = TRUE,
.light = TRUE,
.speed = FIX16(2),
.top = TRUE,
@ -658,6 +662,129 @@ static void waveMidboss2(){
}
spawnBullet(spawner, updater);
}
}
} else bossIntro(i);
}
void suicide(s16 i){
bossHealth = 0;
killBullets = TRUE;
}
spawnEnemy(spawner, updater, suicide);
}
static void waveBoss1(){
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 = 60
};
bossMax = spawner.health;
void updater(s16 i){
bossAnimate(i);
if(enemies[i].bools[0]){
bossHealth = enemies[i].health;
bossMove(i);
if(enemies[i].health > 60){
// homing
if(enemies[i].clock % 15 == 10){
struct bulletSpawner spawner = {
.x = enemies[i].pos.x,
.y = enemies[i].pos.y,
.image = &bigBullet,
.big = TRUE,
.angle = 256,
.speed = FIX16(2),
.top = TRUE
};
spawner.vel = hone(enemies[i].pos, player.pos, spawner.speed, 32);
spawnBullet(spawner, EMPTY);
}
// puke
else if(enemies[i].clock % 15 == 0 || enemies[i].clock % 15 == 5){
struct bulletSpawner spawner = {
.x = enemies[i].pos.x,
.y = enemies[i].pos.y,
.image = &bigBullet,
.big = TRUE,
.angle = 64 + random() % 384,
.speed = FIX16(1.25),
.light = TRUE
};
spawnBullet(spawner, EMPTY);
}
} else if(enemies[i].health > 40){
if(!enemies[i].bools[3]){
enemies[i].bools[3] = TRUE;
struct bulletSpawner spawner = {
.x = enemies[i].pos.x,
.y = enemies[i].pos.y,
.image = &hugeBullet,
.huge = TRUE,
.angle = 768,
.speed = FIX16(2)
};
void updater(s16 j){
if(bullets[j].clock >= 20 && !bullets[j].bools[0]){
bullets[j].fixes[0] = bullets[j].pos.x;
bullets[j].fixes[1] = bullets[j].pos.y;
bullets[j].bools[0] = TRUE;
bullets[j].clock = -1;
bullets[j].angle = 0;
updateBulletVel(j);
} else if(bullets[j].bools[0]){
if(bullets[j].clock % 20 == 15){
bullets[j].angle += 64;
if(bullets[j].angle >= 1024){
bullets[j].angle -= 1024;
// bullets[j].pos.x = bullets[j].fixes[0];
// bullets[j].pos.y = bullets[j].fixes[1];
}
updateBulletVel(j);
}
if(bullets[j].clock % 20 == 0){
struct bulletSpawner spawner = {
.x = bullets[j].pos.x,
.y = bullets[j].pos.y,
.image = &bigBullet,
.big = TRUE,
// .angle = bullets[j].ints[2],
.angle = 0,
.light = bullets[j].clock % 40 == 0,
.top = TRUE,
.speed = FIX16(1.75)
};
for(u8 h = 0; h < 16; h++){
if(bullets[j].angle < 256){
if(spawner.angle >= 256 && spawner.angle < 512) spawnBullet(spawner, EMPTY);
} else if(bullets[j].angle < 512){
if(spawner.angle >= 512 && spawner.angle < 768) spawnBullet(spawner, EMPTY);
} else if(bullets[j].angle < 768){
if(spawner.angle >= 768) spawnBullet(spawner, EMPTY);
} else {
if(spawner.angle < 256) spawnBullet(spawner, EMPTY);
}
spawner.angle += 64;
}
bullets[j].ints[2] += 50;
if(bullets[j].ints[2] >= 1024) bullets[j].ints[2] -= 1024;
}
}
}
spawnBullet(spawner, updater);
}
} else if(enemies[i].health > 20){
} else {
}
} else bossIntro(i);
@ -669,11 +796,9 @@ static void waveMidboss2(){
spawnEnemy(spawner, updater, suicide);
}
static void waveBoss1(){}
// loop
s16 currentWave = 17;
s16 currentWave = 18;
void updateStage(){
if(enemyCount == 0){

View File

@ -1,11 +1,9 @@
// start
bool selectingStartMenu, aboutShowing;
u8 currentStartMenu;
bool selectingStartMenu;
#define START_W 32
#define START_H 28
#define START_I 32
@ -13,21 +11,13 @@ u8 currentStartMenu;
static void loadGameFromStart(){
selectingStartMenu = FALSE;
aboutShowing = FALSE;
VDP_clearTileMapRect(BG_A, 0, 0, START_W, START_H);
VDP_clearTileMapRect(BG_B, 0, 0, START_W, START_H);
loadGame();
}
static void selectStartMenu(){
selectingStartMenu = TRUE;
switch(currentStartMenu){
case 0: loadGameFromStart(); break;
}
}
// draw
// bg logo
static void drawStartBg(){
VDP_fillTileMapRect(BG_B, TILE_ATTR_FULL(PAL1, 0, 0, 0, START_I), 0, 0, START_W, START_H);
@ -40,6 +30,9 @@ static void drawStartLogo(){
VDP_drawImageEx(BG_B, &startLogo1, TILE_ATTR_FULL(PAL1, 0, 0, 0, START_I + 32), LOGO_X, LOGO_Y, 0, DMA);
}
// menu
#define MENU_X 7
#define MENU_Y 17
@ -49,12 +42,17 @@ static void drawStartMenu(){
VDP_drawText("2022 T.BODDY", MENU_X + 3, 26);
}
static void selectStartMenu(){
selectingStartMenu = TRUE;
fiveMinuteMode = !fiveMinuteMode;
VDP_drawText(fiveMinuteMode ? "5" : "2", MENU_X + 2, MENU_Y + 2);
}
// loop
void loadStart(){
VDP_setScreenWidth256();
currentStartMenu = 0;
VDP_loadTileSet(startBg1.tileset, START_I, DMA);
// drawStartBg();
@ -66,5 +64,7 @@ void loadStart(){
}
void updateStart(){
if((ctrl.a || ctrl.start) && !aboutShowing && !selectingStartMenu) selectStartMenu();
if(ctrl.start && !selectingStartMenu) loadGameFromStart();
else if((ctrl.left || ctrl.right || ctrl.up || ctrl.down) && !selectingStartMenu) selectStartMenu();
else if(selectingStartMenu && !ctrl.left && !ctrl.right && !ctrl.up && !ctrl.down) selectingStartMenu = FALSE;
}