I have a castle but I don't know how I fill inside that area(castle) by a particular color. I tried fillstyle but it didn't work maybe I'm not doing right or maybe it needs other thing that I'm not using.
If you need something else, please don't hesitate in ask. I put the snippet to help you guys understand the problem.

```js
function main() {
  var c2d = document.getElementById("acanvas").getContext("2d");
  c2d.fillStyle = "blue";
  castelo(c2d);
}

function castelo(c2d) { //30 para o lado de baixo
  //40 para o lado de cima
  //20 para baixo
  c2d.fillStyle = "red";
  c2d.beginPath();
  c2d.strokeStyle = 'blue';
  c2d.moveTo(20, 20);
  c2d.lineTo(50, 20);
  c2d.stroke();
  c2d.moveTo(50, 20);
  c2d.lineTo(50, 40);
  c2d.stroke();
  c2d.moveTo(50, 40);
  c2d.lineTo(80, 40);
  c2d.stroke();
  c2d.moveTo(80, 40);
  c2d.lineTo(80, 20);
  c2d.stroke();
  c2d.moveTo(80, 20);
  c2d.lineTo(120, 20);
  c2d.stroke();
  c2d.moveTo(120, 20);
  c2d.lineTo(120, 40);
  c2d.stroke();
  c2d.moveTo(120, 40);
  c2d.lineTo(150, 40);
  c2d.stroke();
  c2d.moveTo(150, 40);
  c2d.lineTo(150, 20);
  c2d.stroke();
  c2d.moveTo(150, 20);
  c2d.lineTo(190, 20);
  c2d.stroke();
  c2d.moveTo(190, 20);
  c2d.lineTo(190, 40);
  c2d.stroke();
  c2d.moveTo(190, 40);
  c2d.lineTo(220, 40);
  c2d.stroke();
  c2d.moveTo(220, 40);
  c2d.lineTo(220, 20);
  c2d.stroke();
  c2d.moveTo(220, 20);
  c2d.lineTo(260, 20);
  c2d.stroke();
  c2d.moveTo(260, 20);
  c2d.lineTo(260, 40);
  c2d.stroke();
  c2d.moveTo(260, 40);
  c2d.lineTo(290, 40);
  c2d.stroke();
  c2d.moveTo(290, 40);
  c2d.lineTo(290, 20);
  c2d.stroke();
  c2d.moveTo(290, 20);
  c2d.lineTo(320, 20);
  c2d.stroke();
  c2d.moveTo(320, 20); //final do castelo em cima
  c2d.lineTo(320, 500);
  c2d.stroke();
  c2d.moveTo(320, 500);
  c2d.lineTo(170, 300);
  c2d.stroke();
  c2d.moveTo(170, 300);
  c2d.lineTo(20, 500);
  c2d.stroke();
  c2d.moveTo(20, 500);
  c2d.lineTo(20, 20);
  c2d.stroke();
  c2d.closePath();
}
```

```html
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <script src="capadolivro.js">
  </script>
</head>

<body onload="main();">
  <canvas id="acanvas" width="1366" height="768" />
</body>

</html>
```