v0.8.0: corrected various rare errors with evil eye sprites

This commit is contained in:
Evan Debenham 2019-11-23 01:52:28 -05:00
parent 2138ad24ec
commit 9e65b4b634

View File

@ -51,11 +51,6 @@ public class EyeSprite extends MobSprite {
charging = new Animation( 12, true); charging = new Animation( 12, true);
charging.frames( frames, 3, 4 ); charging.frames( frames, 3, 4 );
chargeParticles = centerEmitter();
chargeParticles.autoKill = false;
chargeParticles.pour(MagicMissile.MagicParticle.ATTRACTING, 0.05f);
chargeParticles.on = false;
run = new Animation( 12, true ); run = new Animation( 12, true );
run.frames( frames, 5, 6 ); run.frames( frames, 5, 6 );
@ -72,15 +67,39 @@ public class EyeSprite extends MobSprite {
@Override @Override
public void link(Char ch) { public void link(Char ch) {
super.link(ch); super.link(ch);
chargeParticles = centerEmitter();
chargeParticles.autoKill = false;
chargeParticles.pour(MagicMissile.MagicParticle.ATTRACTING, 0.05f);
chargeParticles.on = false;
if (((Eye)ch).beamCharged) play(charging); if (((Eye)ch).beamCharged) play(charging);
} }
@Override @Override
public void update() { public void update() {
super.update(); super.update();
chargeParticles.pos(center()); if (chargeParticles != null){
chargeParticles.pos( center() );
chargeParticles.visible = visible; chargeParticles.visible = visible;
} }
}
@Override
public void die() {
super.die();
if (chargeParticles != null){
chargeParticles.on = false;
}
}
@Override
public void kill() {
super.kill();
if (chargeParticles != null){
chargeParticles.killAndErase();
}
}
public void charge( int pos ){ public void charge( int pos ){
turnTo(ch.pos, pos); turnTo(ch.pos, pos);
@ -89,7 +108,7 @@ public class EyeSprite extends MobSprite {
@Override @Override
public void play(Animation anim) { public void play(Animation anim) {
chargeParticles.on = anim == charging; if (chargeParticles != null) chargeParticles.on = anim == charging;
super.play(anim); super.play(anim);
} }