summaryrefslogtreecommitdiff
path: root/src/_posts
diff options
context:
space:
mode:
authorBrian Picciano <mediocregopher@gmail.com>2021-04-12 13:41:57 -0600
committerBrian Picciano <mediocregopher@gmail.com>2021-04-12 13:41:57 -0600
commit6ecd78dc625850683f8388ea9ae653838d71ae94 (patch)
treee80d16466377f8f96f215f32515041f95b7f4d73 /src/_posts
parent9556472df558f8c2b1a8151f26f0049851c5cc38 (diff)
fix reset button
Diffstat (limited to 'src/_posts')
-rw-r--r--src/_posts/2021-04-11-ripple-v2.md10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/_posts/2021-04-11-ripple-v2.md b/src/_posts/2021-04-11-ripple-v2.md
index 4f628a6..cbde032 100644
--- a/src/_posts/2021-04-11-ripple-v2.md
+++ b/src/_posts/2021-04-11-ripple-v2.md
@@ -24,7 +24,7 @@ Let it be still, and it will gradually become clear._
Your browser doesn't support canvas. At this point in the world that's actually
pretty cool, well done!
</canvas>
-<button onclick="resetGame()">(R)eset</button>
+<button onclick="reset()">(R)eset</button>
<span style="font-size: 2rem; margin-left: 1rem;">Score:
<span style="font-weight: bold" id="score">0</span>
</span>
@@ -396,10 +396,12 @@ const requestAnimationFrame =
let game = new Game(canvas, document.getElementById("score"));
+function reset() {
+ game = new Game(canvas, document.getElementById("score"));
+}
+
function nextFrame() {
- if (game.shouldReset()) {
- game = new Game(canvas, document.getElementById("score"));
- }
+ if (game.shouldReset()) reset();
game.update()
game.draw()