Class PanelEffect.ExplosionEffect

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.ExplosionEffect
All Implemented Interfaces:
com.badlogic.gdx.utils.Pool.Poolable
Direct Known Subclasses:
PanelEffect.GibberishEffect, PanelEffect.PulseEffect
Enclosing class:
PanelEffect

public static class PanelEffect.ExplosionEffect
extends PanelEffect
  • Nested Class Summary

  • Field Summary

    Fields 
    Modifier and Type Field Description
    List<Coord> affected
    The raw list of Coords that might be affected by the explosion; may include some cells that aren't going to show as exploding (it usually has some false positives), but shouldn't exclude any cells that should show as such (no false negatives).
    Coord center
    Normally you should set this in the constructor, and not change it later.
    float[] colors
    The default explosion colors are normal for (non-chemical, non-electrical) fire and smoke, going from orange at the start to yellow, very light yellow, and then back to a different orange before going to smoke and fading out to translucent and then transparent by the end.
    double[][] lightMap
    The internal representation of how affected each cell is by the explosion, based on proximity to center.
    int radius
    Normally you should set this in the constructor, and not change it later.

    Fields inherited from class squidpony.squidgrid.gui.gdx.PanelEffect

    fastInSlowMidFastOut, target, validCells

    Fields inherited from class com.badlogic.gdx.scenes.scene2d.Action

    actor
  • Constructor Summary

    Constructors 
    Constructor Description
    ExplosionEffect​(IPackedColorPanel targeting, float duration, Coord center, int radius)
    Constructs an ExplosionEffect with explicit settings for some fields.
    ExplosionEffect​(IPackedColorPanel targeting, float duration, GreasedRegion valid, Coord center, int radius)
    Constructs an ExplosionEffect with explicit settings for most fields.
    ExplosionEffect​(IPackedColorPanel targeting, float duration, GreasedRegion valid, Coord center, int radius, double angle, double span)
    Constructs an ExplosionEffect with explicit settings for most fields; this constructor allows the case where an explosion is directed in a cone or sector shape.
    ExplosionEffect​(IPackedColorPanel targeting, float duration, GreasedRegion valid, Coord center, int radius, double angle, double span, float[] coloring)
    Constructs an ExplosionEffect with explicit settings for most fields but also an alternate group of Color objects that it will use to color the explosion instead of using fiery/smoke colors; this constructor allows the case where an explosion is directed in a cone or sector shape.
    ExplosionEffect​(IPackedColorPanel targeting, float duration, GreasedRegion valid, Coord center, int radius, double angle, double span, List<? extends com.badlogic.gdx.graphics.Color> coloring)
    Constructs an ExplosionEffect with explicit settings for most fields but also an alternate group of Color objects that it will use to color the explosion instead of using fiery/smoke colors; this constructor allows the case where an explosion is directed in a cone or sector shape.
    ExplosionEffect​(IPackedColorPanel targeting, float duration, GreasedRegion valid, Coord center, int radius, float[] coloring)
    Constructs an ExplosionEffect with explicit settings for most fields but also an alternate group of Color objects that it will use to color the explosion instead of using fiery/smoke colors.
    ExplosionEffect​(IPackedColorPanel targeting, float duration, GreasedRegion valid, Coord center, int radius, List<? extends com.badlogic.gdx.graphics.Color> coloring)
    Constructs an ExplosionEffect with explicit settings for most fields but also an alternate group of Color objects that it will use to color the explosion instead of using fiery/smoke colors.
    ExplosionEffect​(IPackedColorPanel targeting, Coord center, int radius)
    Constructs an ExplosionEffect with explicit settings for some fields.
  • Method Summary

    Modifier and Type Method Description
    protected void update​(float percent)
    Called each frame.
    PanelEffect.ExplosionEffect useElectricColors()
    Sets the colors this ExplosionEffect uses to go from through various shades of gray-purple before fading.
    PanelEffect.ExplosionEffect useFieryColors()
    Sets the colors this ExplosionEffect uses to go from orange, to yellow, to orange, to dark gray, then fade.

    Methods inherited from class squidpony.squidgrid.gui.gdx.PanelEffect

    makeGrenadeEffect

    Methods inherited from class com.badlogic.gdx.scenes.scene2d.actions.TemporalAction

    act, begin, end, finish, getDuration, getInterpolation, getTime, isComplete, isReverse, reset, restart, setDuration, setInterpolation, setReverse, setTime

    Methods inherited from class com.badlogic.gdx.scenes.scene2d.Action

    getActor, getPool, getTarget, setActor, setPool, setTarget, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • center

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

      public int radius
      Normally you should set this in the constructor, and not change it later.
    • colors

      public float[] colors
      The default explosion colors are normal for (non-chemical, non-electrical) fire and smoke, going from orange at the start to yellow, very light yellow, and then back to a different orange before going to smoke and fading out to translucent and then transparent by the end.
      If you want to change the colors the explosion uses, you can either pass a List of Color (or SColor or other subclasses) to the constructor or change this array directly. The float items assigned to this should be the result of calling Color.toFloatBits() or possibly the result of mixing multiple existing floats with SColor.lerpFloatColors(float, float, float); other floats that can be directly used by libGDX, that is, packed as ABGR floats (usually the docs will call this a packed float), can also be used.
    • lightMap

      public double[][] lightMap
      The internal representation of how affected each cell is by the explosion, based on proximity to center.
    • affected

      public List<Coord> affected
      The raw list of Coords that might be affected by the explosion; may include some cells that aren't going to show as exploding (it usually has some false positives), but shouldn't exclude any cells that should show as such (no false negatives). You can edit this if you need to, but it isn't recommended.
  • Constructor Details

    • ExplosionEffect

      public ExplosionEffect​(IPackedColorPanel targeting, Coord center, int radius)
      Constructs an ExplosionEffect 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
      center - the center of the explosion
      radius - the radius of the explosion, in cells
    • ExplosionEffect

      public ExplosionEffect​(IPackedColorPanel targeting, float duration, Coord center, int radius)
      Constructs an ExplosionEffect 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
      center - the center of the explosion
      radius - the radius of the explosion, in cells
    • ExplosionEffect

      public ExplosionEffect​(IPackedColorPanel targeting, float duration, GreasedRegion valid, Coord center, int radius)
      Constructs an ExplosionEffect 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
      center - the center of the explosion
      radius - the radius of the explosion, in cells
    • ExplosionEffect

      public ExplosionEffect​(IPackedColorPanel targeting, float duration, GreasedRegion valid, Coord center, int radius, List<? extends com.badlogic.gdx.graphics.Color> coloring)
      Constructs an ExplosionEffect with explicit settings for most fields but also an alternate group of Color objects that it will use to color the explosion instead of using fiery/smoke colors.
      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
      center - the center of the explosion
      radius - the radius of the explosion, in cells
      coloring - a List of Color or subclasses thereof that will replace the default fire/smoke colors here
    • ExplosionEffect

      public ExplosionEffect​(IPackedColorPanel targeting, float duration, GreasedRegion valid, Coord center, int radius, float[] coloring)
      Constructs an ExplosionEffect with explicit settings for most fields but also an alternate group of Color objects that it will use to color the explosion instead of using fiery/smoke colors.
      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
      center - the center of the explosion
      radius - the radius of the explosion, in cells
      coloring - an array of colors as packed floats that will replace the default fire/smoke colors here
    • ExplosionEffect

      public ExplosionEffect​(IPackedColorPanel targeting, float duration, GreasedRegion valid, Coord center, int radius, double angle, double span)
      Constructs an ExplosionEffect with explicit settings for most fields; this constructor allows the case where an explosion is directed in a cone or sector shape. It will center the sector on angle (in degrees) and will cover an amount of the circular area (in degrees) equal to span.
      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
      center - the center of the explosion
      radius - the radius of the explosion, in cells
      angle - the angle, in degrees, that will be the center of the sector-shaped effect
      span - the span, in degrees, of the full arc at the end of the sector-shaped effect
    • ExplosionEffect

      public ExplosionEffect​(IPackedColorPanel targeting, float duration, GreasedRegion valid, Coord center, int radius, double angle, double span, List<? extends com.badlogic.gdx.graphics.Color> coloring)
      Constructs an ExplosionEffect with explicit settings for most fields but also an alternate group of Color objects that it will use to color the explosion instead of using fiery/smoke colors; this constructor allows the case where an explosion is directed in a cone or sector shape. It will center the sector on angle (in degrees) and will cover an amount of the circular area (in degrees) equal to span.
      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
      center - the center of the explosion
      radius - the radius of the explosion, in cells
      angle - the angle, in degrees, that will be the center of the sector-shaped effect
      span - the span, in degrees, of the full arc at the end of the sector-shaped effect
      coloring - a List of Color or subclasses thereof that will replace the default fire/smoke colors here
    • ExplosionEffect

      public ExplosionEffect​(IPackedColorPanel targeting, float duration, GreasedRegion valid, Coord center, int radius, double angle, double span, float[] coloring)
      Constructs an ExplosionEffect with explicit settings for most fields but also an alternate group of Color objects that it will use to color the explosion instead of using fiery/smoke colors; this constructor allows the case where an explosion is directed in a cone or sector shape. It will center the sector on angle (in degrees) and will cover an amount of the circular area (in degrees) equal to span.
      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
      center - the center of the explosion
      radius - the radius of the explosion, in cells
      angle - the angle, in degrees, that will be the center of the sector-shaped effect
      span - the span, in degrees, of the full arc at the end of the sector-shaped effect
      coloring - an array of colors as packed floats that will replace the default fire/smoke colors here
  • Method Details

    • 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.
    • useElectricColors

      Sets the colors this ExplosionEffect uses to go from through various shades of gray-purple before fading. Meant for electrical bursts, this will affect character foregrounds in a GibberishEffect. This should look like sparks in GibberishEffect if the chars in PanelEffect.GibberishEffect.choices are selected in a way that fits that theme.
    • useFieryColors

      Sets the colors this ExplosionEffect uses to go from orange, to yellow, to orange, to dark gray, then fade. Meant for fiery explosions with smoke, this will affect character foregrounds in a GibberishEffect. This may look more like a fiery blast if used with an ExplosionEffect than a GibberishEffect.