v3.0.0: fixed char particle effects persisting in some cases

This commit is contained in:
Evan Debenham
2024-12-18 11:45:23 -05:00
parent 174f8be2a7
commit 3c14b0a8fa

View File

@@ -362,6 +362,7 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
synchronized (State.class) { synchronized (State.class) {
switch (state) { switch (state) {
case BURNING: case BURNING:
if (burning != null) burning.on = false;
burning = emitter(); burning = emitter();
burning.pour(FlameParticle.FACTORY, 0.06f); burning.pour(FlameParticle.FACTORY, 0.06f);
if (visible) { if (visible) {
@@ -369,13 +370,12 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
} }
break; break;
case LEVITATING: case LEVITATING:
if (levitation != null) levitation.on = false;
levitation = emitter(); levitation = emitter();
levitation.pour(Speck.factory(Speck.JET), 0.02f); levitation.pour(Speck.factory(Speck.JET), 0.02f);
break; break;
case INVISIBLE: case INVISIBLE:
if (invisible != null) { if (invisible != null) invisible.killAndErase();
invisible.killAndErase();
}
invisible = new AlphaTweener(this, 0.4f, 0.4f); invisible = new AlphaTweener(this, 0.4f, 0.4f);
if (parent != null) { if (parent != null) {
parent.add(invisible); parent.add(invisible);
@@ -390,9 +390,11 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
iceBlock = IceBlock.freeze(this); iceBlock = IceBlock.freeze(this);
break; break;
case ILLUMINATED: case ILLUMINATED:
if (light != null) light.putOut();
GameScene.effect(light = new TorchHalo(this)); GameScene.effect(light = new TorchHalo(this));
break; break;
case CHILLED: case CHILLED:
if (chilled != null) chilled.on = false;
chilled = emitter(); chilled = emitter();
chilled.pour(SnowParticle.FACTORY, 0.1f); chilled.pour(SnowParticle.FACTORY, 0.1f);
break; break;
@@ -401,10 +403,12 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
darkBlock = DarkBlock.darken(this); darkBlock = DarkBlock.darken(this);
break; break;
case MARKED: case MARKED:
if (marked != null) marked.on = false;
marked = emitter(); marked = emitter();
marked.pour(ShadowParticle.UP, 0.1f); marked.pour(ShadowParticle.UP, 0.1f);
break; break;
case HEALING: case HEALING:
if (healing != null) healing.on = false;
healing = emitter(); healing = emitter();
healing.pour(Speck.factory(Speck.HEALING), 0.5f); healing.pour(Speck.factory(Speck.HEALING), 0.5f);
break; break;
@@ -413,6 +417,7 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
GameScene.effect(shield = new ShieldHalo(this)); GameScene.effect(shield = new ShieldHalo(this));
break; break;
case HEARTS: case HEARTS:
if (hearts != null) hearts.on = false;
hearts = emitter(); hearts = emitter();
hearts.pour(Speck.factory(Speck.HEART), 0.5f); hearts.pour(Speck.factory(Speck.HEART), 0.5f);
break; break;
@@ -458,6 +463,7 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
case ILLUMINATED: case ILLUMINATED:
if (light != null) { if (light != null) {
light.putOut(); light.putOut();
light = null;
} }
break; break;
case CHILLED: case CHILLED: