Package squidpony.squidgrid.gui.gdx
Class PanelEffect.ProjectileEffect
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
- All Implemented Interfaces:
com.badlogic.gdx.utils.Pool.Poolable
- Direct Known Subclasses:
PanelEffect.SteadyProjectileEffect
- Enclosing class:
- PanelEffect
public static class PanelEffect.ProjectileEffect 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 Coord[]
affected
The raw list of Coords that might be affected by the projectile, or are on its (potential) path.float
color
The color used for the projectile as a packed float; defaults to white.Coord
endPoint
Normally you should set this in the constructor, and not change it later.char
shown
The char to show at each stage of the projectile's path; defaults to a Unicode bullet symbol, '·'.Coord
startPoint
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 ProjectileEffect(IPackedColorPanel targeting, float duration, Coord startPoint, Coord endPoint)
Constructs a ProjectileEffect with explicit settings for some fields.ProjectileEffect(IPackedColorPanel targeting, float duration, GreasedRegion valid, Coord startPoint, Coord endPoint)
Constructs a ProjectileEffect with explicit settings for most fields.ProjectileEffect(IPackedColorPanel targeting, float duration, GreasedRegion valid, Coord startPoint, Coord endPoint, char shown, float coloring)
Constructs a ProjectileEffect with explicit settings for most fields but also an alternate Color object for the projectile instead of the default white color.ProjectileEffect(IPackedColorPanel targeting, float duration, GreasedRegion valid, Coord startPoint, Coord endPoint, char shown, com.badlogic.gdx.graphics.Color coloring)
Constructs a ProjectileEffect with explicit settings for most fields but also an alternate Color object for the projectile instead of the default white color.ProjectileEffect(IPackedColorPanel targeting, Coord startPoint, Coord endPoint)
Constructs a ProjectileEffect with explicit settings for some fields. -
Method Summary
Modifier and Type Method Description protected void
update(float percent)
Called each frame.void
useArcPathInterpolation()
Makes this ProjectileEffect take an "arc-like" path toward the target, where it is fast at the beginning and end of its motion and is reaching the height of its arc at the center.void
useStraightPathInterpolation()
Makes this ProjectileEffect take a direct path to the target, traveling at uniform speed throughout its path.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
-
startPoint
Normally you should set this in the constructor, and not change it later. -
endPoint
Normally you should set this in the constructor, and not change it later. -
shown
The char to show at each stage of the projectile's path; defaults to a Unicode bullet symbol, '·'. -
color
The color used for the projectile as a packed float; defaults to white. -
affected
The raw list of Coords that might be affected by the projectile, or are on its (potential) path. You can edit this if you need to, but it isn't recommended; because it is an array you would need to assign a new Coord array if the length changes.
-
-
Constructor Details
-
ProjectileEffect
Constructs a ProjectileEffect 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 affectstartPoint
- the starting point of the projectile; may be best if it is adjacent to whatever fires itendPoint
- the point to try to hit with the projectile; this should always succeed with no obstructions
-
ProjectileEffect
public ProjectileEffect(IPackedColorPanel targeting, float duration, Coord startPoint, Coord endPoint)Constructs a ProjectileEffect 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 floatstartPoint
- the starting point of the projectile; may be best if it is adjacent to whatever fires itendPoint
- the point to try to hit with the projectile; this should always succeed with no obstructions
-
ProjectileEffect
public ProjectileEffect(IPackedColorPanel targeting, float duration, GreasedRegion valid, Coord startPoint, Coord endPoint)Constructs a ProjectileEffect 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 GreasedRegionstartPoint
- the starting point of the projectile; may be best if it is adjacent to whatever fires itendPoint
- the point to try to hit with the projectile; this may not be reached if the path crosses a cell not in valid
-
ProjectileEffect
public ProjectileEffect(IPackedColorPanel targeting, float duration, GreasedRegion valid, Coord startPoint, Coord endPoint, char shown, com.badlogic.gdx.graphics.Color coloring)Constructs a ProjectileEffect 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 affectduration
- the duration of this PanelEffect in seconds, as a floatvalid
- the valid cells that can be changed by this PanelEffect, as a GreasedRegionstartPoint
- the starting point of the projectile; may be best if it is adjacent to whatever fires itendPoint
- the point to try to hit with the projectile; this may not be reached if the path crosses a cell not in validshown
- the char to show at each step of the projectile's path as it advancescoloring
- a Color or subclass thereof that will replace the default white color here
-
ProjectileEffect
public ProjectileEffect(IPackedColorPanel targeting, float duration, GreasedRegion valid, Coord startPoint, Coord endPoint, char shown, float coloring)Constructs a ProjectileEffect 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 affectduration
- the duration of this PanelEffect in seconds, as a floatvalid
- the valid cells that can be changed by this PanelEffect, as a GreasedRegionstartPoint
- the starting point of the projectile; may be best if it is adjacent to whatever fires itendPoint
- the point to try to hit with the projectile; this may not be reached if the path crosses a cell not in validshown
- the char to show at each step of the projectile's path as it advancescoloring
- an array of colors as packed floats that will replace the default white color here
-
-
Method Details
-
useArcPathInterpolation
Makes this ProjectileEffect take an "arc-like" path toward the target, where it is fast at the beginning and end of its motion and is reaching the height of its arc at the center. -
useStraightPathInterpolation
Makes this ProjectileEffect take a direct path to the target, traveling at uniform speed throughout its path. -
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.
-