diff options
author | Brian Picciano <mediocregopher@gmail.com> | 2021-03-12 18:08:30 -0700 |
---|---|---|
committer | Brian Picciano <mediocregopher@gmail.com> | 2021-03-12 18:08:30 -0700 |
commit | 78a5df1684f95fdf29b7f741376b9c9c7ec6f3b3 (patch) | |
tree | 95cc42b4abe12a56290b3b1088ced86a4934cf6d /src | |
parent | 481d14784d4497df6ce2a13d6f2aa9ade3953799 (diff) |
draw player last so ripples are always on bottom
Diffstat (limited to 'src')
-rw-r--r-- | src/_posts/2021-03-12-ripple-a-game.md | 5 |
1 files changed, 3 insertions, 2 deletions
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); |