Workshop › Angry Birds-style Slingshot › Step 13 of 47
When a body's bottom goes below the ground, we put it back on top of the ground, stop its fall and let the rough ground rub its sideways speed away.
```js
b.y += b.vy
if (b.y + b.h > GROUND) {
b.y = GROUND - b.h
b.vy = 0
b.vx *= 0.9 // the ground is rough
}
```b.y + b.h is the body's bottom edge (top plus height).b.y = GROUND - b.h puts the bottom exactly on the ground; b.vy = 0 stops the fall.b.vx *= 0.9 keeps 90% of the sideways speed each frame, so it slides to a stop.In step, under b.y += b.vy (still inside the for loop), write the if block.
Skills: Velocity and gravity, Collision detection