26 Weapon(7.0F, 0.0F, 0, 25));
27 LOG_INFO(
"✓ Player created with ID: ", playerId);
30 }
catch (
const std::exception &e) {
31 LOG_ERROR(
"Failed to create player: ", e.what());
45 0.0f, 2, 0xFFFFFFFF,
false));
47 LOG_INFO(
"✓ Enemy created (ID:", enemy,
") type:", enemyType,
" HP:", spawnData.
health,
" at (",
48 posX,
",", posY,
")");
50 }
catch (
const std::exception &e) {
51 LOG_ERROR(
"Failed to create enemy: ", e.what());
57 float dirX,
float dirY,
float speed,
int damage,
bool friendly) {
71 Sprite(
"Projectiles", {267, 84, 17, 13}, 2.0f, 0.0f,
false,
false, 0));
74 }
catch (
const std::exception &e) {
75 LOG_ERROR(
"Failed to create projectile: ", e.what());
81 float posY,
float health,
int scoreValue,
82 const std::string &scriptPath) {
91 registry.
setComponent(enemy,
Health(
static_cast<int>(health),
static_cast<int>(health)));
93 0.0f, 2, 0xFFFFFFFF,
false));
97 if (!scriptPath.empty()) {
101 LOG_INFO(
"✓ Enemy '", enemyType,
"' created at (", posX,
", ", posY,
")");
103 }
catch (
const std::exception &e) {
104 LOG_ERROR(
"Failed to create enemy: ", e.what());
110 float posX,
float posY,
float health,
int scoreValue,
111 const std::string &scriptPath) {
120 registry.
setComponent(enemy,
Health(
static_cast<int>(health),
static_cast<int>(health)));
122 0.0f, 2, 0xFFFFFFFF,
false));
126 if (!scriptPath.empty()) {
130 LOG_INFO(
"✓ Enemy '", enemyType,
"' created at (", posX,
", ", posY,
")");
132 }
catch (
const std::exception &e) {
133 LOG_ERROR(
"Failed to create enemy: ", e.what());
139 float posX,
float posY) {
147 LOG_INFO(
"✓ Power-up created at (", posX,
", ", posY,
")");
149 }
catch (
const std::exception &e) {
150 LOG_ERROR(
"Failed to create power-up: ", e.what());
163 LOG_INFO(
"✓ Health pack created at (", posX,
", ", posY,
")");
165 }
catch (
const std::exception &e) {
166 LOG_ERROR(
"Failed to create health pack: ", e.what());
174 return {150.0f, 50, 100, 40.0f, 40.0f};
176 return {100.0f, 100, 200, 60.0f, 60.0f};
178 return {200.0f, 30, 150, 30.0f, 30.0f};
180 return {120.0f, 200, 500, 80.0f, 80.0f};
182 return {150.0f, 50, 100, 40.0f, 40.0f};
187 if (enemyType ==
"basic")
189 if (enemyType ==
"advanced" || enemyType ==
"heavy")
191 if (enemyType ==
"fast")
193 if (enemyType ==
"boss")
195 LOG_WARNING(
"Unknown enemy type '", enemyType,
"', defaulting to basic");
200 float height,
bool destructible,
int health) {
208 wall,
ecs::Sprite(
"Wall.png", {0, 0,
static_cast<int>(width),
static_cast<int>(height)}, 1.0f,
209 0.0f,
false,
false, 0));
212 if (destructible && health > 0) {
216 LOG_INFO(
"✓ Wall spawned at (", posX,
", ", posY,
") - Size: ", width,
"x", height,
217 destructible ?
" [Destructible]" :
" [Solid]");
219 }
catch (
const std::exception &e) {
220 LOG_ERROR(
"Failed to create wall: ", e.what());
226 float orbitRadius,
float orbitSpeed,
float startAngle,
227 int damage,
int moduleHealth) {
230 float initialX = 0.0f;
231 float initialY = 0.0f;
235 initialX = parentPos.x + orbitRadius;
236 initialY = parentPos.y;
243 module,
ecs::OrbitalModule(parentEntityId, orbitRadius, orbitSpeed, startAngle, damage));
262 ecs::Sprite(
"OrbitalModule", {0, 0, 17, 18}, 2.0f, 0.0f,
false,
false, 0));
264 LOG_INFO(
"✓ Orbital module created for entity ", parentEntityId,
" - Radius: ", orbitRadius,
265 ", Speed: ", orbitSpeed,
" rad/s");
267 }
catch (
const std::exception &e) {
268 LOG_ERROR(
"Failed to create orbital module: ", e.what());
Component managing current animation playback state.
Component for items that can be picked up by players.
Component for collision detection and physics interactions.
Component identifying an entity as an enemy with AI behavior.
Component representing entity health and invincibility.
Component that holds the path to a Lua script for entity behavior.
Component for entities that orbit around a parent entity (like drones in Isaac).
Component identifying an entity as a player with game statistics.
static ecs::Address createEnemyFromRegistry(ecs::Registry ®istry, const std::string &enemyType, float posX, float posY, float health, int scoreValue, const std::string &scriptPath="")
Create an enemy entity directly from Registry (for SpawnSystem)
static ecs::Address createHealthPack(ecs::Registry ®istry, int healthRestore, float posX, float posY)
Create a health pack collectible.
static ecs::Address createPlayer(ecs::Registry ®istry, uint32_t playerId)
Create a player entity.
static ecs::Address createEnemy(ecs::Registry ®istry, int enemyType, float posX, float posY)
Create an enemy entity.
static ecs::Address createPowerUp(ecs::Registry ®istry, ecs::BuffType buffType, float duration, float value, float posX, float posY)
Create a collectible power-up entity.
static int _enemyTypeFromString(const std::string &enemyType)
static ecs::Address createWall(ecs::Registry ®istry, float posX, float posY, float width, float height, bool destructible=false, int health=0)
Create a wall/obstacle entity.
static ecs::Address createProjectile(ecs::Registry ®istry, uint32_t ownerId, float posX, float posY, float dirX, float dirY, float speed, int damage, bool friendly)
Create a projectile entity.
static ecs::Address createOrbitalModule(ecs::Registry ®istry, uint32_t parentEntityId, float orbitRadius=50.0f, float orbitSpeed=2.0f, float startAngle=0.0f, int damage=10, int moduleHealth=50)
Create an orbital module (drone) entity.
static EnemySpawnData _getEnemySpawnData(int enemyType)
Component for projectile entities (bullets, missiles, etc.).
Manages entities, their signatures and component type registrations.
Address newEntity()
Create and register a new entity, returning its Address.
T & getComponent(Address address)
Get a component from an entity.
bool hasComponent(Address address)
Check if an entity has a specific component.
void setComponent(Address address, const T &component)
Set/add a component to an entity with its data.
Component representing a visual sprite from a texture.
Component representing movement direction and speed.
Component for static or destructible walls/obstacles.
Component for entities capable of shooting projectiles.
ecs::AnimationSet createOrbitalModuleAnimations()
Create drone (orbital module) animations.
ecs::AnimationSet createPlayerBulletAnimations()
Create player bullet animations.
constexpr std::uint32_t PLAYER_MODULE
constexpr std::uint32_t MASK_PLAYER_MODULE
Maximum number of distinct component types supported by the Registry.
BuffType
Types of buffs that can be applied to entities.
std::uint32_t Address
Type used to represent an entity address/ID.