From 4fc020d6e3b2a45ab4921d8e9afc7ed44d672316 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 31 Mar 2022 01:32:09 -0400 Subject: [PATCH] v1.2.1: fixed fader effects stacking (e.g. when taking damage) --- .../shatteredpixeldungeon/scenes/PixelScene.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/PixelScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/PixelScene.java index 7c2b52db2..a6b2ebd60 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/PixelScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/PixelScene.java @@ -310,6 +310,8 @@ public class PixelScene extends Scene { private boolean light; private float time; + + private static Fader INSTANCE; public Fader( int color, boolean light ) { super( uiCamera.width, uiCamera.height, color ); @@ -320,6 +322,11 @@ public class PixelScene extends Scene { alpha( 1f ); time = FADE_TIME; + + if (INSTANCE != null){ + INSTANCE.killAndErase(); + } + INSTANCE = this; } @Override @@ -331,6 +338,9 @@ public class PixelScene extends Scene { alpha( 0f ); parent.remove( this ); destroy(); + if (INSTANCE == this) { + INSTANCE = null; + } } else { alpha( time / FADE_TIME ); }