Repository navigation
Enemies
| Enemy Name | Default Sprite | Attack Damage | Attack Style | Health | Main Classes Used |
|---|---|---|---|---|---|
| Bomb Enemy: Beetle {Egyptain}, Golem {Greek}, Knight {Norse}, Zombie {Chinese} |
|
7 | Roams around the room and chases the player when nearby. It deals contact damage on collision and destroys itself after hitting the player. | 10 |
ExplodeComponent, BombEnemyConfig, NPCFactory, WanderTask, ChaseTask, EnemyAnimationController
|
| Split Enemy: Crab {Egyptain}, Medusa {Greek}, Dark Elves {Norse}, Bug {Chinese} |
|
3 on original, 1 on split child | Rapidly chases the player and performs a telegraphed lunge attack with a cooldown. On its first hit reaction, the original enemy is replaced by two weaker children. Split children cannot split recursively. | 10 on original, 5 on split child |
SplitComponent, LungeAttackTask, TouchAttackComponent, ChaseEnemyConfig, NPCFactory, WanderTask, ChaseTask, EnemyAnimationController
|
| Chase Enemy: Minotaur {Greek}, Sandeye {Egyptian}, Wolf {Norse}, Longwei {Chinese} |
|
2 | Enemies will keep chasing the player around | 40 |
SplitComponent, LungeAttackTask, TouchAttackComponent, ChaseEnemyConfig, NPCFactory, WanderTask, ChaseTask, EnemyAnimationController
|
| Floating Demon: Wasp {Egyptain}, Harpy {Greek}, Crow {Norse}, Jingwei {Chinese} |
|
3 per projectile | Patrols along a triangular route and fires three ranged projectiles in a spread pattern. | 77 |
FloatingDemonProjectileFactory, FloatingDemonConfig, RangedAttackTask, PatrolTask, NPCFactory, EnemyAnimationController
|
| Giant Enemy: Mummy {Egyptain}, Cyclops{Greek}, Jotunn {Norse}, Wukong {Chinese} |
|
3 | Wanders slowly and then when near player chases at the same pace | 30 |
GiantEnemyConfig, NPCFactory, WanderTask, ChaseTask, EnemyAnimationController
|
All NPC types (minibosses and small enemies) use EnemyDeathComponent(hasDeathAnimation), the small enemies use EnemyDeathComponent(hasDeathAnimation, isEnemy) to handle their death animations and disposal with the AITaskComponent and PhysicsMovementComponent.
When CombatStatsComponent changes an enemy's health from above to zero, it triggers the entityDied event. EnemyDeathComponent listens for this event and triggers dieAnimation. The animation is then handled by EnemyAnimationController. Once the death animation finishes, the controller calls ServiceLocator.getEntityService().scheduleDisposal(entity) to safely remove the enemy.
New ground-based enemy types can be created by reusing NPCFactory.createBaseNPC(), which provides the common physics, movement, collision, hitbox, and death-handling components. A dedicated factory method can then add the new enemy's combat statistics, AI tasks, animations, and specialised behaviour components.
To make a new enemy type available in rooms, define its configuration and add the corresponding creation logic to EnemySpawnConfig and EnemyManagerComponent. Existing events such as entityDied, hitReaction, and spawnChildren allow enemy components and the room system to communicate without tightly coupling their implementations.
1. Automated Testing
From the source directory, run the complete test suite: ./gradlew test
The enemy-specific unit and integration tests are listed in the Automated Verification section below.
2. Manual Verification Launch the game and enter rooms containing the configured enemy types. Verify the following behaviours:
- The Bomb Enemy wanders, chases the player, deals contact damage, and removes itself after colliding with the player.
- The Chase Enemy follows the player and performs its telegraphed lunge attack and is replaced by its children when killed
- The split children do not split again when attacked.
- The Floating Demon follows its triangular patrol route and fires three projectiles in a spread pattern.
- Enemies play their death animations and are removed after their health reaches zero.
- The room is only cleared after all tracked enemies, including Chase Enemy children, have been defeated.
- Implemented
- Bomb Enemy, Chase Enemy, Giant Enemy and Floating Demon creation through NPCFactory.
- Room-configured enemy spawning and tracking through EnemyManagerComponent.
- Enemy health, hit reactions, death events, death animations, and deferred disposal.
- Chase Enemy lunge behaviour and split-on-hit behaviour.
- Split children are registered and tracked by the room.
- Only the original Chase Enemy receives a SplitComponent; its children cannot split recursively.
- Floating Demon triangle patrol, ranged attacks, projectile movement, and projectile damage.
- Automated Verification
The enemy implementation is covered by unit and integration tests, including:
- EnemyDeathComponentTest
- EnemyAnimationDisposalTest
- EnemyManagerComponentTest
- SplitComponentTest
- LungeAttackTaskTest
- PatrolTaskTest
- RangedAttackTaskTest
- BombEnemyTest
- ChaseEnemyTest
- GiantEnemyTest
- FloatingDemonTest
- FloatingDemonProjectileFactoryTest
- CollisionSpawnTest
- CollisionDisposalTest
- A regression test in SplitComponentTest confirms that Chase Enemy children do not receive another SplitComponent, preventing recursive enemy spawning.