Class PanelEffect.ProjectileEffect

java.lang.Object
com.badlogic.gdx.scenes.scene2d.Action
com.badlogic.gdx.scenes.scene2d.actions.TemporalAction
squidpony.squidgrid.gui.gdx.PanelEffect
squidpony.squidgrid.gui.gdx.PanelEffect.ProjectileEffect
All Implemented Interfaces:
com.badlogic.gdx.utils.Pool.Poolable
Direct Known Subclasses:
PanelEffect.SteadyProjectileEffect
Enclosing class:
PanelEffect

public static class PanelEffect.ProjectileEffect
extends PanelEffect
  • Field Details

    • startPoint

      public Coord startPoint
      Normally you should set this in the constructor, and not change it later.
    • endPoint

      public Coord endPoint
      Normally you should set this in the constructor, and not change it later.
    • shown

      public char shown
      The char to show at each stage of the projectile's path; defaults to a Unicode bullet symbol, '·'.
    • color

      public float color
      The color used for the projectile as a packed float; defaults to white.
    • affected

      public Coord[] affected
      The raw list of Coords that might be affected by the projectile, or are on its (potential) path. You can edit this if you need to, but it isn't recommended; because it is an array you would need to assign a new Coord array if the length changes.
  • Constructor Details

    • ProjectileEffect

      public ProjectileEffect​(IPackedColorPanel targeting, Coord startPoint, Coord endPoint)
      Constructs a ProjectileEffect with explicit settings for some fields. The valid cells this can affect will be the full expanse of the IPackedColorPanel. The duration will be 1 second.
      Parameters:
      targeting - the IPackedColorPanel to affect
      startPoint - the starting point of the projectile; may be best if it is adjacent to whatever fires it
      endPoint - the point to try to hit with the projectile; this should always succeed with no obstructions
    • ProjectileEffect

      public ProjectileEffect​(IPackedColorPanel targeting, float duration, Coord startPoint, Coord endPoint)
      Constructs a ProjectileEffect with explicit settings for some fields. The valid cells this can affect will be the full expanse of the IPackedColorPanel.
      Parameters:
      targeting - the IPackedColorPanel to affect
      duration - the duration of this PanelEffect in seconds, as a float
      startPoint - the starting point of the projectile; may be best if it is adjacent to whatever fires it
      endPoint - the point to try to hit with the projectile; this should always succeed with no obstructions
    • ProjectileEffect

      public ProjectileEffect​(IPackedColorPanel targeting, float duration, GreasedRegion valid, Coord startPoint, Coord endPoint)
      Constructs a ProjectileEffect with explicit settings for most fields.
      Parameters:
      targeting - the IPackedColorPanel to affect
      duration - the duration of this PanelEffect in seconds, as a float
      valid - the valid cells that can be changed by this PanelEffect, as a GreasedRegion
      startPoint - the starting point of the projectile; may be best if it is adjacent to whatever fires it
      endPoint - the point to try to hit with the projectile; this may not be reached if the path crosses a cell not in valid
    • ProjectileEffect

      public ProjectileEffect​(IPackedColorPanel targeting, float duration, GreasedRegion valid, Coord startPoint, Coord endPoint, char shown, com.badlogic.gdx.graphics.Color coloring)
      Constructs a ProjectileEffect with explicit settings for most fields but also an alternate Color object for the projectile instead of the default white color.
      Parameters:
      targeting - the IPackedColorPanel to affect
      duration - the duration of this PanelEffect in seconds, as a float
      valid - the valid cells that can be changed by this PanelEffect, as a GreasedRegion
      startPoint - the starting point of the projectile; may be best if it is adjacent to whatever fires it
      endPoint - the point to try to hit with the projectile; this may not be reached if the path crosses a cell not in valid
      shown - the char to show at each step of the projectile's path as it advances
      coloring - a Color or subclass thereof that will replace the default white color here
    • ProjectileEffect

      public ProjectileEffect​(IPackedColorPanel targeting, float duration, GreasedRegion valid, Coord startPoint, Coord endPoint, char shown, float coloring)
      Constructs a ProjectileEffect with explicit settings for most fields but also an alternate Color object for the projectile instead of the default white color.
      Parameters:
      targeting - the IPackedColorPanel to affect
      duration - the duration of this PanelEffect in seconds, as a float
      valid - the valid cells that can be changed by this PanelEffect, as a GreasedRegion
      startPoint - the starting point of the projectile; may be best if it is adjacent to whatever fires it
      endPoint - the point to try to hit with the projectile; this may not be reached if the path crosses a cell not in valid
      shown - the char to show at each step of the projectile's path as it advances
      coloring - an array of colors as packed floats that will replace the default white color here
  • Method Details

    • useArcPathInterpolation

      public void useArcPathInterpolation()
      Makes this ProjectileEffect take an "arc-like" path toward the target, where it is fast at the beginning and end of its motion and is reaching the height of its arc at the center.
    • useStraightPathInterpolation

      Makes this ProjectileEffect take a direct path to the target, traveling at uniform speed throughout its path.
    • update

      protected void update​(float percent)
      Called each frame.
      Specified by:
      update in class com.badlogic.gdx.scenes.scene2d.actions.TemporalAction
      Parameters:
      percent - The percentage of completion for this action, growing from 0 to 1 over the duration. If reversed, this will shrink from 1 to 0.