-
-
Save libindev/c6ecb01b4196eee145fe143d661cfff4 to your computer and use it in GitHub Desktop.
[LibGDX] Remove actor from parent after animation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Group group; | |
Actor actor; | |
// ... | |
group.addActor(actor); | |
// ... | |
// Remove target actor after animation has been finished | |
actor.addAction(Actions.sequence( | |
Actions.moveTo(x, y, 0.5f), | |
Actions.removeActor() | |
)); | |
// Clear group after animation has been finished | |
actor.addAction(Actions.sequence( | |
Actions.moveTo(x, y, 0.5f), | |
Actions.run(new Runnable() { | |
@Override | |
public void run() { | |
group.clear(); | |
// Or even better | |
//actor.getParent().clear(); | |
} | |
}) | |
)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment