Class EnemyFollowingProjectile

All Implemented Interfaces:
Pool.Poolable, KryoSerializable
Direct Known Subclasses:
AirProjectile, BasicProjectile, BuffProjectile, EnemyFollowingExplosiveProjectile, VenomProjectile

public abstract class EnemyFollowingProjectile extends Projectile
A regular projectile which constantly follows the target enemy.
  • Field Details

    • RAYCAST_INTERVAL_FOLLOWING_MIN

      public static final float RAYCAST_INTERVAL_FOLLOWING_MIN
      See Also:
    • RAYCAST_INTERVAL_FOLLOWING_MIN_SQR

      public static final float RAYCAST_INTERVAL_FOLLOWING_MIN_SQR
      See Also:
    • DEFAULT_MAX_ROT_SPEED

      public static final float DEFAULT_MAX_ROT_SPEED
      See Also:
    • DEFAULT_MAX_ROT_SPEED_DYNAMIC

      public static final float DEFAULT_MAX_ROT_SPEED_DYNAMIC
      See Also:
    • speed

      public float speed
      Projectile speed in px/s
    • maxRotationSpeed

      public float maxRotationSpeed
      Max rotation speed in deg/s
    • maxRotationSpeedDynamic

      public float maxRotationSpeedDynamic
      By how many deg/s the projectile's rotation speed increases per second (becomes more agile with time)
    • drawPosition

      public Vector2 drawPosition
    • drawAngle

      public float drawAngle
  • Method Details

    • write

      public void write(Kryo kryo, Output output)
      Specified by:
      write in interface KryoSerializable
      Overrides:
      write in class Projectile
    • read

      public void read(Kryo kryo, Input input)
      Specified by:
      read in interface KryoSerializable
      Overrides:
      read in class Projectile
    • getTimeExists

      public float getTimeExists()
    • getTarget

      public Enemy getTarget()
      Returns:
      null if no target / target is unregistered (no need to check for Enemy.isRegistered())
    • setTarget

      public void setTarget(Enemy target)
    • applyDrawInterpolation

      public void applyDrawInterpolation(float interpolatedTime)
      Specified by:
      applyDrawInterpolation in class Projectile
    • flyOnEnemy

      public void flyOnEnemy(Enemy enemy)
      Description copied from class: Projectile
      Make projectile fly towards an enemy (some projectile types, such as Laser, do not implement this method)
      Overrides:
      flyOnEnemy in class Projectile
    • setUnregistered

      public void setUnregistered()
      Description copied from class: Registrable
      Remove the reference to the game state and mark this object as not registered.
      Overrides:
      setUnregistered in class Registrable
    • reset

      public void reset()
      Description copied from interface: com.badlogic.gdx.utils.Pool.Poolable
      Resets the object for reuse. Object references should be nulled and fields may be set to default values.
      Specified by:
      reset in interface Pool.Poolable
      Overrides:
      reset in class Projectile
    • getPosition

      public Vector2 getPosition()
      Overrides:
      getPosition in class Projectile
    • draw

      public void draw(Batch batch, float delta)
      Specified by:
      draw in class Projectile
    • update

      public void update(float deltaTime)
      Specified by:
      update in class Projectile
    • isDone

      public boolean isDone()
      Specified by:
      isDone in class Projectile
      Returns:
      true if projectile has done its job, no longer needed and can be removed from the system
    • hasReachedTarget

      public boolean hasReachedTarget()
      Specified by:
      hasReachedTarget in class Projectile
    • toString

      public String toString()
      Overrides:
      toString in class Projectile