-
Notifications
You must be signed in to change notification settings - Fork 1
Hive NPC
mhUnt3rS edited this page Oct 16, 2024
·
6 revisions
The Hive enemy is a non-playable entity that periodically spawns homing bees, which actively chase and attack the target, typically a player. To defeat the hive, the player must find the source and walk close to the it. This will result in the hive and bees which have been spawned by that particular hive to despawn. The Hive features predefined AI tasks that control the behavior of the bees, making them continuously seek out and engage the target.
- Periodic Spawning: The Hive spawns a set number of homing bees at intervals, which aggressively chase the target.
- Bee Swarms: The bees are homing entities that follow the player until they hit or the hive is defeated.
- Despawning Mechanism: Once the player walks close to the hive it will despawn it and its bees.
generator = () -> ProjectileFactory.createHive(player);
spawnHive(generator, 5, 0.1, 1);
public static Entity createHive(Entity target) {
BaseEnemyEntityConfig config = configs.hive;
AnimationRenderComponent animator =
new AnimationRenderComponent(
ServiceLocator.getResourceService().getAsset(config.getSpritePath(), TextureAtlas.class));
animator.addAnimation("float", 0.1f, Animation.PlayMode.LOOP);
Entity hive = createBaseProjectile(target, config, 2f, animator, new HiveAnimationController());
hive.getComponent(AITaskComponent.class).addTask(new HiveTask(target));
hive.setEnemyType(Entity.EnemyType.HIVE);
return hive;
}
The bees and the hive create a challenging dynamic where players must deal with both the entity and its aggressive swarm, requiring strategic responses to overcome.