v0.4.3a: fixed invisibility fx sometimes sticking when they shouldn't

This commit is contained in:
Evan Debenham 2016-10-19 20:13:35 -04:00
parent 93caf1f1eb
commit 7651e4c557
2 changed files with 13 additions and 11 deletions

View File

@ -32,8 +32,6 @@ import com.watabou.noosa.tweeners.AlphaTweener;
public class PotionOfInvisibility extends Potion { public class PotionOfInvisibility extends Potion {
private static final float ALPHA = 0.4f;
{ {
initials = 3; initials = 3;
} }
@ -51,11 +49,4 @@ public class PotionOfInvisibility extends Potion {
return isKnown() ? 40 * quantity : super.price(); return isKnown() ? 40 * quantity : super.price();
} }
public static void melt( Char ch ) {
if (ch.sprite.parent != null) {
ch.sprite.parent.add( new AlphaTweener( ch.sprite, ALPHA, 0.4f ) );
} else {
ch.sprite.alpha( ALPHA );
}
}
} }

View File

@ -45,6 +45,7 @@ import com.watabou.noosa.MovieClip;
import com.watabou.noosa.Visual; import com.watabou.noosa.Visual;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
import com.watabou.noosa.particles.Emitter; import com.watabou.noosa.particles.Emitter;
import com.watabou.noosa.tweeners.AlphaTweener;
import com.watabou.noosa.tweeners.PosTweener; import com.watabou.noosa.tweeners.PosTweener;
import com.watabou.noosa.tweeners.Tweener; import com.watabou.noosa.tweeners.Tweener;
import com.watabou.utils.Callback; import com.watabou.utils.Callback;
@ -86,6 +87,7 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
protected IceBlock iceBlock; protected IceBlock iceBlock;
protected DarkBlock darkBlock; protected DarkBlock darkBlock;
protected TorchHalo halo; protected TorchHalo halo;
protected AlphaTweener invisible;
protected EmoIcon emo; protected EmoIcon emo;
@ -277,7 +279,12 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
levitation.pour( Speck.factory( Speck.JET ), 0.02f ); levitation.pour( Speck.factory( Speck.JET ), 0.02f );
break; break;
case INVISIBLE: case INVISIBLE:
PotionOfInvisibility.melt( ch ); if (parent != null){
if (invisible != null) invisible.killAndErase();
invisible = new AlphaTweener( this, 0.4f, 0.4f );
parent.add(invisible);
} else
alpha( 0.4f );
break; break;
case PARALYSED: case PARALYSED:
paused = true; paused = true;
@ -318,6 +325,10 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
} }
break; break;
case INVISIBLE: case INVISIBLE:
if (invisible != null) {
invisible.killAndErase();
invisible = null;
}
alpha( 1f ); alpha( 1f );
break; break;
case PARALYSED: case PARALYSED: