summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/rustanddust/game/hud/UnitDock.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/hud/UnitDock.java b/core/src/ch/asynk/rustanddust/game/hud/UnitDock.java
index b3594dc..d9acb8d 100644
--- a/core/src/ch/asynk/rustanddust/game/hud/UnitDock.java
+++ b/core/src/ch/asynk/rustanddust/game/hud/UnitDock.java
@@ -214,12 +214,15 @@ public class UnitDock extends Bg implements Animation
{
if (!visible) return;
- if ((rect.y + this.dy + rect.height) < y) {
- this.dy += BOUNCE_SPEED;
- compute();
- } else if (scaledRect.y > SCISSORS_BOTTOM) {
- this.dy -= BOUNCE_SPEED;
- compute();
+ float top = scaledRect.y + scaledRect.height;
+ if (top != y) {
+ if (top < y) {
+ this.dy += Math.min(BOUNCE_SPEED, (y - top));
+ compute();
+ } else if (scaledRect.y > SCISSORS_BOTTOM) {
+ this.dy -= Math.min(BOUNCE_SPEED, (scaledRect.y - SCISSORS_BOTTOM));
+ compute();
+ }
}
saved.set(batch.getTransformMatrix());