v0.4.2: fixed some bugs with evil eyes
This commit is contained in:
parent
293925b27e
commit
6bbc7a1ed2
|
@ -81,9 +81,10 @@ public class Eye extends Mob {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Ballistica beam;
|
private Ballistica beam;
|
||||||
|
private int beamTarget = -1;
|
||||||
private int beamCooldown;
|
private int beamCooldown;
|
||||||
public boolean beamCharged;
|
public boolean beamCharged;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean canAttack( Char enemy ) {
|
protected boolean canAttack( Char enemy ) {
|
||||||
|
|
||||||
|
@ -92,6 +93,7 @@ public class Eye extends Mob {
|
||||||
|
|
||||||
if (enemy.invisible == 0 && Level.fieldOfView[enemy.pos] && aim.subPath(1, aim.dist).contains(enemy.pos)){
|
if (enemy.invisible == 0 && Level.fieldOfView[enemy.pos] && aim.subPath(1, aim.dist).contains(enemy.pos)){
|
||||||
beam = aim;
|
beam = aim;
|
||||||
|
beamTarget = aim.collisionPos;
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
//if the beam is charged, it has to attack, will aim at previous location of hero.
|
//if the beam is charged, it has to attack, will aim at previous location of hero.
|
||||||
|
@ -102,6 +104,10 @@ public class Eye extends Mob {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean act() {
|
protected boolean act() {
|
||||||
|
if (beam == null && beamTarget != -1) {
|
||||||
|
beam = new Ballistica(pos, beamTarget, Ballistica.STOP_TERRAIN);
|
||||||
|
sprite.turnTo(pos, beamTarget);
|
||||||
|
}
|
||||||
if (beamCooldown > 0)
|
if (beamCooldown > 0)
|
||||||
beamCooldown--;
|
beamCooldown--;
|
||||||
return super.act();
|
return super.act();
|
||||||
|
@ -190,6 +196,7 @@ public class Eye extends Mob {
|
||||||
}
|
}
|
||||||
|
|
||||||
beam = null;
|
beam = null;
|
||||||
|
beamTarget = -1;
|
||||||
sprite.idle();
|
sprite.idle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,8 +207,7 @@ public class Eye extends Mob {
|
||||||
@Override
|
@Override
|
||||||
public void storeInBundle(Bundle bundle) {
|
public void storeInBundle(Bundle bundle) {
|
||||||
super.storeInBundle(bundle);
|
super.storeInBundle(bundle);
|
||||||
if (beam != null)
|
bundle.put( BEAM_TARGET, beamTarget);
|
||||||
bundle.put( BEAM_TARGET, beam.collisionPos);
|
|
||||||
bundle.put( BEAM_COOLDOWN, beamCooldown );
|
bundle.put( BEAM_COOLDOWN, beamCooldown );
|
||||||
bundle.put( BEAM_CHARGED, beamCharged );
|
bundle.put( BEAM_CHARGED, beamCharged );
|
||||||
}
|
}
|
||||||
|
@ -210,7 +216,7 @@ public class Eye extends Mob {
|
||||||
public void restoreFromBundle(Bundle bundle) {
|
public void restoreFromBundle(Bundle bundle) {
|
||||||
super.restoreFromBundle(bundle);
|
super.restoreFromBundle(bundle);
|
||||||
if (bundle.contains(BEAM_TARGET))
|
if (bundle.contains(BEAM_TARGET))
|
||||||
beam = new Ballistica(pos, bundle.getInt(BEAM_TARGET), Ballistica.STOP_TERRAIN);
|
beamTarget = bundle.getInt(BEAM_TARGET);
|
||||||
beamCooldown = bundle.getInt(BEAM_COOLDOWN);
|
beamCooldown = bundle.getInt(BEAM_COOLDOWN);
|
||||||
beamCharged = bundle.getBoolean(BEAM_CHARGED);
|
beamCharged = bundle.getBoolean(BEAM_CHARGED);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user