Workshop › Angry Birds-style Slingshot › Step 30 of 47
Soon things will break. Every material gets hit points (hp): wood 60, stone 160, and the bird Infinity, so it
never breaks. A new body starts with its material's hp.
```js
let bodies // { kind, x, y, w, h, vx, vy, hp }
wood: { color: '#b45309', density: 1, hp: 60 },
stone: { color: '#64748b', density: 2.5, hp: 160 },
bird: { color: '#dc2626', density: 4, hp: Infinity },
const body = (kind, x, y, w, h) => ({ kind, x, y, w, h, vx: 0, vy: 0, hp: MATERIALS[kind].hp })
```hp. Infinity is a number bigger than any other: no hit can bring it to 0.body looks up the material by kind and copies its hp into the new body.hp to the let bodies comment.wood, stone and bird their hp in MATERIALS.body, add hp: MATERIALS[kind].hp after vy: 0.Skills: Game states
← Smaller steps Hard hits hurt →