Class ProjectileLauncherComponent

java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.enemy.ProjectileLauncherComponent

public class ProjectileLauncherComponent extends Component
A class containing methods that allow entities to fire projectiles essentially, in a variety of ways.
  • Constructor Details

    • ProjectileLauncherComponent

      public ProjectileLauncherComponent(GameArea area, Entity target, Projectiles projType)
      Constructor for the class.
      Parameters:
      area - The area, such as ForestGameArea, in which the entity is residing in.
      target - The target entity, that this component's entity wants to hit.
      projType - The projectile to be launched from this launcher component.
  • Method Details

    • fireProjectile

      public void fireProjectile(com.badlogic.gdx.math.Vector2 directionToFire, com.badlogic.gdx.math.Vector2 offset, com.badlogic.gdx.math.Vector2 scale)
      Fires a projectile, classified as an enemy projectile, in the direction specified.
      Parameters:
      directionToFire - The direction to fire in
      offset - Offset (from the center) where the projectile is fired
      scale - The size of the projectile. "x" value represents width, and "y" value represents height.\
    • fireProjectileMultishot

      public void fireProjectileMultishot(int amount, float angleDifferences, com.badlogic.gdx.math.Vector2 directionToFire, com.badlogic.gdx.math.Vector2 offset, com.badlogic.gdx.math.Vector2 scale)
      Fires multiple laser projectiles, classified as enemy projectiles, at once
      Parameters:
      amount - The amount of projectiles to fire in one go
      angleDifferences - The angle differences, in degrees, between lasers. For example, passing in 10 means 10 degree difference in the rotation of each laser projectile.
      directionToFire - The direction to fire at.
      offset - Offset (from the center) where the projectile is fired
      scale - The size of the projectile. "x" value represents width, and "y" value represents height.
    • fireProjectileBurstFire

      public void fireProjectileBurstFire(int burstAmount, float timeBetweenShots, com.badlogic.gdx.math.Vector2 directionToFire, com.badlogic.gdx.math.Vector2 offset, com.badlogic.gdx.math.Vector2 scale)
      A quick burst of repeated laser projectile firings. Note that all lasers will head in the same direction, even if the player has moved during the burst duration.
      Parameters:
      burstAmount - The amount of projectiles to fire in a burst.
      timeBetweenShots - The time, in seconds, between each laser fired within one burst sequence.
      directionToFire - The direction to fire at.
      offset - Offset (from the center) where the projectile is fired
      scale - The size of the projectile. "x" value represents width, and "y" value represents height.