-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEnemy.cpp
More file actions
462 lines (420 loc) · 23.3 KB
/
Copy pathEnemy.cpp
File metadata and controls
462 lines (420 loc) · 23.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
#include "Enemy.h"
#include "Bullet.h"
#include "SpriteManager.h"
#include "Effects.h"
#include <cmath>
#include <algorithm>
static Vector2 Norm(Vector2 v) {
float len = std::sqrt(v.x * v.x + v.y * v.y);
if (len <= 0.0001f) return {0, 1};
return {v.x / len, v.y / len};
}
static float WrapAngle(float a) {
while (a < -PI) a += PI * 2.0f;
while (a > PI) a -= PI * 2.0f;
return a;
}
Enemy::Enemy(EnemyType t, Vector2 p, int loop, int formId) : type(t), pos(p), formationId(formId), aimAngle(0.0f), bossPanelsShed(false) {
if (type == EnemyType::Popcorn) {
radius = 15; hp = maxHp = 2 + loop / 2; scoreValue = 120; vel = {0, 105}; drift = (float)GetRandomValue(-48, 48);
} else if (type == EnemyType::Turret) {
radius = 21; hp = maxHp = 7 + loop * 2; scoreValue = 420; vel = {0, 42};
} else {
radius = 55; hp = maxHp = 230 + loop * 45; scoreValue = 9000 + loop * 1250; vel = {0, 44}; phase = 0;
}
}
void Enemy::FireAimed(Vector2 playerPos, std::vector<Bullet>& enemyBullets, float speed, int damage) const {
Vector2 d = Norm({playerPos.x - pos.x, playerPos.y - pos.y});
float size = IsBoss() ? 8.4f : 6.4f;
Color c = IsBoss() ? Color{255, 42, 76, 255} : PINK;
enemyBullets.emplace_back(pos, Vector2{d.x * speed, d.y * speed}, size, damage, BulletOwner::Enemy, c);
}
void Enemy::FireRadial(std::vector<Bullet>& enemyBullets, int count, float speed, float angleOffset) const {
float size = IsBoss() ? 8.0f : 5.8f;
Color c = IsBoss() ? Color{255, 72, 128, 255} : MAGENTA;
for (int i = 0; i < count; ++i) {
float a = angleOffset + (float)i / (float)count * 6.2831853f;
enemyBullets.emplace_back(pos, Vector2{std::cos(a) * speed, std::sin(a) * speed}, size, 1, BulletOwner::Enemy, c);
}
}
void Enemy::FireAimedFan(Vector2 playerPos, std::vector<Bullet>& enemyBullets, int count, float speed, float spread, Color color, float size) const {
Vector2 d = Norm({playerPos.x - pos.x, playerPos.y - pos.y});
float base = std::atan2(d.y, d.x);
int center = count / 2;
for (int i = 0; i < count; ++i) {
float a = base + (float)(i - center) * spread;
enemyBullets.emplace_back(pos, Vector2{std::cos(a) * speed, std::sin(a) * speed}, size, 1, BulletOwner::Enemy, color);
}
}
void Enemy::FireRadialCustom(std::vector<Bullet>& enemyBullets, int count, float speed, float angleOffset, Color color, float size) const {
for (int i = 0; i < count; ++i) {
float a = angleOffset + (float)i / (float)count * PI * 2.0f;
enemyBullets.emplace_back(pos, Vector2{std::cos(a) * speed, std::sin(a) * speed}, size, 1, BulletOwner::Enemy, color);
}
}
void Enemy::FireRadialGap(std::vector<Bullet>& enemyBullets, int count, float speed, float angleOffset, float gapCenter, float gapWidth, Color color, float size) const {
for (int i = 0; i < count; ++i) {
float a = angleOffset + (float)i / (float)count * PI * 2.0f;
if (std::abs(WrapAngle(a - gapCenter)) < gapWidth * 0.5f) continue;
enemyBullets.emplace_back(pos, Vector2{std::cos(a) * speed, std::sin(a) * speed}, size, 1, BulletOwner::Enemy, color);
}
}
bool Enemy::ReadyToFire(float rate) {
if (age < fireDelay) return false;
if (maxShots >= 0 && shotsFired >= maxShots) return false;
if (fireTimer <= rate) return false;
fireTimer = 0.0f;
++shotsFired;
return true;
}
void Enemy::SetBossPhase(BossAttackPhase nextPhase) {
int next = static_cast<int>(nextPhase);
if (phase == next) return;
phase = next;
phaseTimer = 0.0f;
fireTimer = -1.10f;
}
void Enemy::BeginBossCombat() {
if (!IsBoss()) return;
SetBossPhase(BossAttackPhase::AzureNeedle);
}
const char* Enemy::BossAttackTitle() const {
switch (BossPhase()) {
case BossAttackPhase::AzureNeedle: return "Gate Sign: Needle Lattice";
case BossAttackPhase::FallingStar: return "Vector Sign: Falling Star Lock";
case BossAttackPhase::BrokenHalo: return "Circuit Sign: White Halo Denial";
case BossAttackPhase::Overload: return "Final Sign: Core Collapse Mandate";
case BossAttackPhase::Entrance:
default: return "Hostile Frame: VANTAGE-9";
}
}
void Enemy::Update(float dt, Vector2 playerPos, std::vector<Bullet>& enemyBullets, int loop) {
age += dt;
fireTimer += dt;
phaseTimer += dt;
if (hitFlashTimer > 0.0f) hitFlashTimer -= dt;
if (type == EnemyType::Popcorn) {
switch (movePattern) {
case EnemyMovePattern::Straight:
pos.x += vel.x * dt;
pos.y += vel.y * dt;
break;
case EnemyMovePattern::NeedleSweep:
pos.x += (vel.x + std::sin(age * 5.2f + scriptPhase) * 18.0f) * dt;
pos.y += vel.y * dt;
break;
case EnemyMovePattern::DescendingScissors: {
float weave = std::sin(age * 2.8f + scriptPhase) * 54.0f;
pos.x += (vel.x + weave) * dt;
pos.y += (vel.y + std::max(0.0f, age - 1.0f) * 22.0f) * dt;
break;
}
case EnemyMovePattern::CrossLane:
pos.x += (vel.x + std::sin(age * 4.4f + scriptPhase) * 10.0f) * dt;
pos.y += (vel.y + std::cos(age * 2.0f + scriptPhase) * 20.0f) * dt;
break;
case EnemyMovePattern::Pincer:
pos.x += (vel.x * (1.0f + std::min(age, 1.6f) * 0.22f)) * dt;
pos.y += vel.y * dt;
break;
case EnemyMovePattern::CollapseRetreat: {
float turn = age > 1.35f ? std::min(1.0f, (age - 1.35f) * 1.4f) : 0.0f;
pos.x += (vel.x + std::sin(scriptPhase) * 95.0f * turn) * dt;
pos.y += (vel.y - 72.0f * turn) * dt;
break;
}
default:
pos.x += (vel.x + std::sin(age * 4.2f) * drift) * dt;
pos.y += vel.y * dt;
break;
}
if (pos.y > 36 && pos.y < 430) {
if (firePattern == EnemyFirePattern::Default) {
if (ReadyToFire(1.45f - std::min(0.28f, loop * 0.025f))) {
FireAimed(playerPos, enemyBullets, 132.0f + loop * 8.0f);
}
} else if (firePattern == EnemyFirePattern::AimedSingle) {
if (ReadyToFire(0.0f)) FireAimed(playerPos, enemyBullets, 136.0f + loop * 7.0f);
} else if (firePattern == EnemyFirePattern::FanPulse) {
float rate = fireRate > 0.0f ? fireRate : 1.05f;
if (ReadyToFire(rate)) {
FireAimedFan(playerPos, enemyBullets, 3, 128.0f + loop * 6.0f, 0.14f, Color{255, 96, 196, 255}, 6.0f);
}
}
}
} else if (type == EnemyType::Turret) {
if (movePattern == EnemyMovePattern::GatePatrol) {
pos.y += vel.y * dt;
if (pos.y > 84.0f) vel.y = 9.0f;
pos.x += std::sin(age * 1.15f + scriptPhase) * 18.0f * dt;
} else {
pos.y += vel.y * dt;
if (pos.y > 118) vel.y = 15.0f;
}
if (pos.y > 20 && pos.y < 520 && firePattern != EnemyFirePattern::Hold) {
if (firePattern == EnemyFirePattern::TurretBurst) {
float rate = fireRate > 0.0f ? fireRate : 0.38f;
if (ReadyToFire(rate)) {
FireAimed(playerPos, enemyBullets, 158.0f + loop * 6.0f);
}
} else {
if (ReadyToFire(1.10f - std::min(0.18f, loop * 0.018f))) {
FireAimed(playerPos, enemyBullets, 152.0f + loop * 6.0f);
}
}
}
} else {
BossAttackPhase current = BossPhase();
if (current == BossAttackPhase::Entrance) {
pos.x = 240.0f + std::sin(age * 3.0f) * 6.0f;
if (pos.y < 108.0f) pos.y = std::min(108.0f, pos.y + vel.y * dt);
} else {
if (hp <= maxHp / 4) {
SetBossPhase(BossAttackPhase::Overload);
} else if (hp <= maxHp / 2) {
SetBossPhase(BossAttackPhase::BrokenHalo);
} else if (current == BossAttackPhase::AzureNeedle && phaseTimer > 8.5f) {
SetBossPhase(BossAttackPhase::FallingStar);
} else if (current == BossAttackPhase::FallingStar && phaseTimer > 8.0f) {
SetBossPhase(BossAttackPhase::AzureNeedle);
}
current = BossPhase();
if (current == BossAttackPhase::AzureNeedle) {
pos.x = 240.0f + std::sin(phaseTimer * 0.58f) * 92.0f;
pos.y = 108.0f + std::sin(phaseTimer * 1.35f) * 7.0f;
float rate = std::max(0.82f, 1.18f - loop * 0.026f);
if (fireTimer > rate) {
fireTimer = 0.0f;
int burst = ((int)(phaseTimer / rate) % 4 == 3) ? 1 : 3;
FireAimedFan(playerPos, enemyBullets, burst, 162.0f + loop * 6.0f, 0.135f, Color{72, 190, 255, 255}, 7.2f);
if (((int)(phaseTimer / rate) % 3) == 1) {
Vector2 left = {pos.x - 54.0f, pos.y + 2.0f};
Vector2 right = {pos.x + 54.0f, pos.y + 2.0f};
Vector2 dl = Norm({playerPos.x - left.x, playerPos.y - left.y});
Vector2 dr = Norm({playerPos.x - right.x, playerPos.y - right.y});
enemyBullets.emplace_back(left, Vector2{dl.x * (148.0f + loop * 5.0f), dl.y * (148.0f + loop * 5.0f)}, 6.4f, 1, BulletOwner::Enemy, Color{255, 228, 92, 255});
enemyBullets.emplace_back(right, Vector2{dr.x * (148.0f + loop * 5.0f), dr.y * (148.0f + loop * 5.0f)}, 6.4f, 1, BulletOwner::Enemy, Color{255, 228, 92, 255});
}
}
} else if (current == BossAttackPhase::FallingStar) {
pos.x = 240.0f + std::sin(phaseTimer * 0.58f) * 74.0f;
pos.y = 114.0f + std::sin(phaseTimer * 1.10f) * 12.0f;
float rate = std::max(0.48f, 0.66f - loop * 0.010f);
if (fireTimer > rate) {
fireTimer = 0.0f;
int count = 12 + std::min(4, loop);
float speed = 70.0f + loop * 3.5f;
FireRadialGap(enemyBullets, count, speed, phaseTimer * 0.95f, PI * 0.5f, 0.78f, Color{255, 96, 196, 255}, 6.8f);
if (((int)(phaseTimer * 2.4f) % 3) == 0) {
float ring = 34.0f;
for (int i = 0; i < 4; ++i) {
float a = phaseTimer * 0.95f + (float)i / 4.0f * PI * 2.0f;
Vector2 origin = {pos.x + std::cos(a) * ring, pos.y + std::sin(a) * ring};
enemyBullets.emplace_back(origin, Vector2{std::cos(a) * speed * 0.72f, std::sin(a) * speed * 0.72f}, 6.2f, 1, BulletOwner::Enemy, Color{80, 230, 255, 255});
}
}
}
} else if (current == BossAttackPhase::BrokenHalo) {
float damageRatio = 1.0f - (float)hp / (float)maxHp;
pos.x = 240.0f + std::sin(phaseTimer * 1.25f) * 58.0f + std::sin(age * 29.0f) * 2.4f * damageRatio;
pos.y = 112.0f + std::sin(phaseTimer * 2.6f) * 9.0f + std::cos(age * 23.0f) * 1.6f * damageRatio;
float cycle = std::fmod(phaseTimer, 3.6f);
if (cycle < 2.35f && fireTimer > 0.64f) {
fireTimer = 0.0f;
float gap = PI * 0.5f + std::sin(phaseTimer * 0.7f) * 0.62f;
FireRadialGap(enemyBullets, 18 + std::min(5, loop), 82.0f + loop * 3.2f, phaseTimer * 1.25f, gap, 1.00f, Color{255, 126, 38, 255}, 6.8f);
if (((int)(phaseTimer * 2.0f) % 4) == 1) {
FireAimedFan(playerPos, enemyBullets, 3, 176.0f + loop * 5.0f, 0.11f, Color{255, 56, 82, 255}, 7.4f);
}
}
} else if (current == BossAttackPhase::Overload) {
pos.x = 240.0f + std::sin(phaseTimer * 1.35f) * 106.0f + std::sin(age * 22.0f) * 2.5f;
pos.y = 103.0f + std::sin(phaseTimer * 2.4f) * 10.0f;
float cycle = std::fmod(phaseTimer, 3.45f);
if (cycle < 2.12f && fireTimer > std::max(0.34f, 0.45f - loop * 0.01f)) {
fireTimer = 0.0f;
float safeLane = PI * 0.5f + std::sin(phaseTimer * 0.9f) * 0.42f;
FireRadialGap(enemyBullets, 14 + std::min(4, loop), 104.0f + loop * 3.0f, age * 1.65f, safeLane, 0.88f, Color{255, 40, 108, 255}, 7.0f);
if (((int)(phaseTimer * 3.2f) % 2) == 0) {
for (int i = 0; i < 5; ++i) {
float a = -age * 1.05f + (float)i / 5.0f * PI * 2.0f;
Vector2 origin = {pos.x + std::cos(a) * 56.0f, pos.y + std::sin(a) * 56.0f};
Vector2 inward = Norm({pos.x - origin.x, pos.y + 28.0f - origin.y});
enemyBullets.emplace_back(origin, Vector2{inward.x * (82.0f + loop * 2.5f), inward.y * (82.0f + loop * 2.5f)}, 6.2f, 1, BulletOwner::Enemy, Color{128, 230, 255, 255});
}
}
}
}
}
}
// Dynamic rotation angle calculation pointing to player
if (type == EnemyType::Turret || type == EnemyType::Miniboss) {
float dx = playerPos.x - pos.x;
float dy = playerPos.y - pos.y;
aimAngle = std::atan2(dy, dx) * 57.29578f + 90.0f; // degrees, facing up as base
}
}
void Enemy::Hit(int damage, Effects& effects) {
hp -= damage;
hitFlashTimer = 0.08f;
// Direct impact flash spark burst
effects.Spark(pos, WHITE);
// Boss Phase 2 Armor Shedding transition
if (IsBoss() && hp <= maxHp / 2 && !bossPanelsShed) {
bossPanelsShed = true;
effects.DebrisShower(pos, Color{125, 130, 150, 255}, 18);
effects.Explosion(pos, Color{255, 70, 80, 255}, 26, SpriteId::DebrisBossCore);
effects.Spark(pos, WHITE, {0.0f, -80.0f});
effects.Shake(13.0f, 0.42f);
effects.AddText(pos, "ARMOR BREACH", RED);
}
if (hp <= 0) active = false;
}
bool Enemy::Offscreen(int height) const { return pos.y > height + 70 || pos.x < -90 || pos.x > 570; }
void Enemy::Draw(bool debug) const {
bool flash = hitFlashTimer > 0.0f;
Color tint = flash ? Color{ 255, 100, 100, 255 } : WHITE;
if (type == EnemyType::Popcorn) {
if (fireDelay > age && fireDelay - age < 0.45f && firePattern != EnemyFirePattern::Hold) {
float telegraph = 1.0f - (fireDelay - age) / 0.45f;
BeginBlendMode(BLEND_ADDITIVE);
DrawCircleLines((int)pos.x, (int)pos.y, 17.0f + telegraph * 6.0f, Fade(Color{90, 210, 255, 255}, 0.45f * telegraph));
EndBlendMode();
}
// Flickering engine plume at top (moving downwards)
if ((int)(age * 18) % 2 == 0) {
float plumeH = 8.0f + std::sin(age * 50.0f) * 3.0f;
DrawTriangle(
{pos.x - 3, pos.y - 12},
{pos.x, pos.y - 12 - plumeH},
{pos.x + 3, pos.y - 12},
ORANGE
);
}
// Draw Popcorn ship sprite rotated 180 degrees
SpriteManager::Instance().Draw(SpriteId::Popcorn, pos, 180.0f, 1.8f, tint);
} else if (type == EnemyType::Turret) {
if (fireDelay > age && fireDelay - age < 0.55f && firePattern != EnemyFirePattern::Hold) {
float telegraph = 1.0f - (fireDelay - age) / 0.55f;
BeginBlendMode(BLEND_ADDITIVE);
DrawCircleLines((int)pos.x, (int)pos.y, 22.0f + telegraph * 8.0f, Fade(ORANGE, 0.5f * telegraph));
EndBlendMode();
}
// Draw Turret Base
SpriteManager::Instance().Draw(SpriteId::TurretBase, pos, 0.0f, 1.8f, tint);
// Draw Barrel pointing directly at player (with recoil frame shift if recently fired)
SpriteId barrelId = (fireTimer < 0.12f) ? SpriteId::TurretBarrelRecoil : SpriteId::TurretBarrel;
SpriteManager::Instance().Draw(barrelId, pos, aimAngle, 1.8f, tint);
} else {
// Draw boss
bool phase2 = (hp <= maxHp / 2);
SpriteId bossSprite = phase2 ? SpriteId::BossDamaged : SpriteId::Boss;
// Double engine plumes at the top (facing down)
float flameRate = phase2 ? 24.0f : 14.0f;
if ((int)(age * flameRate) % 2 == 0) {
float plumeH = (phase2 ? 20.0f : 15.0f) + std::sin(age * 54.0f) * (phase2 ? 7.0f : 5.0f);
DrawTriangle({pos.x - 24, pos.y - 48}, {pos.x - 28, pos.y - 48 - plumeH}, {pos.x - 20, pos.y - 48}, ORANGE);
DrawTriangle({pos.x - 23, pos.y - 48}, {pos.x - 25, pos.y - 48 - (plumeH * 0.6f)}, {pos.x - 21, pos.y - 48}, YELLOW);
DrawTriangle({pos.x + 24, pos.y - 48}, {pos.x + 20, pos.y - 48}, {pos.x + 28, pos.y - 48 - plumeH}, ORANGE);
DrawTriangle({pos.x + 23, pos.y - 48}, {pos.x + 21, pos.y - 48}, {pos.x + 25, pos.y - 48 - (plumeH * 0.6f)}, YELLOW);
}
// Draw Boss sprite facing down (180 degrees)
SpriteManager::Instance().Draw(bossSprite, pos, 180.0f, 1.8f, tint);
// VANTAGE-9 gatekeeper silhouette fins, drawn procedurally to separate it from regular carriers.
Color gateColor = phase2 ? Color{180, 38, 60, 255} : Color{70, 150, 190, 255};
DrawTriangle({pos.x - 62.0f, pos.y - 18.0f}, {pos.x - 88.0f, pos.y + 2.0f}, {pos.x - 58.0f, pos.y + 18.0f}, Fade(gateColor, 0.86f));
DrawTriangle({pos.x + 62.0f, pos.y - 18.0f}, {pos.x + 58.0f, pos.y + 18.0f}, {pos.x + 88.0f, pos.y + 2.0f}, Fade(gateColor, 0.86f));
DrawLineEx({pos.x - 82.0f, pos.y + 2.0f}, {pos.x - 50.0f, pos.y + 2.0f}, 2.0f, Fade(WHITE, 0.34f));
DrawLineEx({pos.x + 50.0f, pos.y + 2.0f}, {pos.x + 82.0f, pos.y + 2.0f}, 2.0f, Fade(WHITE, 0.34f));
// Rotating gate segments make VANTAGE-9 read as a mechanical lock instead of a normal ship.
BossAttackPhase current = BossPhase();
float ringRot = age * (phase2 ? 54.0f : 34.0f);
float ringRadius = (current == BossAttackPhase::Overload) ? 54.0f : 44.0f;
BeginBlendMode(BLEND_ADDITIVE);
for (int i = 0; i < 4; ++i) {
float start = ringRot + i * 90.0f + ((current == BossAttackPhase::BrokenHalo) ? (i % 2 == 0 ? 8.0f : -13.0f) : 0.0f);
float sweep = (current == BossAttackPhase::FallingStar) ? 34.0f : 24.0f;
DrawRing(pos, ringRadius - 2.0f, ringRadius + 1.6f, start, start + sweep, 8, Fade(gateColor, 0.34f));
}
DrawCircleLines((int)pos.x, (int)pos.y, ringRadius + 5.0f, Fade(gateColor, phase2 ? 0.26f : 0.18f));
EndBlendMode();
// Draw the core glowing center (Weak Point Indicator) and emissive wing lights
float pulse = 0.5f + 0.5f * std::sin(age * 12.0f);
Color coreColor = phase2 ? Color{ 255, 40, 40, 255 } : Color{ 255, 170, 0, 255 };
if (flash) coreColor = WHITE;
BeginBlendMode(BLEND_ADDITIVE);
// Outer glowing core aura
DrawCircleV(pos, (phase2 ? 16.0f : 10.0f) + 5.0f * pulse + (flash ? 8.0f : 0.0f),
Fade(coreColor, (flash ? 0.86f : 0.55f) + 0.24f * pulse));
// Inner hot core
DrawCircleV(pos, phase2 ? 6.0f : 4.5f, WHITE);
if (flash) {
DrawCircleLines((int)pos.x, (int)pos.y, phase2 ? 29.0f : 22.0f, Fade(WHITE, 0.72f));
}
if (phase2) {
DrawCircleLines((int)pos.x, (int)pos.y, 18.0f + 3.0f * pulse, Fade(RED, 0.68f));
DrawLineEx({pos.x - 17.0f, pos.y - 5.0f}, {pos.x - 7.0f, pos.y + 6.0f}, 1.5f, Fade(ORANGE, 0.8f));
DrawLineEx({pos.x + 17.0f, pos.y - 6.0f}, {pos.x + 6.0f, pos.y + 7.0f}, 1.5f, Fade(ORANGE, 0.8f));
}
// Emissive green wingtip sensors
float sensorPulse = 0.6f + 0.4f * std::sin(age * 8.0f);
DrawCircleV({ pos.x - 55.0f, pos.y - 4.0f }, 2.5f, Fade(LIME, sensorPulse));
DrawCircleV({ pos.x + 55.0f, pos.y - 4.0f }, 2.5f, Fade(LIME, sensorPulse));
EndBlendMode();
// Mechanical damage arcs/sparks from wings
if (phase2) {
BeginBlendMode(BLEND_ADDITIVE);
for (int i = 0; i < 2; ++i) {
Vector2 wp = (i == 0) ? Vector2{ pos.x - 30.0f, pos.y - 8.0f } : Vector2{ pos.x + 30.0f, pos.y - 8.0f };
if (GetRandomValue(0, 10) < 4) {
float sz = (float)GetRandomValue(3, 7);
DrawCircleV(wp, sz, (GetRandomValue(0, 1) == 0) ? ORANGE : RED);
DrawLineV(wp, { wp.x + GetRandomValue(-12, 12), wp.y + GetRandomValue(8, 24) }, GOLD);
}
}
EndBlendMode();
}
// Attack telegraphs: thin, high-contrast danger hints before each named pattern resolves.
BeginBlendMode(BLEND_ADDITIVE);
if (current == BossAttackPhase::AzureNeedle && fireTimer > 0.62f) {
float shotAngle = (aimAngle - 90.0f) * DEG2RAD;
Vector2 end = { pos.x + std::cos(shotAngle) * 540.0f, pos.y + std::sin(shotAngle) * 540.0f };
DrawLineEx(pos, end, 3.0f, Fade(Color{72, 190, 255, 255}, 0.40f));
DrawLineEx({pos.x - 10.0f, pos.y}, {end.x - 24.0f, end.y}, 1.5f, Fade(SKYBLUE, 0.22f));
DrawLineEx({pos.x + 10.0f, pos.y}, {end.x + 24.0f, end.y}, 1.5f, Fade(SKYBLUE, 0.22f));
} else if (current == BossAttackPhase::FallingStar && fireTimer > 0.33f) {
float r = 26.0f + std::sin(age * 18.0f) * 2.0f;
DrawCircleLines((int)pos.x, (int)pos.y, r, Fade(Color{255, 96, 196, 255}, 0.68f));
DrawCircleLines((int)pos.x, (int)pos.y, r + 18.0f, Fade(SKYBLUE, 0.34f));
} else if (current == BossAttackPhase::BrokenHalo) {
float cycle = std::fmod(phaseTimer, 3.6f);
if (cycle < 2.35f && fireTimer > 0.36f) {
float gap = PI * 0.5f + std::sin(phaseTimer * 0.7f) * 0.62f;
Vector2 safe = { pos.x + std::cos(gap) * 76.0f, pos.y + std::sin(gap) * 76.0f };
DrawCircleLines((int)pos.x, (int)pos.y, 42.0f + 5.0f * pulse, Fade(ORANGE, 0.46f));
DrawLineEx(pos, safe, 7.0f, Fade(LIME, 0.30f));
}
} else if (current == BossAttackPhase::Overload) {
float cycle = std::fmod(phaseTimer, 3.45f);
if (cycle < 2.12f) {
DrawLineEx({pos.x - 64.0f, pos.y - 38.0f}, {pos.x + 64.0f, pos.y + 38.0f}, 3.0f, Fade(RED, 0.34f));
DrawLineEx({pos.x + 64.0f, pos.y - 38.0f}, {pos.x - 64.0f, pos.y + 38.0f}, 3.0f, Fade(RED, 0.34f));
} else {
DrawCircleLines((int)pos.x, (int)pos.y, 50.0f, Fade(SKYBLUE, 0.30f));
}
}
EndBlendMode();
// Draw premium arcade Boss HP Bar
Color hpColor = flash ? WHITE : (phase2 ? RED : LIME);
int barY = (int)pos.y - 68;
// Draw HP bar outline bezel
DrawRectangle((int)pos.x - 52, barY - 1, 104, 8, DARKGRAY);
DrawRectangle((int)pos.x - 51, barY, 102, 6, BLACK);
DrawRectangle((int)pos.x - 51, barY, (int)(102.0f * (float)hp / (float)maxHp), 6, hpColor);
// "BOSS" text above bar
const char* tag = phase2 ? "VANTAGE-9 // CORE EXPOSED" : "VANTAGE-9 // ORBITAL GATEKEEPER";
int textW = MeasureText(tag, 10);
DrawText(tag, (int)pos.x - textW / 2, barY - 12, 10, phase2 ? RED : GOLD);
}
if (debug) DrawCircleLines((int)pos.x, (int)pos.y, radius, GREEN);
}