Workshop › Scorched Earth-style Artillery › Step 4 of 23
Each tank gets a barrel, a thick 14-pixel line from the top of the tank in the direction of its angle.
```js
ctx.strokeStyle = t.color
ctx.lineWidth = 3
ctx.beginPath()
ctx.moveTo(t.x, t.y - 8)
ctx.lineTo(t.x + Math.cos(t.angle) * 14, t.y - 8 + Math.sin(t.angle) * 14)
ctx.stroke()
```Math.cos(angle) and Math.sin(angle) give a step one pixel long in that direction; times 14, the barrel's end.beginPath, drawn with moveTo and lineTo, and shown with stroke.In the tank loop, after the body, draw the barrel.
Skills: Drawing on a canvas, Velocity and gravity