Guard obstacle drawing behind flag

This commit is contained in:
Mattéo Delabre 2020-05-08 18:00:56 +02:00
parent cc3a719542
commit 639c56333e
Signed by: matteo
GPG Key ID: AE3FBD02DC583ABB
2 changed files with 12 additions and 8 deletions

View File

@ -64,6 +64,7 @@ class Boids
radius: 10,
color: 'black',
debug: false,
}, params);
// Current width and height of the canvas
@ -277,6 +278,8 @@ class Boids
);
// Draw obstacles
if (this.params.debug)
{
this.ctx.fillStyle = '#dddddd';
this.ctx.beginPath();
@ -286,6 +289,7 @@ class Boids
}
this.ctx.fill();
}
// Draw boids
this.ctx.fillStyle = this.params.color;

View File

@ -32,7 +32,7 @@
new Rectangle(-400, -200, 200, 150),
new Circle(200, 200, 100),
new Circle(300, 200, 100),
]);
], {debug: true});
canvas.onclick = ev =>
{