reload page after 10 actions 🤣

This commit is contained in:
Ayo 2023-02-04 09:59:40 +01:00
parent 056f708b62
commit b6d5c3e927

View file

@ -26,10 +26,14 @@ let render = Render.create({
}); });
generateWorld(); generateWorld();
let actions = 0;
function clearTheWorld() { function clearTheWorld() {
Composite.clear(engine.world); Composite.clear(engine.world);
Composite.add(engine.world, ground); Composite.add(engine.world, ground);
if (actions > 10) {
location.reload();
}
} }
function kaboom() { function kaboom() {
@ -49,6 +53,10 @@ function kaboom() {
// run the engine // run the engine
Runner.run(runner, engine); Runner.run(runner, engine);
actions++;
if (actions > 10) {
location.reload();
}
} }
function addShape() { function addShape() {
@ -64,6 +72,10 @@ function addShape() {
// run the engine // run the engine
Runner.run(runner, engine); Runner.run(runner, engine);
actions++;
if (actions > 10) {
location.reload();
}
} }
function generateWorld() { function generateWorld() {