keep stats
This commit is contained in:
parent
51848cab3d
commit
d44076b32c
1 changed files with 4 additions and 0 deletions
|
@ -12,6 +12,7 @@ export function IslandApplet() {
|
||||||
// STATE
|
// STATE
|
||||||
|
|
||||||
let timerId: number;
|
let timerId: number;
|
||||||
|
let ticks = 0;
|
||||||
let islands = new IslandGrid(WIDTH, HEIGHT, DEFAULT_SEED);
|
let islands = new IslandGrid(WIDTH, HEIGHT, DEFAULT_SEED);
|
||||||
|
|
||||||
// UI
|
// UI
|
||||||
|
@ -30,12 +31,15 @@ export function IslandApplet() {
|
||||||
onclick: () => {
|
onclick: () => {
|
||||||
clearInterval(timerId);
|
clearInterval(timerId);
|
||||||
|
|
||||||
|
ticks = 0;
|
||||||
islands = new IslandGrid(WIDTH, HEIGHT, seedInput.valueAsNumber);
|
islands = new IslandGrid(WIDTH, HEIGHT, seedInput.valueAsNumber);
|
||||||
|
|
||||||
timerId = setInterval(function tick() {
|
timerId = setInterval(function tick() {
|
||||||
islands.step();
|
islands.step();
|
||||||
islands.step();
|
islands.step();
|
||||||
islands.step();
|
islands.step();
|
||||||
|
|
||||||
|
ticks += 3;
|
||||||
if (islands.done) {
|
if (islands.done) {
|
||||||
clearInterval(timerId);
|
clearInterval(timerId);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue