This commit is contained in:
t. boddy 2026-04-22 19:10:56 -04:00
parent 073f96c9b1
commit 86935184b2
3 changed files with 63 additions and 10 deletions

View file

@ -9,7 +9,7 @@ static u8 getBossPhase(u8 i, u8 numPhases){
}
static fix16 enemyHoneAngle(u8 i){
fix32 dx = getWrappedDelta(player.pos.x, enemies[i].pos.x);
fix32 dx = getWrappedDelta(player.pos.x, enemies[i].pos.x);
fix32 dy = player.pos.y - enemies[i].pos.y;
return getAngle(dx, dy);
}
@ -150,7 +150,6 @@ void updateEnemyFour(u8 i){
// stage 1 boss
static void bossOnePatternOne(u8 i){
if(enemies[i].clock % 60 == 30){
enemies[i].fixes[0] = enemyHoneAngle(i);
@ -260,11 +259,66 @@ static void bossOnePatternThree(u8 i){
}
}
}
// stage 2 boss
static void bossTwoPatternOne(u8 i){
if(enemies[i].clock % 20 == 0){
enemies[i].fixes[0] = enemyHoneAngle(i);
enemies[i].fixes[1] = FIX16(0);
}
if(!enemies[i].onScreen) return;
if(enemies[i].clock % 4 == 0){
if(enemies[i].clock % 120 < 60){
struct bulletSpawner spawner = {
.x = enemies[i].pos.x,
.y = enemies[i].pos.y,
.anim = 6,
.speed = FIX32(5),
.angle = enemies[i].fixes[0] - FIX16(10) + FIX16(random() % 20)
};
spawnBullet(spawner, EMPTY);
} else {
struct bulletSpawner spawner = {
.x = enemies[i].pos.x,
.y = enemies[i].pos.y,
.anim = 3,
.speed = FIX32(6),
.angle = enemies[i].fixes[0] + enemies[i].fixes[1]
};
spawner.ints[0] = 0;
void updater(u8 j){
if(bullets[j].ints[0] == 0 && bullets[j].clock % 5 == 0){
bullets[j].speed -= FIX32(1);
if(bullets[j].speed <= 0){
bullets[j].speed = 0;
bullets[j].ints[0] = 1;
}
updateBulletVel(j);
} else if(bullets[j].ints[0] == 1 && bullets[j].clock % 5 == 0){
bullets[j].speed += FIX32(1);
if(bullets[j].speed >= FIX32(6)){
bullets[j].speed = FIX32(6);
bullets[j].ints[0] = 2;
}
updateBulletVel(j);
}
}
spawnBullet(spawner, updater);
enemies[i].fixes[1] += FIX16(enemies[i].clock % 40 < 20 ? 10 : -10);
}
}
}
// using boss one for all testing of patterns
static void updateBossOne(u8 i){
u8 phase = getBossPhase(i, 3);
if(phase == 0) bossOnePatternOne(i);
else if(phase == 1) bossOnePatternTwo(i);
else bossOnePatternThree(i);
// u8 phase = getBossPhase(i, 3);
// if(phase == 0) bossOnePatternOne(i);
// else if(phase == 1) bossOnePatternTwo(i);
// else bossOnePatternThree(i);
bossTwoPatternOne(i);
}

View file

@ -73,7 +73,7 @@ u16 attractClock;
#define ATTRACT_LIMIT 900 // frames of title idle before attract triggers
#define ATTRACT_DURATION 1800 // 30 seconds of demo gameplay
#define ATTRACT_LEVEL 1 // level index for attract mode (L12: Boss 4, 3 gunners)
#define START_LEVEL 0 // offset added to starting level (0 = normal start)
#define START_LEVEL 2 // offset added to starting level (0 = normal start)
// #define START_LEVEL 0 // offset added to starting level (0 = normal start)
s16 enemyCount, bulletCount;
u8 level;
@ -201,7 +201,7 @@ static const EnemyTypeDef enemyTypeDefs[ENEMY_TYPE_COUNT] = {
{ ENEMY_TYPE_FIVE, 1, 10, 2, 0, 5 },
{ ENEMY_TYPE_SIX, 1, 10, 5, 0, 5 },
{ ENEMY_TYPE_SEVEN, 1, 10, 5, 0, 5 },
{ ENEMY_TYPE_EIGHT, 1, 10, 5, 0, 0 },
{ ENEMY_TYPE_EIGHT, 1, 10, 5, 0, 5 },
{ ENEMY_TYPE_NINE, 1, 10, 5, 0, 5 },
{ ENEMY_TYPE_TEN, 1, 10, 5, 0, 5 },
{ ENEMY_TYPE_ELEVEN, 1, 10, 5, 0, 5 },

View file

@ -1,6 +1,5 @@
#include <genesis.h>
#include <resources.h>
#include "global.h"
#include "background.h"
#include "bullets.h"