Package squidpony.squidgrid.gui.gdx
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
Nested classes/interfaces inherited from class squidpony.squidgrid.gui.gdx.PanelEffect
PanelEffect.ExplosionEffect, PanelEffect.GibberishEffect, PanelEffect.GlowBallEffect, PanelEffect.ProjectileEffect, PanelEffect.PulseEffect, PanelEffect.SteadyProjectileEffect
-
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
-
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 com.badlogic.gdx.scenes.scene2d.actions.TemporalAction
act, begin, end, finish, getDuration, getInterpolation, getTime, isComplete, isReverse, reset, restart, setDuration, setInterpolation, setReverse, setTime
-
Field Details
-
center
Normally you should set this in the constructor, and not change it later. -
radius
Normally you should set this in the constructor, and not change it later. -
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 callingColor.toFloatBits()
or possibly the result of mixing multiple existing floats withSColor.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
The 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.
-
-
Constructor Details
-
ExplosionEffect
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 affectcenter
- the center of the explosionradius
- the radius of the explosion, in cells
-
ExplosionEffect
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 affectduration
- the duration of this PanelEffect in seconds, as a floatcenter
- the center of the explosionradius
- 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 affectduration
- the duration of this PanelEffect in seconds, as a floatvalid
- the valid cells that can be changed by this PanelEffect, as a GreasedRegioncenter
- the center of the explosionradius
- 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 affectduration
- the duration of this PanelEffect in seconds, as a floatvalid
- the valid cells that can be changed by this PanelEffect, as a GreasedRegioncenter
- the center of the explosionradius
- the radius of the explosion, in cellscoloring
- 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 affectduration
- the duration of this PanelEffect in seconds, as a floatvalid
- the valid cells that can be changed by this PanelEffect, as a GreasedRegioncenter
- the center of the explosionradius
- the radius of the explosion, in cellscoloring
- 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 onangle
(in degrees) and will cover an amount of the circular area (in degrees) equal tospan
.- Parameters:
targeting
- the IPackedColorPanel to affectduration
- the duration of this PanelEffect in seconds, as a floatvalid
- the valid cells that can be changed by this PanelEffect, as a GreasedRegioncenter
- 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
-
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 onangle
(in degrees) and will cover an amount of the circular area (in degrees) equal tospan
.- Parameters:
targeting
- the IPackedColorPanel to affectduration
- the duration of this PanelEffect in seconds, as a floatvalid
- the valid cells that can be changed by this PanelEffect, as a GreasedRegioncenter
- 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
- 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 onangle
(in degrees) and will cover an amount of the circular area (in degrees) equal tospan
.- Parameters:
targeting
- the IPackedColorPanel to affectduration
- the duration of this PanelEffect in seconds, as a floatvalid
- the valid cells that can be changed by this PanelEffect, as a GreasedRegioncenter
- 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 colors as packed floats that will replace the default fire/smoke colors here
-
-
Method Details
-
update
Called each frame.- Specified by:
update
in 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 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 inPanelEffect.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.
-