-
Notifications
You must be signed in to change notification settings - Fork 0
Kangaroo Boss
The Kangaroo Boss, also referred to as "Kanga," is the final boss in the game. It represents a significant challenge to the player and involves a sequence of gameplay elements including spawning, chasing, visual effects, and a climactic combat encounter.
- Health: High durability with a substantial health pool.
- Base Attack: The attack power that Kanga uses in combat.
- Hunger: Default hunger level, though not a primary stat for a boss.
- Strength: Governs the boss's damage output.
- Defense: Mitigates damage received by Kanga.
- Speed: Movement speed during the chase and combat (Kanga Boss has a higher speed than player).
- Experience: The experience points awarded to the player upon defeating Kanga.
The implementation of the Kangaroo Boss relies on several key classes and extends existing frameworks within the game:
-
ForestGameArea:
ExtendsGameArea
, responsible for setting up the environment and managing game entities like the player and Kanga. -
ChaseTask:
ExtendsDefaultTask
and implementsPriorityTask
, handling the boss's chase behaviour, including visual and auditory effects. -
WanderTask:
Extends DefaultTask and implementsPriorityTask
, managing the boss's wandering behaviour when not actively chasing the player. -
KangaBossAnimationController:
ExtendsComponent
, controlling Kanga's animations based on events such as wandering or chasing. -
CombatGameArea:
ExtendsGameArea
, specifically set up to manage the combat environment when the player faces Kanga.
These classes are critical to defining the behaviour and interactions of the Kangaroo Boss within the game, ensuring a dynamic and engaging final boss encounter.
In class ForestGameArea
, add a listener to detect the event triggering the spawn of Kanga Boss
// Add listener for event which will trigger the spawn of Kanga Boss
player.getEvents().addListener("spawnKangaBoss", this::spawnKangarooBoss);
// Initialise the flag when creating the area
kangarooBossSpawned = false;
Kanga is spawned in the ForestGameArea
when certain conditions are met, such as completing a quest.
public class ForestGameArea extends GameArea {
private void spawnKangarooBoss() {
if (!kangarooBossSpawned) {
Entity kangarooBoss = NPCFactory.createKangaBossEntity(player);
spawnEntityAt(kangarooBoss, KANGAROO_BOSS_SPAWN, true, true);
kangarooBossSpawned = true;
}
}
}
This method ensures that only one instance of Kanga is created, preventing multiple spawns.
The Kanga Boss is configured using the BaseEntityConfig
class. Configuration set up:
package com.csse3200.game.entities.configs;
public class NPCConfigs {
public BaseEntityConfig kangarooBoss = new BaseEntityConfig();
}
The BaseEntityConfig
class stores attributes like health, attack, defense, and others which are crucial to defining Kanga’s behaviour and performance in the game.
package com.csse3200.game.entities.configs;
public class BaseEntityConfig {
public int health = 1;
public int baseAttack = 0;
public int hunger = 100;
public int strength = 0;
public int defense = 0;
public int speed = 1;
public int experience = 0;
protected String animalName;
protected String[] baseHint;
protected String spritePath;
protected float animationSpeed = 0.1f;
protected String[] soundPath;
}
The KangaBossAnimationController
handles the animations triggered by different events, such as starting to wander or chase the player.
package com.csse3200.game.components.npc;
public class KangaBossAnimationController extends Component {
AnimationRenderComponent animator;
@Override
public void create() {
super.create();
animator = this.entity.getComponent(AnimationRenderComponent.class);
entity.getEvents().addListener("kangaWanderStart", this::animateWander);
entity.getEvents().addListener("kangaChaseStart", this::animateChase);
}
void animateWander() {
animator.startAnimation("float");
}
void animateChase() {
animator.startAnimation("angry_float");
}
}
The ChaseTask handles the logic for Kanga chasing the player. It incorporates visual and audio effects, like the heartbeat sound, which heightens tension during the chase.
public class ChaseTask extends DefaultTask implements PriorityTask {
// Relevant attributes and methods
}
The WanderTask determines Kanga's wandering behaviour when it is not actively chasing the player. This task is also tied to specific animations.
public class WanderTask extends DefaultTask implements PriorityTask {
// Relevant attributes and methods
}
When the player encounters Kanga, they are transitioned into a combat screen. This involves the CombatGameArea
class, which handles the setup of the combat environment.
public class CombatGameArea extends GameArea {
private void spawnCombatEnemy() {
Entity combatEnemyNPC = NPCFactory.createKangaBossCombatEntity();
spawnEntityAt(combatEnemyNPC, ENEMY_COMBAT_SPAWN, true, true);
}
}
To ensure that Kanga operates as expected, the following aspects are tested:
- Spawning: Verifying that Kanga spawns only when appropriate and at the correct location.
- Chase Behaviour: Ensuring that Kanga correctly initiates a chase and stops under the right conditions.
- Animation Transitions: Checking that Kanga's animations correspond with its actions, such as switching from wandering to chasing.
- Combat Transition: Confirming that the game transitions smoothly from exploration or chase to combat when engaging with Kanga.