reload page after 10 actions 🤣
This commit is contained in:
parent
056f708b62
commit
b6d5c3e927
1 changed files with 12 additions and 0 deletions
12
index.js
12
index.js
|
@ -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() {
|
||||||
|
|
Loading…
Reference in a new issue