@@ -35,33 +35,41 @@ namespace RType {
3535 }
3636
3737 if (!registry.HasComponent <BossAttack>(bossEntity) ||
38- !registry.HasComponent <Position>(bossEntity)) {
38+ !registry.HasComponent <Position>(bossEntity) ||
39+ !registry.HasComponent <Boss>(bossEntity)) {
3940 continue ;
4041 }
4142
4243 auto & attack = registry.GetComponent <BossAttack>(bossEntity);
4344 const auto & pos = registry.GetComponent <Position>(bossEntity);
45+ const auto & boss = registry.GetComponent <Boss>(bossEntity);
4446
4547 attack.timeSinceLastAttack += deltaTime;
4648
4749 if (attack.timeSinceLastAttack >= attack.attackCooldown ) {
4850 attack.timeSinceLastAttack = 0 .0f ;
4951
50- switch (attack.currentPattern ) {
51- case BossAttackPattern::FAN_SPRAY :
52- CreateFanSpray (registry, bossEntity, pos.x , pos.y );
53- attack.currentPattern = BossAttackPattern::THIRD_BULLET ;
54- break ;
55- case BossAttackPattern::THIRD_BULLET :
56- CreateThirdBullet (registry, bossEntity, pos.x , pos.y );
57- attack.currentPattern = BossAttackPattern::BLACK_ORB ;
58- break ;
59- case BossAttackPattern::BLACK_ORB :
60- CreateBlackOrb (registry, bossEntity, pos.x , pos.y );
61- attack.currentPattern = BossAttackPattern::FAN_SPRAY ;
62- break ;
63- default :
64- break ;
52+ if (boss.bossId == 1 ) {
53+ // Boss 1
54+ switch (attack.currentPattern ) {
55+ case BossAttackPattern::FAN_SPRAY :
56+ CreateFanSpray (registry, bossEntity, pos.x , pos.y );
57+ attack.currentPattern = BossAttackPattern::THIRD_BULLET ;
58+ break ;
59+ case BossAttackPattern::THIRD_BULLET :
60+ CreateThirdBullet (registry, bossEntity, pos.x , pos.y );
61+ attack.currentPattern = BossAttackPattern::BLACK_ORB ;
62+ break ;
63+ case BossAttackPattern::BLACK_ORB :
64+ CreateBlackOrb (registry, bossEntity, pos.x , pos.y );
65+ attack.currentPattern = BossAttackPattern::FAN_SPRAY ;
66+ break ;
67+ default :
68+ break ;
69+ }
70+ } else if (boss.bossId == 2 ) {
71+ // Boss 2
72+ CreateAnimatedOrb (registry, bossEntity, pos.x , pos.y );
6573 }
6674 }
6775 }
@@ -209,5 +217,46 @@ namespace RType {
209217 Core::Logger::Info (" [BossAttackSystem] Created Third Bullet at ({}, {})" , spawnX, spawnY);
210218 }
211219
220+ void BossAttackSystem::CreateAnimatedOrb (Registry& registry, Entity bossEntity, float bossX, float bossY) {
221+ const int orbCount = 4 ;
222+ const float orbSpacing = 100 .0f ;
223+ const float baseSpeed = 350 .0f ;
224+
225+ const float spawnX = bossX + 50 .0f ;
226+ const float startY = bossY + 50 .0f ;
227+
228+ for (int i = 0 ; i < orbCount; i++) {
229+ Entity orb = registry.CreateEntity ();
230+
231+ if (registry.HasComponent <Obstacle>(orb)) {
232+ registry.RemoveComponent <Obstacle>(orb);
233+ }
234+ if (registry.HasComponent <ObstacleMetadata>(orb)) {
235+ registry.RemoveComponent <ObstacleMetadata>(orb);
236+ }
237+
238+ float orbY = startY + (i * orbSpacing);
239+ registry.AddComponent <Position>(orb, Position{spawnX, orbY});
240+
241+ float speedVariation = baseSpeed + (i * 10 .0f );
242+ float angle = -M_PI + (i * 0 .1f );
243+ float vx = std::cos (angle) * speedVariation;
244+ float vy = std::sin (angle) * speedVariation * 0 .3f ;
245+
246+ registry.AddComponent <Velocity>(orb, Velocity{vx, vy});
247+
248+ registry.AddComponent <Bullet>(orb, Bullet{bossEntity});
249+ registry.AddComponent <BossBullet>(orb, BossBullet{});
250+ registry.AddComponent <WaveAttack>(orb, WaveAttack{});
251+
252+ registry.AddComponent <CircleCollider>(orb, CircleCollider{15 .0f });
253+ registry.AddComponent <CollisionLayer>(orb,
254+ CollisionLayer (CollisionLayers::ENEMY_BULLET , CollisionLayers::PLAYER ));
255+ registry.AddComponent <Damage>(orb, Damage{8 });
256+ }
257+
258+ Core::Logger::Info (" [BossAttackSystem] Boss 2 created wave attack burst with {} orbs" , orbCount);
259+ }
260+
212261 }
213262}
0 commit comments