Workshop › Angry Birds-style Slingshot › Step 34 of 47
Every pig or block that goes away (broken or knocked off the screen) scores: 500 for a pig, 100 for a block. The bird scores nothing.
```js
let score
score = 0
// Broken or fallen off the world: gone. Every pig and block that goes scores.
bodies = bodies.filter((b) => {
if (b.hp > 0 && b.x < canvas.width + 50 && b.x + b.w > -50) return true
if (b === bird) bird = null
else score += b.kind === 'pig' ? 500 : 100
```filter reaches the lines after return true only for bodies that go.else after if (b === bird): if it is not the bird, add 500 for a pig and 100 for anything else.let dragging write let score; in reset, under state = 'aiming', write score = 0.step, update the comment above the filter and add the else score line under if (b === bird) bird = null.Skills: Game states