Workshop › Angry Birds-style Slingshot › Step 38 of 47

Count the birds

What we are doing

The top line shows how many birds are left, and with none left the sling is drawn empty.

```js
if (state === 'aiming' && birdsLeft > 0) {

ctx.fillText('Birds ' + birdsLeft + '  Score ' + score, 10, 22)
```

What it means

Your turn

In draw, add && birdsLeft > 0 to the aiming if, and change the score text as shown.

Skills: Drawing on a canvas

All steps

  1. The sling
  2. Sky and ground
  3. Draw it again and again
  4. The aim: an angle and a pull
  5. A bird in the sling
  6. Pull the bird back
  7. The rubber band
  8. Aim with the arrow keys
  9. Bodies
  10. Launch!
  11. Move by the velocity
  12. Gravity
  13. Land on the ground
  14. Aiming or flying
  15. An empty sling in flight
  16. Gone off the screen
  17. Wait for calm
  18. The next bird
  19. See the path before you shoot
  20. From a point to an aim
  21. Grab the sling
  22. Drag and let go
  23. Wood and stone
  24. A level as data
  25. Push overlapping boxes apart
  26. Bounce by mass
  27. Every pair meets
  28. Friction
  29. Smaller steps
  30. Hit points
  31. Hard hits hurt
  32. Things break
  33. Pigs
  34. Score
  35. Show the score
  36. Cracks
  37. Three birds
  38. Count the birds
  39. Won or lost
  40. The end panel
  41. Play again
  42. Three levels of data
  43. Start any level
  44. On to the next level
  45. The best score
  46. The right words
  47. Build it yourself: the yellow bird