Class ProjectileFactory

java.lang.Object
com.csse3200.game.entities.factories.ProjectileFactory

public class ProjectileFactory extends Object
Factory to projectile entities with predefined components.

Each projectile entity type should have a creation method that returns a corresponding entity. Predefined entity properties can be loaded from the config classes

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

  • Method Details

    • createProjectile

      public static Entity createProjectile(ProjectileTarget target, WeaponsStatsComponent source, String texturePath)
      Base class to create a projectile.
      Parameters:
      target - The physics layer the projectile can collide with
      source - The stats of the weapon that shot the projectile.
      texturePath - The texture of the projectile
      Returns:
      An entity for the projectile
    • createArcProjectile

      public static ActiveProjectile createArcProjectile(ProjectileTarget target, WeaponsStatsComponent source, String texturePath, float gravityStrength)
      Base class to create a projectile.
      Parameters:
      target - The physics layer the projectile can collide with
      source - The stats of the weapon that shot the projectile.
      texturePath - The texture of the projectile
      gravityStrength - The strength of gravity affecting the projectile during its lifetime.
      Returns:
      An entity for the projectile
    • createFollowingProjectile

      public static ActiveProjectile createFollowingProjectile(ProjectileTarget target, WeaponsStatsComponent source, String texturePath, Entity targetEntity, float speed)
      Base class to create a projectile.
      Parameters:
      target - The physics layer the projectile can collide with
      source - The stats of the weapon that shot the projectile.
      texturePath - The texture of the projectile
      targetEntity - the entity to follow/target
      speed - The speed of the projectile
      Returns:
      An entity for the projectile
    • createBomb

      public static Entity createBomb(ProjectileTarget target, WeaponsStatsComponent source, String texturePath)
    • createPistolBullet

      public static Entity createPistolBullet(WeaponsStatsComponent source)
      Creates a pistol bullet entity
      Returns:
      pistol bullet entity
    • createEnemyLaserProjectile

      public static Entity createEnemyLaserProjectile(com.badlogic.gdx.math.Vector2 direction, WeaponsStatsComponent source)
      Creates a standard laser shot entity projectile
      Parameters:
      direction - direction in which the projectile is shot
      source - weapon stats to derive from
      Returns:
      The laser entity