Class PanelEffect.SteadyProjectileEffect

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
squidpony.squidgrid.gui.gdx.PanelEffect.SteadyProjectileEffect
All Implemented Interfaces:
com.badlogic.gdx.utils.Pool.Poolable
Enclosing class:
PanelEffect

public static class PanelEffect.SteadyProjectileEffect
extends PanelEffect.ProjectileEffect
Almost exactly lke PanelEffect.ProjectileEffect, but its duration specifies the amount of time to spend crossing each cell (in seconds), not the duration of the entire effect. For ranged weapons like arrows, a fixed duration for the effect (as in ProjectileEffect) would mean an arrow shot at a close-by target travels slowly and an arrow shot at a far-away target travels very quickly; this class avoids that issue. Note that the time spent by the whole effect will vary based on the Chebyshev distance between the start and end points. The speed the projectile travels at is also dependent on the size and aspect ratio of cells it travels over.
  • Constructor Details

    • SteadyProjectileEffect

      public SteadyProjectileEffect​(IPackedColorPanel targeting, Coord startPoint, Coord endPoint)
      Constructs a SteadyProjectileEffect with explicit settings for some fields. The valid cells this can affect will be the full expanse of the IPackedColorPanel. The duration will be 0.05 seconds per cell crossed.
      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
    • SteadyProjectileEffect

      public SteadyProjectileEffect​(IPackedColorPanel targeting, float duration, Coord startPoint, Coord endPoint)
      Constructs a SteadyProjectileEffect 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 time the projectile will take to cross one cell, 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
    • SteadyProjectileEffect

      public SteadyProjectileEffect​(IPackedColorPanel targeting, float duration, GreasedRegion valid, Coord startPoint, Coord endPoint)
      Constructs a SteadyProjectileEffect 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
    • SteadyProjectileEffect

      public SteadyProjectileEffect​(IPackedColorPanel targeting, float duration, GreasedRegion valid, Coord startPoint, Coord endPoint, char shown, com.badlogic.gdx.graphics.Color coloring)
      Constructs a SteadyProjectileEffect 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 time the projectile will take to cross one cell, 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
    • SteadyProjectileEffect

      public SteadyProjectileEffect​(IPackedColorPanel targeting, float duration, GreasedRegion valid, Coord startPoint, Coord endPoint, char shown, float coloring)
      Constructs a SteadyProjectileEffect 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 time the projectile will take to cross one cell, 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