diff --git a/examples/syndicate-html-example-flappy-bird/index.html b/examples/syndicate-html-example-flappy-bird/index.html
index fa16fc7..12c86b1 100644
--- a/examples/syndicate-html-example-flappy-bird/index.html
+++ b/examples/syndicate-html-example-flappy-bird/index.html
@@ -3,6 +3,7 @@
+
diff --git a/examples/syndicate-html-example-flappy-bird/package.json b/examples/syndicate-html-example-flappy-bird/package.json
index 481b797..90be666 100644
--- a/examples/syndicate-html-example-flappy-bird/package.json
+++ b/examples/syndicate-html-example-flappy-bird/package.json
@@ -12,6 +12,7 @@
"author": "Tony Garnock-Jones ",
"license": "GPL-3.0+",
"dependencies": {
+ "@preserves/core": "0.995",
"@syndicate-lang/core": "*",
"@syndicate-lang/html": "*",
"@syndicate-lang/timer": "*"
diff --git a/examples/syndicate-html-example-flappy-bird/src/index.ts b/examples/syndicate-html-example-flappy-bird/src/index.ts
index 5fc778d..a5b58dd 100644
--- a/examples/syndicate-html-example-flappy-bird/src/index.ts
+++ b/examples/syndicate-html-example-flappy-bird/src/index.ts
@@ -1,7 +1,7 @@
/// SPDX-License-Identifier: GPL-3.0-or-later
/// SPDX-FileCopyrightText: Copyright © 2016-2021 Tony Garnock-Jones
-import { Record, Dataspace, Double, floatValue, Ref, stringify } from '@syndicate-lang/core';
+import { Turn, Dataspace, Double, floatValue, Ref, Facet } from '@syndicate-lang/core';
import { boot as bootHtml, WindowEvent, template, Anchor } from '@syndicate-lang/html';
import { boot as bootTimer, PeriodicTick } from '@syndicate-lang/timer';
@@ -86,9 +86,7 @@ function spawnGame(mainDs: Ref) {
on (ypos.value > BOARD_HEIGHT - FLAPPY_HEIGHT) {
ypos.value = BOARD_HEIGHT - FLAPPY_HEIGHT;
- react {
- assert GameOver();
- }
+ assert GameOver();
}
}
@@ -141,14 +139,14 @@ function spawnGame(mainDs: Ref) {
react {
const pipeNumber = nextPipe.value++;
spawn linked named ['pipe', pipeNumber] {
- runPipe(pipeNumber);
+ runPipe(pipeNumber, Turn.activeFacet);
}
}
}
}
}
- function runPipe(i: number) {
+ function runPipe(i: number, mainPipeFacet: Facet) {
const xlocation = (i + 1) * 324;
let ui = new Anchor();
@@ -159,21 +157,17 @@ function spawnGame(mainDs: Ref) {
+ PILLAR_HEAD_HEIGHT * 3;
const lowerHeight = FIELD_HEIGHT - upperHeight - PILLAR_GAP;
- stop on (xpos.value < -(PILLAR_WIDTH + FLAPPY_XPOS));
+ stop mainPipeFacet on (xpos.value < -(PILLAR_WIDTH + FLAPPY_XPOS));
at gameDs {
- react {
- stop on (xpos.value <= 0) send message IncreaseScore();
- }
+ once (xpos.value <= 0) send message IncreaseScore();
on asserted Position($flappyXpos, _) =>
xpos.value = xlocation - floatValue(flappyXpos);
on asserted Position($xpos, $ypos) => {
if (touchingPillar(floatValue(xpos), floatValue(ypos))) {
- react {
- assert GameOver();
- }
+ assert GameOver();
}
}
}
diff --git a/examples/syndicate-html-example-flappy-bird/yarn.lock b/examples/syndicate-html-example-flappy-bird/yarn.lock
index 471ca78..e2a1c9e 100644
--- a/examples/syndicate-html-example-flappy-bird/yarn.lock
+++ b/examples/syndicate-html-example-flappy-bird/yarn.lock
@@ -7,6 +7,11 @@
resolved "https://registry.yarnpkg.com/@preserves/core/-/core-0.990.0.tgz#c57c1c3d5159fc17477a4205d5a94a78fbf5b1aa"
integrity sha512-Mx013USv9JU1SrtMxaJISETBy2LZ402xH8ZnQI4JzG6W27ZwGV36DQrXAfF0x6cOmZMGKwJNqQrvmFhh7mEn6w==
+"@preserves/core@0.995":
+ version "0.995.0"
+ resolved "https://registry.yarnpkg.com/@preserves/core/-/core-0.995.0.tgz#d6badccd1fe56e45f23e01b4c8a33f421749e76b"
+ integrity sha512-0ICNcZ7HkBal1OJwoUuc1+KqoTQNJl2kYI3/nMtfrtNMem908unpydLo20k44Fgh/SRJekWaiRYSzKTcOo0+Tg==
+
"@preserves/schema@0.990.1":
version "0.990.1"
resolved "https://registry.yarnpkg.com/@preserves/schema/-/schema-0.990.1.tgz#233e25855194ce0f6ffaa9968d59e50b7dc8635a"