Workshop › Flappy-style Bird › Step 29 of 30
If the tab was in the background for 10 seconds, time - last is huge and the loop would run 600 updates at once.
We cap each deposit at 100 ms.
```js
lag += Math.min(time - last, 100)
```Math.min(a, b) is the smaller of the two numbers: at most 100 ms (6 steps) per frame.In loop, change the lag line as shown.
Skills: The game loop
← The same speed on every screen Build it yourself: a medal →