v0.2.3d: hopefully fixed bug where attack indicator would sometimes not be pressable

This commit is contained in:
Evan Debenham 2015-01-15 02:39:44 -05:00
parent 6cbb50a179
commit 61f296907f

View File

@ -33,7 +33,7 @@ public class AttackIndicator extends Tag {
private static final float ENABLED = 1.0f;
private static final float DISABLED = 0.3f;
private static float delay = 0.5f;
private static float delay = 0.75f;
private static AttackIndicator instance;
@ -72,13 +72,13 @@ public class AttackIndicator extends Tag {
public void update() {
super.update();
if (lastTarget == null){
if (!bg.visible){
enable(false);
if (delay > 0f) delay -= Game.elapsed;
if (delay <= 0f) active = false;
} else {
delay = 0.5f;
delay = 0.75f;
active = true;
}
if (Dungeon.hero.isAlive()) {
@ -89,6 +89,7 @@ public class AttackIndicator extends Tag {
enable( false );
}
}
}
private void checkEnemies() {
@ -106,12 +107,14 @@ public class AttackIndicator extends Tag {
if (candidates.isEmpty()) {
lastTarget = null;
} else {
active = true;
lastTarget = Random.element( candidates );
updateImage();
flash();
}
} else {
if (!bg.visible) {
active = true;
flash();
}
}
@ -159,7 +162,7 @@ public class AttackIndicator extends Tag {
@Override
protected void onClick() {
if (enabled && lastTarget != null) {
if (enabled) {
Dungeon.hero.handle( lastTarget.pos );
}
}