Workshop › Scorched Earth-style Artillery › Step 7 of 23

Angle and power

What we are doing

Top left shows your angle in degrees (up is positive, as people say it) and your power with one decimal.

```js
const you = tanks[0]
ctx.fillStyle = '#0f172a'
ctx.font = 'bold 14px sans-serif'
ctx.textAlign = 'left'
ctx.fillText('Angle ' + Math.round((-you.angle * 180) / Math.PI) + '°  Power ' + you.power.toFixed(1), 10, 20)
```

What it means

Your turn

At the end of draw, write the readout.

Skills: Drawing on a canvas

All steps

  1. The ground
  2. Hills
  3. Two tanks
  4. The barrel
  5. The game loop
  6. Aim
  7. Angle and power
  8. Fire!
  9. Flight
  10. Boom
  11. Craters
  12. Falling tanks
  13. Damage
  14. Taking turns
  15. The computer's shot
  16. Hitting a tank
  17. Win or lose
  18. Wind
  19. The computer aims
  20. Aim with the mouse
  21. Drag and let go
  22. The atan2 trap
  23. Build it yourself: a trail