feat(enemy): afegir tipus STAR (estrella de 5 puntes) i 3 nous shapes

- Nou enemic STAR amb shape star_5.shp, escala 0.7 i color groc pur.
  Reusa el comportament zigzag del Pentagon i carrega via EnemyRegistry.
- DistribucioEnemics estesa amb camp 'star' opcional (default 0) per
  mantenir compat amb stages antics.
- Stage 1 reconfigurat a 25/25/25/25 per mostrar els 4 tipus.
- Afegits també shapes bullet_long.shp i bullet_double.shp (encara no
  utilitzats; preparats per futures variants de bala).
This commit is contained in:
2026-05-25 12:36:26 +02:00
parent b3a1afce06
commit bc41169176
13 changed files with 343 additions and 211 deletions
+3
View File
@@ -170,6 +170,9 @@ void Enemy::update(float delta_time) {
if (!isWounded()) {
switch (type_) {
case EnemyType::PENTAGON:
case EnemyType::STAR:
// STAR reusa el zigzag esquivador de Pentagon. Si en el futur
// vol comportament propi, separa-li el cas.
behaviorPentagon(delta_time);
break;
case EnemyType::SQUARE:
+2 -1
View File
@@ -13,7 +13,8 @@
enum class EnemyType : uint8_t {
PENTAGON = 0, // Pentágono esquivador (zigzag)
SQUARE = 1, // Square perseguidor (tracks ship)
PINWHEEL = 2 // Molinillo agresivo (rápido, girando)
PINWHEEL = 2, // Molinillo agresivo (rápido, girando)
STAR = 3 // Estrella de 5 puntes (clone visual de Pentagon, comportament zigzag)
};
// Forward declaration — EnemyConfig viu a enemy_config.hpp i s'inclou només a enemy.cpp.
+1
View File
@@ -29,6 +29,7 @@ namespace {
if (s == "pentagon") { return EnemyType::PENTAGON; }
if (s == "square") { return EnemyType::SQUARE; }
if (s == "pinwheel") { return EnemyType::PINWHEEL; }
if (s == "star") { return EnemyType::STAR; }
return std::nullopt;
}
+6 -2
View File
@@ -12,6 +12,7 @@
EnemyConfig EnemyRegistry::pentagon_config;
EnemyConfig EnemyRegistry::square_config;
EnemyConfig EnemyRegistry::pinwheel_config;
EnemyConfig EnemyRegistry::star_config;
bool EnemyRegistry::loaded = false;
namespace {
@@ -36,10 +37,11 @@ namespace {
auto EnemyRegistry::loadAll() -> bool {
const bool OK = loadOne("pentagon", EnemyType::PENTAGON, pentagon_config) &&
loadOne("square", EnemyType::SQUARE, square_config) &&
loadOne("pinwheel", EnemyType::PINWHEEL, pinwheel_config);
loadOne("pinwheel", EnemyType::PINWHEEL, pinwheel_config) &&
loadOne("star", EnemyType::STAR, star_config);
loaded = OK;
if (OK) {
std::cout << "[EnemyRegistry] 3 configuracions d'enemic carregades.\n";
std::cout << "[EnemyRegistry] 4 configuracions d'enemic carregades.\n";
}
return OK;
}
@@ -56,6 +58,8 @@ auto EnemyRegistry::get(EnemyType type) -> const EnemyConfig& {
return square_config;
case EnemyType::PINWHEEL:
return pinwheel_config;
case EnemyType::STAR:
return star_config;
}
std::cerr << "[EnemyRegistry] FATAL: tipus desconegut\n";
std::exit(EXIT_FAILURE);
+1
View File
@@ -26,5 +26,6 @@ class EnemyRegistry {
static EnemyConfig pentagon_config;
static EnemyConfig square_config;
static EnemyConfig pinwheel_config;
static EnemyConfig star_config;
static bool loaded;
};