From c0674257837d3f1de9253c439ba7f8e53c97c2ae Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 31 May 2021 22:05:34 -0400 Subject: [PATCH] v0.9.3: adjusted attack indicator to do less on the actor thread --- .../shatteredpixeldungeon/ui/AttackIndicator.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/AttackIndicator.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/AttackIndicator.java index 7df19c616..da5d33868 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/AttackIndicator.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/AttackIndicator.java @@ -80,11 +80,17 @@ public class AttackIndicator extends Tag { PixelScene.align(sprite); } } + + private boolean needsImageUpdate = false; @Override public synchronized void update() { super.update(); + if (needsImageUpdate){ + updateImage(); + } + if (!bg.visible){ enable(false); if (delay > 0f) delay -= Game.elapsed; @@ -121,7 +127,7 @@ public class AttackIndicator extends Tag { } else { active = true; lastTarget = Random.element( candidates ); - updateImage(); + needsImageUpdate = true; flash(); } } else { @@ -182,7 +188,7 @@ public class AttackIndicator extends Tag { public static void target( Char target ) { synchronized (instance) { instance.lastTarget = (Mob) target; - instance.updateImage(); + instance.needsImageUpdate = true; TargetHealthIndicator.instance.target(target); }