From 78a5df1684f95fdf29b7f741376b9c9c7ec6f3b3 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Fri, 12 Mar 2021 18:08:30 -0700 Subject: draw player last so ripples are always on bottom --- src/_posts/2021-03-12-ripple-a-game.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/_posts/2021-03-12-ripple-a-game.md b/src/_posts/2021-03-12-ripple-a-game.md index 6941262..16b13e7 100644 --- a/src/_posts/2021-03-12-ripple-a-game.md +++ b/src/_posts/2021-03-12-ripple-a-game.md @@ -283,10 +283,11 @@ function doTick() { } } + drops = drops.filter(drop => !drop.canGC()); + ctx.clearRect(0, 0, canvas.width, canvas.height); - player.draw() drops.forEach(drop => drop.draw()); - drops = drops.filter(drop => !drop.canGC()); + player.draw() if (gameState == 'play') currTick++; requestAnimationFrame(doTick); -- cgit v1.2.3