Skip to content

Enemy NPC Test Cases

mhUnt3rS edited this page Aug 29, 2024 · 35 revisions

The following components are being tested as part of the enemy creation and combat feature:

Enemy NPC Factory Tests

Enemy Factory Tests

Methods

View Enemy Factory Tests

CreateMonkey(): Creates monkey entity

createchicken(): Creates chicken entity

createFrog: Creates Frog entity

createBaseEnemy: Creates Base Enemy

Chicken Animation Controller:

Methods

create(): Initialises the component and sets up event listeners

animateSpawn(): Plays the "spawn" animation

animateChaseLeft(): Plays the "walk" animation and flips the sprite to face left

animateChaseRight(): Plays the "walk" animation and flips the sprite to face right

animateWanderLeft(): Plays the "walk" animation and flips the sprite to face left

animateWanderRight(): Plays the "walk" animation and flips the sprite to face right

Frog Animation Tests:

Methods

create(): Initialises the component and sets up event listeners

animateWanderLeft(): Plays the "float" animation and flips the sprite to face left

animateWanderRight(): Plays the "float" animation and flips the sprite to face right

animateChaseLeft(): Plays the "angry_float" animation and flips the sprite to face left

animateChaseRight(): Plays the "angry_float" animation and flips the sprite to face right

Monkey Animation Tests:

Methods

create(): Initialises the component and sets up event listeners

animateRunDown(): Plays the "run_down" animation, likely used when the character is running downwards

animateRunUp(): Plays the "run_up" animation, likely used when the character is running upwards

animateRunLeft(): Plays the "run_left" animation, likely used when the character is running to the left

animateRunRight(): Plays the "run_right" animation, likely used when the character is running to the right

animateRunLeftDown(): Plays the "run_left_down" animation, likely used when the character is running diagonally down to the left

animateRunRightDown(): Plays the "run_right_down" animation, likely used when the character is running diagonally down to the right

animateRunLeftUp(): Plays the "run_left_up" animation, likely used when the character is running diagonally up to the left

animateRunRightUp(): Plays the "run_right_up" animation, likely used when the character is running diagonally up to the right

Spawn Task

Method

View Spawn Task Tests

SpawnTask(Vector2 spawnPosition, float spawnDuration): Constructor for the SpawnTask class, initialises the task with the spawn position and duration

getSpawnPosition(): Returns the position where the entity will be spawned

getSpawnDuration(): Returns the duration of the spawn task

getElapsedTime(): Returns the elapsed time since the spawn task started

getPriority(): Returns the priority of this task, with higher values indicating higher priority

start(): Starts the spawn task, positioning the entity at the spawn location and triggering the "spawnChicken" event

completeTask(): Completes the spawn task, stopping it and cleaning up if necessary

stop(): Stops the spawn task, cleaning up if necessary. Inherits from DefaultTask.

ProximityComponent

Methods

View ProximityComponent Tests

ProximityComponent(): Constructor for the ProximityComponent

update(): Updates the component's state based on the entity's position relative to the target

setupSpawnAnimation(Entity entity): Sets up the spawn animation for the given entity.

Touch Attack Component

Methods

View Touch Attack Component Tests

TouchAttackComponent(): Constructor for the TouchAttackComponent

create(): Creates the component and sets up event listeners

onCollisionStart: Handles the "collisionStart" event

Clone this wiki locally