v0.9.1b: adjusted sprites to no longer spam onComplete when paused

This commit is contained in:
Evan Debenham
2021-01-01 19:04:52 -05:00
parent 628e8fed7d
commit d4ba5f0941
3 changed files with 5 additions and 9 deletions
@@ -76,7 +76,7 @@ public class BlacksmithSprite extends MobSprite {
super.onComplete( anim ); super.onComplete( anim );
//FIXME should figure out why onComplete is called constantly when an animation is paused //FIXME should figure out why onComplete is called constantly when an animation is paused
if (visible && emitter != null && anim == idle && !paused) { if (visible && emitter != null && anim == idle) {
emitter.burst( Speck.factory( Speck.FORGE ), 3 ); emitter.burst( Speck.factory( Speck.FORGE ), 3 );
float volume = 0.2f / (Dungeon.level.distance( ch.pos, Dungeon.hero.pos )); float volume = 0.2f / (Dungeon.level.distance( ch.pos, Dungeon.hero.pos ));
Sample.INSTANCE.play( Assets.Sounds.EVOKE, volume, volume, 0.8f ); Sample.INSTANCE.play( Assets.Sounds.EVOKE, volume, volume, 0.8f );
@@ -482,13 +482,12 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
@Override @Override
public void update() { public void update() {
if (paused && curAnim == die){
paused = false;
}
super.update(); super.update();
if (paused && listener != null) {
listener.onComplete( curAnim );
}
if (flashTime > 0 && (flashTime -= Game.elapsed) <= 0) { if (flashTime > 0 && (flashTime -= Game.elapsed) <= 0) {
resetColor(); resetColor();
} }
@@ -111,8 +111,6 @@ public class DM300Sprite extends MobSprite {
Camera.main.shake( 3, 0.7f ); Camera.main.shake( 3, 0.7f );
} }
private boolean exploded = false;
@Override @Override
public void onComplete( Animation anim ) { public void onComplete( Animation anim ) {
@@ -126,8 +124,7 @@ public class DM300Sprite extends MobSprite {
super.onComplete( anim ); super.onComplete( anim );
if (anim == die && !exploded) { if (anim == die) {
exploded = true;
Sample.INSTANCE.play(Assets.Sounds.BLAST); Sample.INSTANCE.play(Assets.Sounds.BLAST);
emitter().burst( BlastParticle.FACTORY, 100 ); emitter().burst( BlastParticle.FACTORY, 100 );
killAndErase(); killAndErase();