Workshop › Angry Birds-style Slingshot › Step 29 of 47
A fast bird can move more than a thin plank's width in one frame and pass right through it. So each frame is split
into SUB = 4 smaller physics steps, each with a quarter of the gravity and the movement.
```js
const SUB = 4 // physics steps per frame
b.vy += GRAVITY / SUB
b.x += b.vx / SUB
b.y += b.vy / SUB
function update() {
for (let i = 0; i < SUB; i++) step()
```step now applies a quarter of the gravity and moves a quarter of the velocity.update runs it SUB times per frame, so in one frame bodies move as far as before, in four small hops.BIRD write const SUB = 4.step, divide the three lines by SUB.update, replace step() with the for line.Skills: Velocity and gravity, The game loop