Class GridAction.ExplosionAction

java.lang.Object
com.badlogic.gdx.scenes.scene2d.Action
com.badlogic.gdx.scenes.scene2d.actions.TemporalAction
com.github.yellowstonegames.glyph.GridAction
com.github.yellowstonegames.glyph.GridAction.ExplosionAction
All Implemented Interfaces:
com.badlogic.gdx.scenes.scene2d.actions.FinishableAction, com.badlogic.gdx.utils.Pool.Poolable
Direct Known Subclasses:
GridAction.CloudAction, GridAction.GibberishAction, GridAction.PulseAction
Enclosing class:
GridAction

public static class GridAction.ExplosionAction extends GridAction
A GridAction that draws a blast of changing background colors in a given radius, potentially avoiding changing the colors of solid obstacles defined by a lightMap. Various preset color options are available and can be called on a newly-created ExplosionAction before it is drawn, such as useMistyColors(), useElectricColors(), and useAcridColors(). You can also pass in completely custom colors to the constructor
  • Nested Class Summary

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    List<com.github.yellowstonegames.grid.Coord>
    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).
    com.github.yellowstonegames.grid.Coord
    Normally you should set this in the constructor, and not change it later.
    int[]
    Exactly seven (7) colors as RGBA8888 ints to use for the different phases and intensities of the blast.
    float[][]
    The internal representation of how affected each cell is by the explosion, based on proximity to center.
    int
    Normally you should set this in the constructor, and not change it later.
    int
    An int that determines how any pseudo-random effects in this will look.

    Fields inherited from class GridAction

    grid, GUI_RANDOM, valid

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

    actor, target
  • Constructor Summary

    Constructors
    Constructor
    Description
    ExplosionAction(GlyphGrid targeting, float duration, com.github.yellowstonegames.grid.Coord center, int radius)
    Constructs an ExplosionAction with explicit settings for some fields.
    ExplosionAction(GlyphGrid targeting, float duration, com.github.yellowstonegames.grid.Region valid, com.github.yellowstonegames.grid.Coord center, int radius)
    Constructs an ExplosionAction with explicit settings for most fields.
    ExplosionAction(GlyphGrid targeting, float duration, com.github.yellowstonegames.grid.Region valid, com.github.yellowstonegames.grid.Coord center, int radius, float angle, float span)
    Constructs an ExplosionAction with explicit settings for most fields; this constructor allows the case where an explosion is directed in a cone or sector shape.
    ExplosionAction(GlyphGrid targeting, float duration, com.github.yellowstonegames.grid.Region valid, com.github.yellowstonegames.grid.Coord center, int radius, float angle, float span, int[] coloring)
    Constructs an ExplosionAction 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.
    ExplosionAction(GlyphGrid targeting, float duration, com.github.yellowstonegames.grid.Region valid, com.github.yellowstonegames.grid.Coord center, int radius, float angle, float span, com.github.tommyettinger.ds.IntList coloring)
    Constructs an ExplosionAction 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.
    ExplosionAction(GlyphGrid targeting, float duration, com.github.yellowstonegames.grid.Region valid, com.github.yellowstonegames.grid.Coord center, int radius, int[] coloring)
    Constructs an ExplosionAction 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.
    ExplosionAction(GlyphGrid targeting, float duration, com.github.yellowstonegames.grid.Region valid, com.github.yellowstonegames.grid.Coord center, int radius, com.github.tommyettinger.ds.IntList coloring)
    Constructs an ExplosionAction 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.
    ExplosionAction(GlyphGrid targeting, com.github.yellowstonegames.grid.Coord center, int radius)
    Constructs an ExplosionAction with explicit settings for some fields.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    update(float percent)
    Called each frame.
    Sets the colors this ExplosionAction uses to go from through various shades of yellow-green before fading.
    Sets the colors this ExplosionAction uses to go from through various shades of gray-purple before fading.
    Sets the colors this ExplosionAction uses to go from orange, to yellow, to orange, to dark gray, then fade.
    Sets the colors this ExplosionAction uses to go from through various shades of pale blue before fading.
    Sets the colors this ExplosionAction uses to go from through various shades of vivid purple before fading.

    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 Object

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

    • center

      public com.github.yellowstonegames.grid.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 int[] colors
      Exactly seven (7) colors as RGBA8888 ints to use for the different phases and intensities of the blast. 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 an IntList of RGBA8888 colors to the constructor or change this array directly. The constructors can use different sizes of color arrays/lists.
    • lightMap

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

      public List<com.github.yellowstonegames.grid.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.
    • seed

      public int seed
      An int that determines how any pseudo-random effects in this will look. This is usually set at creation by the constructor (using GridAction.GUI_RANDOM to get a random int), but you can set this manually to replicate a particular appearance, such as for replays.
  • Constructor Details

    • ExplosionAction

      public ExplosionAction(GlyphGrid targeting, com.github.yellowstonegames.grid.Coord center, int radius)
      Constructs an ExplosionAction with explicit settings for some fields. The valid cells this can affect will be the full expanse of the GlyphGrid. The duration will be 1 second.
      Parameters:
      targeting - the GlyphGrid to affect
      center - the center of the explosion
      radius - the radius of the explosion, in cells
    • ExplosionAction

      public ExplosionAction(GlyphGrid targeting, float duration, com.github.yellowstonegames.grid.Coord center, int radius)
      Constructs an ExplosionAction with explicit settings for some fields. The valid cells this can affect will be the full expanse of the GlyphGrid.
      Parameters:
      targeting - the GlyphGrid to affect
      duration - the duration of this GridAction in seconds, as a float
      center - the center of the explosion
      radius - the radius of the explosion, in cells
    • ExplosionAction

      public ExplosionAction(GlyphGrid targeting, float duration, com.github.yellowstonegames.grid.Region valid, com.github.yellowstonegames.grid.Coord center, int radius)
      Constructs an ExplosionAction with explicit settings for most fields.
      Parameters:
      targeting - the GlyphGrid to affect
      duration - the duration of this GridAction in seconds, as a float
      valid - the valid cells that can be changed by this GridAction, as a Region
      center - the center of the explosion
      radius - the radius of the explosion, in cells
    • ExplosionAction

      public ExplosionAction(GlyphGrid targeting, float duration, com.github.yellowstonegames.grid.Region valid, com.github.yellowstonegames.grid.Coord center, int radius, com.github.tommyettinger.ds.IntList coloring)
      Constructs an ExplosionAction 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 GlyphGrid to affect
      duration - the duration of this GridAction in seconds, as a float
      valid - the valid cells that can be changed by this GridAction, as a Region
      center - the center of the explosion
      radius - the radius of the explosion, in cells
      coloring - an IntList of RGBA8888 colors that will replace the default fire/smoke colors here
    • ExplosionAction

      public ExplosionAction(GlyphGrid targeting, float duration, com.github.yellowstonegames.grid.Region valid, com.github.yellowstonegames.grid.Coord center, int radius, int[] coloring)
      Constructs an ExplosionAction 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 GlyphGrid to affect
      duration - the duration of this GridAction in seconds, as a float
      valid - the valid cells that can be changed by this GridAction, as a Region
      center - the center of the explosion
      radius - the radius of the explosion, in cells
      coloring - an array of RGBA8888 int colors that will replace the default fire/smoke colors here
    • ExplosionAction

      public ExplosionAction(GlyphGrid targeting, float duration, com.github.yellowstonegames.grid.Region valid, com.github.yellowstonegames.grid.Coord center, int radius, float angle, float span)
      Constructs an ExplosionAction 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 GlyphGrid to affect
      duration - the duration of this GridAction in seconds, as a float
      valid - the valid cells that can be changed by this GridAction, as a Region
      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
    • ExplosionAction

      public ExplosionAction(GlyphGrid targeting, float duration, com.github.yellowstonegames.grid.Region valid, com.github.yellowstonegames.grid.Coord center, int radius, float angle, float span, com.github.tommyettinger.ds.IntList coloring)
      Constructs an ExplosionAction 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 GlyphGrid to affect
      duration - the duration of this GridAction in seconds, as a float
      valid - the valid cells that can be changed by this GridAction, as a Region
      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 IntList of RGBA8888 colors that will replace the default fire/smoke colors here
    • ExplosionAction

      public ExplosionAction(GlyphGrid targeting, float duration, com.github.yellowstonegames.grid.Region valid, com.github.yellowstonegames.grid.Coord center, int radius, float angle, float span, int[] coloring)
      Constructs an ExplosionAction 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 GlyphGrid to affect
      duration - the duration of this GridAction in seconds, as a float
      valid - the valid cells that can be changed by this GridAction, as a Region
      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 RGBA8888 int colors 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

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

      public GridAction.ExplosionAction useFieryColors()
      Sets the colors this ExplosionAction 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 GibberishAction. This may look more like a fiery blast if used with an ExplosionAction than a GibberishAction.
    • useMistyColors

      public GridAction.ExplosionAction useMistyColors()
      Sets the colors this ExplosionAction uses to go from through various shades of pale blue before fading. Meant for mist or fog, especially with GridAction.CloudAction.
    • useAcridColors

      public GridAction.ExplosionAction useAcridColors()
      Sets the colors this ExplosionAction uses to go from through various shades of yellow-green before fading. Meant for acidic effects or some poisons, especially with GridAction.CloudAction.
    • useToxicColors

      public GridAction.ExplosionAction useToxicColors()
      Sets the colors this ExplosionAction uses to go from through various shades of vivid purple before fading. Meant for poison effects.