Enemy Attack Factory - UQcsse3200/2026-studio-2 GitHub Wiki

Overview

The AttackFactory.java class is used for creating enemy attacks. Attacks are entities with a given hitbox, damage, knockback, and duration, which use the 'TouchAttackComponent' to deal damage to colliding targets. The attack will disappear after a given amount of time.

Usage

Enemies which use static attacks to deal damage should use the AttackFactory to create the attack hitbox. The attack will deal damage to any colliding entity that shares the same PhysicsLayer as the target.

The caller must use ServiceLocator.getEntityService().register() to register the attack into the game engine's entity service. The removal of the entity is handled by the attack's own DurationComponent.