Class Projectile

java.lang.Object
com.prineside.tdi2.Registrable
com.prineside.tdi2.Projectile
All Implemented Interfaces:
Pool.Poolable, KryoSerializable
Direct Known Subclasses:
ChainLightningProjectile, CollidingProjectile, EnemyFollowingProjectile, LaserProjectile

public abstract class Projectile extends Registrable implements Pool.Poolable
  • Field Details

    • RAYCAST_INTERVAL_MIN

      public static final float RAYCAST_INTERVAL_MIN
      Ray cast won't happen until projectile travels this distance (TILE_SIZE / 4)
      See Also:
    • type

      public ProjectileType type
    • id

      public int id
    • position

      public Vector2 position
  • Method Details

    • write

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

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

      public void setup()
    • getPosition

      public Vector2 getPosition()
    • getDamage

      public float getDamage()
    • setDamage

      public void setDamage(float damage)
    • multiplyDamage

      public void multiplyDamage(float mul)
    • 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
    • hit

      public void hit()
      Called when the projectile has reached its target
    • isDone

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

      public abstract boolean hasReachedTarget()
    • onDone

      public void onDone()
    • flyOnEnemy

      public void flyOnEnemy(Enemy enemy)
      Make projectile fly towards an enemy (some projectile types, such as Laser, do not implement this method)
    • applyDrawInterpolation

      public abstract void applyDrawInterpolation(float interpolatedTime)
    • update

      public abstract void update(float delta)
    • draw

      public abstract void draw(Batch batch, float delta)
    • toString

      public String toString()
      Overrides:
      toString in class Object