Class Feedback
"Juice": what the player sees and hears when something happens, chosen per
WorldEvent type -- the role of Corgi Engine's MMFeedbacks.
A Reaction bundles a camera shake, a screen flash, a sound name and a
particle burst. PlatformView runs every event of every tick through
#react, which shakes the GameCamera and hands the sound and the burst
to a Sink the game supplies (a com.codename1.gaming.SoundPool, a
com.codename1.gaming.ParticleEmitter, a haptic tap). The defaults make a
level feel alive before any tuning: landings thud, stomps pop, hits shake.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classWhat one kind of event does.static interfaceReceives what a reaction plays. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetFlash()The flash color with its current opacity, 0 when none is showing.doubleHow strong shakes, flashes and particle bursts are.voidoff(int eventType) Removes the reaction to an event type.final Feedback.Reactionon(int eventType) The reaction to an event type, created empty if it had none.voidreact(WorldEvent e, boolean aboutPlayer, GameCamera camera, Feedback.Sink sink) Plays an event.voidsetIntensity(double intensity) Scales every shake and flash, for an accessibility "reduce motion" setting.voidupdate(double seconds) Fades the flash.
-
Constructor Details
-
Feedback
public Feedback()Creates feedback with the stock reactions.
-
-
Method Details
-
on
The reaction to an event type, created empty if it had none.
Parameters
eventType: aWorldEventconstant
Returns
the reaction to configure
-
off
public void off(int eventType) Removes the reaction to an event type.
Parameters
eventType: aWorldEventconstant
-
setIntensity
public void setIntensity(double intensity) Scales every shake and flash, for an accessibility "reduce motion" setting.
Parameters
intensity: 0 for none, 1 for full
-
getIntensity
public double getIntensity()How strong shakes, flashes and particle bursts are.
Returns
0 for none, 1 for full
-
react
Plays an event.
Parameters
e: the eventaboutPlayer: whether the player is its subjectcamera: shaken, may be nullsink: receives sounds and particles, may be null
-
update
public void update(double seconds) Fades the flash.
Parameters
seconds: time since the last frame
-
getFlash
public int getFlash()The flash color with its current opacity, 0 when none is showing.
Returns
ARGB
-