From 5c83332552e9017c71fbc2514adb232b175ae283 Mon Sep 17 00:00:00 2001 From: nightm4re94 Date: Sun, 3 Jan 2021 18:15:09 +0100 Subject: [PATCH] Add shortcut to remove Tween instances from the TweenEngine. --- .../gurkenlabs/litiengine/tweening/TweenEngine.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/de/gurkenlabs/litiengine/tweening/TweenEngine.java b/src/de/gurkenlabs/litiengine/tweening/TweenEngine.java index d5815537b..9375aa815 100644 --- a/src/de/gurkenlabs/litiengine/tweening/TweenEngine.java +++ b/src/de/gurkenlabs/litiengine/tweening/TweenEngine.java @@ -106,6 +106,19 @@ public void start() { Game.loop().attach(this); } + /** + * Looks for a registered Tween instance with the given target and type. Attempts to remove the Tween from the TweenEngine. + * + * @param target the {@code Tweenable} target object + * @param type the {@code TweenType} determining which values of the target object will be modified. + */ + public void remove(final Tweenable target, final TweenType type) { + final Tween tween = this.getTween(target, type); + if (tween != null) { + this.getTweens().get(target).remove(type); + } + } + /** * Looks for a registered Tween instance with the given target and type. Attempts to stop the Tween. *