Package squidpony.squidgrid.gui.gdx
Class PanelEffect
java.lang.Object
com.badlogic.gdx.scenes.scene2d.Action
com.badlogic.gdx.scenes.scene2d.actions.TemporalAction
squidpony.squidgrid.gui.gdx.PanelEffect
- All Implemented Interfaces:
com.badlogic.gdx.utils.Pool.Poolable
- Direct Known Subclasses:
PanelEffect.ExplosionEffect
,PanelEffect.GlowBallEffect
,PanelEffect.ProjectileEffect
public abstract class PanelEffect extends com.badlogic.gdx.scenes.scene2d.actions.TemporalAction
Various special effects that can be applied to a
Created by Tommy Ettinger on 5/24/2017.
SquidPanel
or SparseLayers
as an
Action
. The PanelEffect class is abstract and has implementations as static
inner classes, such as PanelEffect.ExplosionEffect
. Each PanelEffect specifically affects one IPackedColorPanel
(an interface that both SquidPanel and SparseLayers implement), which can be a layer in a SquidLayers object or a
SquidPanel/SparseLayers on its own. By adding the PanelEffect to any actor using
Actor.addAction(Action)
when the Actor has its act() method called after the
normal map parts of the panel have been placed, the PanelEffect will advance and change what chars/colors are in
the panel as specified in its implementation of the TemporalAction.update(float)
method. Typically the Actor you add this
to is the SquidPanel or SparseLayers this affects, but it could also be a SquidLayers. Most PanelEffect
implementations should allow most configuration to be set in their constructors.
Created by Tommy Ettinger on 5/24/2017.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PanelEffect.ExplosionEffect
static class
PanelEffect.GibberishEffect
static class
PanelEffect.GlowBallEffect
static class
PanelEffect.ProjectileEffect
static class
PanelEffect.PulseEffect
static class
PanelEffect.SteadyProjectileEffect
Almost exactly lkePanelEffect.ProjectileEffect
, but its duration specifies the amount of time to spend crossing each cell (in seconds), not the duration of the entire effect. -
Field Summary
Fields Modifier and Type Field Description static com.badlogic.gdx.math.Interpolation
fastInSlowMidFastOut
IPackedColorPanel
target
GreasedRegion
validCells
-
Constructor Summary
Constructors Modifier Constructor Description protected
PanelEffect(IPackedColorPanel targeting)
protected
PanelEffect(IPackedColorPanel targeting, float duration)
protected
PanelEffect(IPackedColorPanel targeting, float duration, GreasedRegion valid)
-
Method Summary
Modifier and Type Method Description static com.badlogic.gdx.scenes.scene2d.Action
makeGrenadeEffect(PanelEffect.ProjectileEffect projectile, com.badlogic.gdx.scenes.scene2d.Action result)
Convenience method to make a ProjectileEffect or SteadyProjectileEffect 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, before triggering another Action when the projectile stops (often this might be anPanelEffect.ExplosionEffect
, but could be any scene2d Action).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, update
-
Field Details
-
Constructor Details
-
Method Details
-
makeGrenadeEffect
public static com.badlogic.gdx.scenes.scene2d.Action makeGrenadeEffect(PanelEffect.ProjectileEffect projectile, com.badlogic.gdx.scenes.scene2d.Action result)Convenience method to make a ProjectileEffect or SteadyProjectileEffect 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, before triggering another Action when the projectile stops (often this might be anPanelEffect.ExplosionEffect
, but could be any scene2d Action).- Parameters:
projectile
- aPanelEffect.ProjectileEffect
(or a subclass of it) to run as the first stepresult
- anAction
to run after the ProjectileEffect completes- Returns:
- an Action that can be added to a scene2d Actor, such as a SquidLayers or SparseLayers
-