Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

10.6 KB
Raw Blame
{
  "version": "1.0",
  "name": "Block",
  "variables": [
    {
      "name": "y",
      "type": "number",
      "default": 360
    }
  ],
  "nodes": [
    {
      "id": "start",
      "kind": "event.start",
      "x": 0,
      "y": 60
    },
    {
      "id": "seed",
      "kind": "call",
      "ref": "property.get",
      "literals": {
        "path": "Transform.position.y"
      },
      "x": 34,
      "y": 250
    },
    {
      "id": "seedSet",
      "kind": "var.set",
      "literals": {
        "name": "y"
      },
      "x": 250,
      "y": 60
    },
    {
      "id": "upd",
      "kind": "event.update",
      "x": 0,
      "y": 960
    },
    {
      "id": "step",
      "kind": "call",
      "ref": "math.multiply",
      "literals": {
        "a": -320
      },
      "x": 68,
      "y": 1340
    },
    {
      "id": "getY",
      "kind": "var.get",
      "literals": {
        "name": "y"
      },
      "x": 68,
      "y": 1530
    },
    {
      "id": "nextY",
      "kind": "call",
      "ref": "math.add",
      "x": 284,
      "y": 1150
    },
    {
      "id": "setY",
      "kind": "var.set",
      "literals": {
        "name": "y"
      },
      "x": 500,
      "y": 960
    },
    {
      "id": "writeY",
      "kind": "call",
      "ref": "property.set",
      "literals": {
        "path": "Transform.position.y"
      },
      "x": 750,
      "y": 960
    },
    {
      "id": "gone",
      "kind": "call",
      "ref": "compare.less",
      "literals": {
        "b": -340
      },
      "x": 784,
      "y": 1150
    },
    {
      "id": "off",
      "kind": "flow.branch",
      "x": 1000,
      "y": 960
    },
    {
      "id": "game",
      "kind": "call",
      "ref": "entity.byName",
      "literals": {
        "name": "Game"
      },
      "x": -216,
      "y": 250
    },
    {
      "id": "score",
      "kind": "call",
      "ref": "property.get",
      "literals": {
        "path": "GameState.score"
      },
      "x": 818,
      "y": 1340
    },
    {
      "id": "plus",
      "kind": "call",
      "ref": "math.add",
      "literals": {
        "b": 1
      },
      "x": 1034,
      "y": 1150
    },
    {
      "id": "bump",
      "kind": "call",
      "ref": "property.set",
      "literals": {
        "path": "GameState.score"
      },
      "x": 1250,
      "y": 960
    },
    {
      "id": "die",
      "kind": "call",
      "ref": "entity.despawn",
      "x": 1500,
      "y": 960
    },
    {
      "id": "hit",
      "kind": "flow.branch",
      "x": 1250,
      "y": 960
    },
    {
      "id": "player",
      "kind": "call",
      "ref": "entity.byName",
      "literals": {
        "name": "Player"
      },
      "x": -216,
      "y": 440
    },
    {
      "id": "px",
      "kind": "call",
      "ref": "property.get",
      "literals": {
        "path": "Transform.position.x"
      },
      "x": -216,
      "y": 630
    },
    {
      "id": "py",
      "kind": "call",
      "ref": "property.get",
      "literals": {
        "path": "Transform.position.y"
      },
      "x": -216,
      "y": 820
    },
    {
      "id": "myx",
      "kind": "call",
      "ref": "property.get",
      "literals": {
        "path": "Transform.position.x"
      },
      "x": -216,
      "y": 1010
    },
    {
      "id": "dx",
      "kind": "call",
      "ref": "math.subtract",
      "x": -216,
      "y": 1200
    },
    {
      "id": "dy",
      "kind": "call",
      "ref": "math.subtract",
      "x": -216,
      "y": 1390
    },
    {
      "id": "adx",
      "kind": "call",
      "ref": "math.abs",
      "x": -216,
      "y": 1580
    },
    {
      "id": "ady",
      "kind": "call",
      "ref": "math.abs",
      "x": -216,
      "y": 1770
    },
    {
      "id": "nearX",
      "kind": "call",
      "ref": "compare.less",
      "literals": {
        "b": 62
      },
      "x": 818,
      "y": 1530
    },
    {
      "id": "nearY",
      "kind": "call",
      "ref": "compare.less",
      "literals": {
        "b": 62
      },
      "x": 818,
      "y": 1720
    },
    {
      "id": "both",
      "kind": "call",
      "ref": "logic.and",
      "x": 1034,
      "y": 1340
    },
    {
      "id": "out",
      "kind": "call",
      "ref": "property.set",
      "literals": {
        "path": "GameState.alive",
        "value": "false"
      },
      "x": 1500,
      "y": 960
    },
    {
      "id": "getY_1",
      "kind": "var.get",
      "literals": {
        "name": "y"
      },
      "x": 534,
      "y": 1150
    },
    {
      "id": "getY_2",
      "kind": "var.get",
      "literals": {
        "name": "y"
      },
      "x": 568,
      "y": 1340
    },
    {
      "id": "getY_3",
      "kind": "var.get",
      "literals": {
        "name": "y"
      },
      "x": -432,
      "y": 1580
    },
    {
      "id": "game_1",
      "kind": "call",
      "ref": "entity.byName",
      "literals": {
        "name": "Game"
      },
      "x": 1034,
      "y": 1720
    },
    {
      "id": "game_2",
      "kind": "call",
      "ref": "entity.byName",
      "literals": {
        "name": "Game"
      },
      "x": 1284,
      "y": 1150
    },
    {
      "id": "player_1",
      "kind": "call",
      "ref": "entity.byName",
      "literals": {
        "name": "Player"
      },
      "x": -432,
      "y": 1010
    },
    {
      "id": "live",
      "kind": "flow.branch",
      "x": 250,
      "y": 960
    },
    {
      "id": "askAlive",
      "kind": "graph.call",
      "literals": {
        "graph": "assets/logic/alive.esgraph"
      },
      "x": -250,
      "y": 60
    }
  ],
  "edges": [
    {
      "id": "start.then->seedSet.",
      "from": "start",
      "fromPort": "then",
      "to": "seedSet",
      "toPort": ""
    },
    {
      "id": "seed.value->seedSet.value",
      "from": "seed",
      "fromPort": "value",
      "to": "seedSet",
      "toPort": "value"
    },
    {
      "id": "upd.dt->step.b",
      "from": "upd",
      "fromPort": "dt",
      "to": "step",
      "toPort": "b"
    },
    {
      "id": "getY.value->nextY.a",
      "from": "getY",
      "fromPort": "value",
      "to": "nextY",
      "toPort": "a"
    },
    {
      "id": "step.result->nextY.b",
      "from": "step",
      "fromPort": "result",
      "to": "nextY",
      "toPort": "b"
    },
    {
      "id": "nextY.result->setY.value",
      "from": "nextY",
      "fromPort": "result",
      "to": "setY",
      "toPort": "value"
    },
    {
      "id": "setY.then->writeY.",
      "from": "setY",
      "fromPort": "then",
      "to": "writeY",
      "toPort": ""
    },
    {
      "id": "getY_1.value->writeY.value",
      "from": "getY_1",
      "fromPort": "value",
      "to": "writeY",
      "toPort": "value"
    },
    {
      "id": "writeY.then->off.",
      "from": "writeY",
      "fromPort": "then",
      "to": "off",
      "toPort": ""
    },
    {
      "id": "getY_2.value->gone.a",
      "from": "getY_2",
      "fromPort": "value",
      "to": "gone",
      "toPort": "a"
    },
    {
      "id": "gone.result->off.cond",
      "from": "gone",
      "fromPort": "result",
      "to": "off",
      "toPort": "cond"
    },
    {
      "id": "off.true->bump.",
      "from": "off",
      "fromPort": "true",
      "to": "bump",
      "toPort": ""
    },
    {
      "id": "game.entity->score.entity",
      "from": "game",
      "fromPort": "entity",
      "to": "score",
      "toPort": "entity"
    },
    {
      "id": "score.value->plus.a",
      "from": "score",
      "fromPort": "value",
      "to": "plus",
      "toPort": "a"
    },
    {
      "id": "plus.result->bump.value",
      "from": "plus",
      "fromPort": "result",
      "to": "bump",
      "toPort": "value"
    },
    {
      "id": "game_1.entity->bump.entity",
      "from": "game_1",
      "fromPort": "entity",
      "to": "bump",
      "toPort": "entity"
    },
    {
      "id": "bump.then->die.",
      "from": "bump",
      "fromPort": "then",
      "to": "die",
      "toPort": ""
    },
    {
      "id": "off.false->hit.",
      "from": "off",
      "fromPort": "false",
      "to": "hit",
      "toPort": ""
    },
    {
      "id": "player.entity->px.entity",
      "from": "player",
      "fromPort": "entity",
      "to": "px",
      "toPort": "entity"
    },
    {
      "id": "player_1.entity->py.entity",
      "from": "player_1",
      "fromPort": "entity",
      "to": "py",
      "toPort": "entity"
    },
    {
      "id": "myx.value->dx.a",
      "from": "myx",
      "fromPort": "value",
      "to": "dx",
      "toPort": "a"
    },
    {
      "id": "px.value->dx.b",
      "from": "px",
      "fromPort": "value",
      "to": "dx",
      "toPort": "b"
    },
    {
      "id": "getY_3.value->dy.a",
      "from": "getY_3",
      "fromPort": "value",
      "to": "dy",
      "toPort": "a"
    },
    {
      "id": "py.value->dy.b",
      "from": "py",
      "fromPort": "value",
      "to": "dy",
      "toPort": "b"
    },
    {
      "id": "dx.result->adx.a",
      "from": "dx",
      "fromPort": "result",
      "to": "adx",
      "toPort": "a"
    },
    {
      "id": "dy.result->ady.a",
      "from": "dy",
      "fromPort": "result",
      "to": "ady",
      "toPort": "a"
    },
    {
      "id": "adx.result->nearX.a",
      "from": "adx",
      "fromPort": "result",
      "to": "nearX",
      "toPort": "a"
    },
    {
      "id": "ady.result->nearY.a",
      "from": "ady",
      "fromPort": "result",
      "to": "nearY",
      "toPort": "a"
    },
    {
      "id": "nearX.result->both.a",
      "from": "nearX",
      "fromPort": "result",
      "to": "both",
      "toPort": "a"
    },
    {
      "id": "nearY.result->both.b",
      "from": "nearY",
      "fromPort": "result",
      "to": "both",
      "toPort": "b"
    },
    {
      "id": "both.result->hit.cond",
      "from": "both",
      "fromPort": "result",
      "to": "hit",
      "toPort": "cond"
    },
    {
      "id": "hit.true->out.",
      "from": "hit",
      "fromPort": "true",
      "to": "out",
      "toPort": ""
    },
    {
      "id": "game_2.entity->out.entity",
      "from": "game_2",
      "fromPort": "entity",
      "to": "out",
      "toPort": "entity"
    },
    {
      "id": "live.true->setY.",
      "from": "live",
      "fromPort": "true",
      "to": "setY",
      "toPort": ""
    },
    {
      "id": "live.false->die.",
      "from": "live",
      "fromPort": "false",
      "to": "die",
      "toPort": ""
    },
    {
      "id": "upd.then->askAlive",
      "from": "upd",
      "fromPort": "then",
      "to": "askAlive",
      "toPort": ""
    },
    {
      "id": "askAlive.then->gate",
      "from": "askAlive",
      "fromPort": "then",
      "to": "live",
      "toPort": ""
    },
    {
      "id": "askAlive.alive->cond",
      "from": "askAlive",
      "fromPort": "alive",
      "to": "live",
      "toPort": "cond"
    }
  ]
}