diff --git a/res/bg/1.png b/res/bg/1.png index 9962865..612d0f2 100644 Binary files a/res/bg/1.png and b/res/bg/1.png differ diff --git a/res/bg/1l.png b/res/bg/1l.png new file mode 100644 index 0000000..9ceeb69 Binary files /dev/null and b/res/bg/1l.png differ diff --git a/res/bg/1r.png b/res/bg/1r.png new file mode 100644 index 0000000..bbf2ca9 Binary files /dev/null and b/res/bg/1r.png differ diff --git a/res/font.png b/res/font.png index 79822df..09e618d 100644 Binary files a/res/font.png and b/res/font.png differ diff --git a/res/resources.res b/res/resources.res index f46d91e..aa1c19c 100644 --- a/res/resources.res +++ b/res/resources.res @@ -15,6 +15,8 @@ IMAGE bossBar "chrome/boss.png" FAST // background IMAGE bg1 "bg/1.png" FAST +IMAGE bg1L "bg/1l.png" FAST +IMAGE bg1R "bg/1r.png" FAST // player and enemies diff --git a/src/background.h b/src/background.h index cc871db..8ee0247 100644 --- a/src/background.h +++ b/src/background.h @@ -8,11 +8,22 @@ // draw +s16 bgI; +Image* bgImage; static void drawBg(){ for(u16 x = 0; x < BG_W; x++) for(u16 y = 0; y < BG_H; y++){ if(x % 8 == 0 && y % 8 == 0){ - VDP_drawImageEx(BG_B, &bg1, TILE_ATTR_FULL(PAL1, 0, 0, 0, BG_I + 1), x - 4, y, 0, DMA); + bgI = BG_I; + bgImage = &bg1; + if(x == 8){ + bgI += 64; + bgImage = &bg1L; + } else if(x == 24){ + bgI += 128; + bgImage = &bg1R; + } + if(x != 16) VDP_drawImageEx(BG_B, bgImage, TILE_ATTR_FULL(PAL1, 0, 0, 0, bgI), x - 4, y, 0, DMA); } } } @@ -26,15 +37,26 @@ static void drawBg(){ #define BG_SIZE 64 #define BG_LIMIT FIX16(-256) +#define BG_MOD FIX16(0.25) + s16 bgPos; fix16 bgPosF; +fix16 bgSpeed = BG_SPEED; static void scrollBg(){ - bgPosF = fix16Sub(bgPosF, BG_SPEED); - if(bgPosF <= BG_LIMIT) bgPosF = fix16Sub(bgPosF, BG_LIMIT); - bgPos = fix16ToInt(bgPosF); + if(bossHealth > 0){ + if(bgSpeed > 0) if(clock % 10 == 0) bgSpeed = fix16Sub(bgSpeed, BG_MOD); + } else { + if(bgSpeed < BG_SPEED) if(clock % 10 == 0) bgSpeed = fix16Add(bgSpeed, BG_MOD); + } + if(bgSpeed > 0){ + bgPosF = fix16Sub(bgPosF, bgSpeed); + if(bgPosF <= BG_LIMIT) bgPosF = fix16Sub(bgPosF, BG_LIMIT); + bgPos = fix16ToInt(bgPosF); + } } + // loop void loadBg(){ diff --git a/src/chrome.h b/src/chrome.h index 8327faa..d6c96e3 100644 --- a/src/chrome.h +++ b/src/chrome.h @@ -81,6 +81,16 @@ static void loadBombs(){ } +// speed + +#define SPEED_X 24 +#define SPEED_Y 1 + +static void loadSpeed(){ + VDP_drawText("+++", SPEED_X, SPEED_Y); +} + + // loop void loadChrome(){ @@ -89,6 +99,7 @@ void loadChrome(){ loadTime(); loadLives(); loadBombs(); + loadSpeed(); } void updateChrome(){ diff --git a/src/enemies.h b/src/enemies.h index 4ab8aa6..a97b687 100644 --- a/src/enemies.h +++ b/src/enemies.h @@ -89,7 +89,10 @@ static void updateEnemy(s16 i){ enemies[i].dead = TRUE; enemies[i].suicide(i); } else { - if(!enemies[i].seen && enemies[i].pos.y >= fix16Sub(0, enemies[i].off.y)){ + if(!enemies[i].seen && + enemies[i].pos.y >= fix16Sub(0, enemies[i].off.y) && + enemies[i].pos.x >= fix16Sub(0, enemies[i].off.x) && + enemies[i].pos.x <= fix16Add(FIX16(GAME_W), enemies[i].off.x)){ enemies[i].seen = TRUE; SPR_setVisibility(enemies[i].image, VISIBLE); } diff --git a/src/stage.h b/src/stage.h index ac8d0f4..abe875a 100644 --- a/src/stage.h +++ b/src/stage.h @@ -1,33 +1,5 @@ // stage -/* - -sine from left -sine from right -big middle -sine from left, big right -sine from right, big left -big middle -swarm -big from left and right -swarm, big right -swarm, big left - -midboss - -big from left and right -big from right and left -big from left, small formation -big from right, small formation -big from left, small formation -big from right, small formation - -midboss - -final boss at 30 seconds left - -*/ - s16 stageClock, nextClock; @@ -290,15 +262,71 @@ static void waveBig5(bool right){ } 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; + if(enemies[i].clock == 120){ + enemies[i].speed = FIX16(0.5); updateEnemyVel(i); } } spawnEnemy(spawner, updater, EMPTY); } +static void waveBig6(bool right){ + struct enemySpawner spawner = { + .angle = right ? 512 : 0, + .speed = FIX16(1), + .x = right ? (GAME_W + 16) : -32, + .y = 40, + .image = right ? &fairyGreen : &fairyYellow, + .offX = 16, + .offY = 16, + .health = 4 + }; + spawner.bools[0] = right; + void updater(s16 i){ + if(enemies[i].clock % 10 == 0 && enemies[i].clock >= 60 && enemies[i].clock < 180){ + enemies[i].angle += enemies[i].bools[0] ? -24 : 24; + updateEnemyVel(i); + } + if(enemies[i].clock % 35 == 0 && enemies[i].clock > 0 && enemies[i].clock < 180){ + struct bulletSpawner spawner = { + .x = enemies[i].pos.x, + .y = enemies[i].pos.y + }; + for(u8 j = 0; j < 4; j++){ + spawner.angle = random() % 256; + if(enemies[i].bools[0]) spawner.angle += 256; + if(j < 2){ + spawner.speed = FIX16(1.25); + spawner.big = TRUE; + spawner.image = &bigBullet; + } else { + spawner.speed = FIX16(1.75); + spawner.light = TRUE; + spawner.image = &smallBullet; + } + spawnBullet(spawner, EMPTY); + } + } + + } + spawnEnemy(spawner, updater, EMPTY); +} + + +static void waveFormation(bool right){ + struct enemySpawner spawner = { + .angle = 256, + .speed = FIX16(0.75), + .x = 80, + .y = -16, + .image = &fairyRed, + .offX = 16, + .offY = 16, + .health = 6 + }; + // spawnEnemy(spawner) +} + // bosses @@ -387,7 +415,7 @@ static void waveMidboss1(){ .offX = 24, .offY = 28, .boss = TRUE, - .health = 50 + .health = 40 }; bossMax = spawner.health; void updater(s16 i){ @@ -395,7 +423,7 @@ static void waveMidboss1(){ if(enemies[i].bools[0]){ bossHealth = enemies[i].health; bossMove(i); - if(enemies[i].health >= 25){ + if(enemies[i].health >= 20){ // ring if(enemies[i].clock % 90 == 0){ struct bulletSpawner spawner = { @@ -494,7 +522,7 @@ static void waveMidboss1(){ // loop -s16 currentWave = 0; +s16 currentWave = 13; void updateStage(){ if(enemyCount == 0){ @@ -539,12 +567,12 @@ void updateStage(){ waveSwarm(2); waveBig4(TRUE, TRUE); break; - case 9: // swarm (2), big left + case 9: waveSwarm(2); waveBig4(FALSE, TRUE); break; - // midboss + // midboss case 10: waveMidboss1(); break; @@ -553,6 +581,16 @@ void updateStage(){ waveBig5(FALSE); waveBig5(TRUE); break; + // big from right and left + case 12: + waveBig6(TRUE); + waveBig6(FALSE); + break; + // big from left, small formation + case 13: + waveBig6(FALSE); + waveFormation(TRUE); + break; } currentWave++; @@ -560,4 +598,33 @@ void updateStage(){ stageClock++; if(stageClock >= CLOCK_LIMIT) stageClock -= CLOCK_LIMIT; -} \ No newline at end of file +} + + +/* + +sine from left +sine from right +big middle +sine from left, big right +sine from right, big left +big middle +swarm +big from left and right +swarm, big right +swarm, big left + +midboss + +big from left and right +big from right and left +big from left, small formation +big from right, small formation +big from left, small formation +big from right, small formation + +midboss + +final boss at 30 seconds left + +*/ \ No newline at end of file