Smoother bridge animation start/stop

This commit is contained in:
Anuken 2021-07-29 11:26:01 -04:00
parent a36f872b61
commit 296f9b9da5

View File

@ -178,7 +178,7 @@ public class ItemBridge extends Block{
public int link = -1;
public IntSeq incoming = new IntSeq(false, 4);
public float warmup;
public float time;
public float time, timeSpeed;
public boolean wasMoved, moved;
public float transportCounter;
@ -295,7 +295,10 @@ public class ItemBridge extends Block{
moved = false;
}
time += wasMoved ? delta() : 0f;
//smooth out animation, so it doesn't stop/start immediately
timeSpeed = Mathf.approachDelta(timeSpeed, wasMoved ? 1f : 0f, 1f / 60f);
time += timeSpeed * delta();
checkIncoming();