Resolved #10474 - Add/remove attack images on the tile, even if the attacked unit has meanwhile been killed

This commit is contained in:
Yair Morgenstern 2023-11-14 12:52:47 +02:00
parent e8b9864287
commit 870c146e34

View File

@ -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))