From b6d5c3e9271a13ab6337c25c3a29d1b82632fc61 Mon Sep 17 00:00:00 2001 From: Ayo Date: Sat, 4 Feb 2023 09:59:40 +0100 Subject: [PATCH] =?UTF-8?q?reload=20page=20after=2010=20actions=20?= =?UTF-8?q?=F0=9F=A4=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/index.js b/index.js index 527e00c..373b5a7 100644 --- a/index.js +++ b/index.js @@ -26,10 +26,14 @@ let render = Render.create({ }); generateWorld(); +let actions = 0; function clearTheWorld() { Composite.clear(engine.world); Composite.add(engine.world, ground); + if (actions > 10) { + location.reload(); + } } function kaboom() { @@ -49,6 +53,10 @@ function kaboom() { // run the engine Runner.run(runner, engine); + actions++; + if (actions > 10) { + location.reload(); + } } function addShape() { @@ -64,6 +72,10 @@ function addShape() { // run the engine Runner.run(runner, engine); + actions++; + if (actions > 10) { + location.reload(); + } } function generateWorld() {