Class NPCFactory

java.lang.Object
com.deco2800.game.entities.factories.NPCFactory

public class NPCFactory extends Object
Factory to create non-playable character (NPC) entities with predefined components.

Each NPC entity type should have a creation method that returns a corresponding entity. Predefined entity properties can be loaded from configs stored as json files which are defined in "NPCConfigs".

If needed, this factory can be separated into more specific factories for entities with similar characteristics.

  • Method Details

    • createPirateCrabEnemy

      public static Entity createPirateCrabEnemy(Entity target)
      Creates a pirate Crab entity
      Parameters:
      target - entity to chase
      Returns:
      Entity
    • createElectricEelEnemy

      public static Entity createElectricEelEnemy(Entity target, Entity crystal)
    • createMeleeBoss

      public static Entity createMeleeBoss(Entity target)
      Creates a melee boss entity
      Parameters:
      target - entity to chase
      Returns:
      Entity
    • createStarFishEnemy

      public static Entity createStarFishEnemy(Entity target, Entity crystal)
    • createBaseNPC

      public static Entity createBaseNPC()
      Creates a generic NPC to be used as a base entity by more specific NPC creation methods.
      Returns:
      entity
    • createSpecialNPC

      public static Entity createSpecialNPC()
      Creates a new special NPC.
      Returns:
      special NPC.
    • createNormalNPC

      public static Entity createNormalNPC()
      Creates a new normal NPC.
      Returns:
      normal NPC