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
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
Nested classes/interfaces inherited from class GridAction
GridAction.CloudAction, GridAction.ExplosionAction, GridAction.GibberishAction, GridAction.PulseAction, GridAction.TintAction -
Field Summary
FieldsModifier and TypeFieldDescriptionList<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.CoordNormally 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.intNormally you should set this in the constructor, and not change it later.intAn int that determines how any pseudo-random effects in this will look.Fields inherited from class GridAction
grid, GUI_RANDOM, validFields inherited from class com.badlogic.gdx.scenes.scene2d.Action
actor, target -
Constructor Summary
ConstructorsConstructorDescriptionExplosionAction(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 TypeMethodDescriptionprotected voidupdate(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, setTimeMethods inherited from class com.badlogic.gdx.scenes.scene2d.Action
getActor, getPool, getTarget, setActor, setPool, setTarget, toString
-
Field Details
-
center
public com.github.yellowstonegames.grid.Coord centerNormally you should set this in the constructor, and not change it later. -
radius
public int radiusNormally you should set this in the constructor, and not change it later. -
colors
public int[] colorsExactly 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[][] lightMapThe internal representation of how affected each cell is by the explosion, based on proximity to center. -
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 seedAn int that determines how any pseudo-random effects in this will look. This is usually set at creation by the constructor (usingGridAction.GUI_RANDOMto 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 affectcenter- the center of the explosionradius- 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 affectduration- the duration of this GridAction in seconds, as a floatcenter- the center of the explosionradius- 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 affectduration- the duration of this GridAction in seconds, as a floatvalid- the valid cells that can be changed by this GridAction, as a Regioncenter- the center of the explosionradius- 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 affectduration- the duration of this GridAction in seconds, as a floatvalid- the valid cells that can be changed by this GridAction, as a Regioncenter- the center of the explosionradius- the radius of the explosion, in cellscoloring- 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 affectduration- the duration of this GridAction in seconds, as a floatvalid- the valid cells that can be changed by this GridAction, as a Regioncenter- the center of the explosionradius- the radius of the explosion, in cellscoloring- 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 onangle(in degrees) and will cover an amount of the circular area (in degrees) equal tospan.- Parameters:
targeting- the GlyphGrid to affectduration- the duration of this GridAction in seconds, as a floatvalid- the valid cells that can be changed by this GridAction, as a Regioncenter- the center of the explosionradius- the radius of the explosion, in cellsangle- the angle, in degrees, that will be the center of the sector-shaped effectspan- 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 onangle(in degrees) and will cover an amount of the circular area (in degrees) equal tospan.- Parameters:
targeting- the GlyphGrid to affectduration- the duration of this GridAction in seconds, as a floatvalid- the valid cells that can be changed by this GridAction, as a Regioncenter- the center of the explosionradius- the radius of the explosion, in cellsangle- the angle, in degrees, that will be the center of the sector-shaped effectspan- the span, in degrees, of the full arc at the end of the sector-shaped effectcoloring- 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 onangle(in degrees) and will cover an amount of the circular area (in degrees) equal tospan.- Parameters:
targeting- the GlyphGrid to affectduration- the duration of this GridAction in seconds, as a floatvalid- the valid cells that can be changed by this GridAction, as a Regioncenter- the center of the explosionradius- the radius of the explosion, in cellsangle- the angle, in degrees, that will be the center of the sector-shaped effectspan- the span, in degrees, of the full arc at the end of the sector-shaped effectcoloring- 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:
updatein classcom.badlogic.gdx.scenes.scene2d.actions.TemporalAction- Parameters:
percent- The percentage of completion for this action, growing from 0 to 1 over the duration. Ifreversed, this will shrink from 1 to 0.
-
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 itsGridAction.GibberishAction.choicesare selected in a way that fits that theme. -
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
Sets the colors this ExplosionAction uses to go from through various shades of pale blue before fading. Meant for mist or fog, especially withGridAction.CloudAction. -
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 withGridAction.CloudAction. -
useToxicColors
Sets the colors this ExplosionAction uses to go from through various shades of vivid purple before fading. Meant for poison effects.
-