From 870c146e349887b3cebd472a0cb4b366a3f3e1c2 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Tue, 14 Nov 2023 12:52:47 +0200 Subject: [PATCH] Resolved #10474 - Add/remove attack images on the tile, even if the attacked unit has meanwhile been killed --- .../ui/screens/worldscreen/bottombar/BattleTableHelpers.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/ui/screens/worldscreen/bottombar/BattleTableHelpers.kt b/core/src/com/unciv/ui/screens/worldscreen/bottombar/BattleTableHelpers.kt index 21ccfe2c7c..d51ae55ddb 100644 --- a/core/src/com/unciv/ui/screens/worldscreen/bottombar/BattleTableHelpers.kt +++ b/core/src/com/unciv/ui/screens/worldscreen/bottombar/BattleTableHelpers.kt @@ -9,7 +9,6 @@ import com.badlogic.gdx.scenes.scene2d.Touchable import com.badlogic.gdx.scenes.scene2d.actions.Actions import com.badlogic.gdx.scenes.scene2d.actions.FloatAction import com.badlogic.gdx.scenes.scene2d.actions.RelativeTemporalAction -import com.badlogic.gdx.scenes.scene2d.actions.RepeatAction import com.badlogic.gdx.scenes.scene2d.actions.SequenceAction import com.badlogic.gdx.scenes.scene2d.actions.TemporalAction import com.badlogic.gdx.scenes.scene2d.ui.Image @@ -85,8 +84,10 @@ object BattleTableHelpers { var i = 1 while (ImageGetter.imageExists(attackAnimationLocation + i)) { val image = ImageGetter.getImage(attackAnimationLocation + i) + + val defenderParentGroup = defenderActors.first().parent addAction(Actions.run { - defenderActors.first().parent.addActor(image) + defenderParentGroup.addActor(image) }) addAction(Actions.delay(attackAnimationFrameDuration)) addAction(Actions.removeActor(image))