UNPKG

seed-engine

Version:

A Lightweight 2D game engine using WebGL2. The engine is designed on the focus of creating a bridge between creating and publishing games to the Seed Network as modules.

1,359 lines (1,358 loc) 230 kB
{ "type": "File", "start": 0, "end": 1253, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 46, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 1253, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 46, "column": 1 } }, "sourceType": "module", "body": [ { "type": "ExportDefaultDeclaration", "start": 379, "end": 1253, "loc": { "start": { "line": 10, "column": 0 }, "end": { "line": 46, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 394, "end": 1253, "loc": { "start": { "line": 10, "column": 15 }, "end": { "line": 46, "column": 1 } }, "id": { "type": "Identifier", "start": 400, "end": 409, "loc": { "start": { "line": 10, "column": 21 }, "end": { "line": 10, "column": 30 }, "identifierName": "PostBoard" }, "name": "PostBoard", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 410, "end": 1253, "loc": { "start": { "line": 10, "column": 31 }, "end": { "line": 46, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 416, "end": 518, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 15, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 416, "end": 427, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 11, "column": 15 }, "identifierName": "constructor" }, "name": "constructor" }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 430, "end": 518, "loc": { "start": { "line": 11, "column": 18 }, "end": { "line": 15, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 440, "end": 456, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 24 } }, "expression": { "type": "AssignmentExpression", "start": 440, "end": 455, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 23 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 440, "end": 450, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 18 } }, "object": { "type": "ThisExpression", "start": 440, "end": 444, "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 12 } } }, "property": { "type": "Identifier", "start": 445, "end": 450, "loc": { "start": { "line": 12, "column": 13 }, "end": { "line": 12, "column": 18 }, "identifierName": "posts" }, "name": "posts" }, "computed": false }, "right": { "type": "ObjectExpression", "start": 453, "end": 455, "loc": { "start": { "line": 12, "column": 21 }, "end": { "line": 12, "column": 23 } }, "properties": [] } } }, { "type": "ExpressionStatement", "start": 465, "end": 484, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 27 } }, "expression": { "type": "AssignmentExpression", "start": 465, "end": 483, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 26 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 465, "end": 478, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 21 } }, "object": { "type": "ThisExpression", "start": 465, "end": 469, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 12 } } }, "property": { "type": "Identifier", "start": 470, "end": 478, "loc": { "start": { "line": 13, "column": 13 }, "end": { "line": 13, "column": 21 }, "identifierName": "watchers" }, "name": "watchers" }, "computed": false }, "right": { "type": "ObjectExpression", "start": 481, "end": 483, "loc": { "start": { "line": 13, "column": 24 }, "end": { "line": 13, "column": 26 } }, "properties": [] } } }, { "type": "ExpressionStatement", "start": 493, "end": 512, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 27 } }, "expression": { "type": "AssignmentExpression", "start": 493, "end": 511, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 26 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 493, "end": 507, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 22 } }, "object": { "type": "ThisExpression", "start": 493, "end": 497, "loc": { "start": { "line": 14, "column": 8 }, "end": { "line": 14, "column": 12 } } }, "property": { "type": "Identifier", "start": 498, "end": 507, "loc": { "start": { "line": 14, "column": 13 }, "end": { "line": 14, "column": 22 }, "identifierName": "watcherID" }, "name": "watcherID" }, "computed": false }, "right": { "type": "NumericLiteral", "start": 510, "end": 511, "loc": { "start": { "line": 14, "column": 25 }, "end": { "line": 14, "column": 26 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } } } ], "directives": [] } }, { "type": "ClassMethod", "start": 524, "end": 573, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 19, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 524, "end": 528, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 8 }, "identifierName": "look" }, "name": "look" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 529, "end": 532, "loc": { "start": { "line": 17, "column": 9 }, "end": { "line": 17, "column": 12 }, "identifierName": "key" }, "name": "key" } ], "body": { "type": "BlockStatement", "start": 534, "end": 573, "loc": { "start": { "line": 17, "column": 14 }, "end": { "line": 19, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 544, "end": 567, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 31 } }, "argument": { "type": "MemberExpression", "start": 551, "end": 566, "loc": { "start": { "line": 18, "column": 15 }, "end": { "line": 18, "column": 30 } }, "object": { "type": "MemberExpression", "start": 551, "end": 561, "loc": { "start": { "line": 18, "column": 15 }, "end": { "line": 18, "column": 25 } }, "object": { "type": "ThisExpression", "start": 551, "end": 555, "loc": { "start": { "line": 18, "column": 15 }, "end": { "line": 18, "column": 19 } } }, "property": { "type": "Identifier", "start": 556, "end": 561, "loc": { "start": { "line": 18, "column": 20 }, "end": { "line": 18, "column": 25 }, "identifierName": "posts" }, "name": "posts" }, "computed": false }, "property": { "type": "Identifier", "start": 562, "end": 565, "loc": { "start": { "line": 18, "column": 26 }, "end": { "line": 18, "column": 29 }, "identifierName": "key" }, "name": "key" }, "computed": true } } ], "directives": [] } }, { "type": "ClassMethod", "start": 579, "end": 826, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 27, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 579, "end": 583, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 21, "column": 8 }, "identifierName": "post" }, "name": "post" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 584, "end": 587, "loc": { "start": { "line": 21, "column": 9 }, "end": { "line": 21, "column": 12 }, "identifierName": "key" }, "name": "key" }, { "type": "Identifier", "start": 589, "end": 596, "loc": { "start": { "line": 21, "column": 14 }, "end": { "line": 21, "column": 21 }, "identifierName": "message" }, "name": "message" } ], "body": { "type": "BlockStatement", "start": 598, "end": 826, "loc": { "start": { "line": 21, "column": 23 }, "end": { "line": 27, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 608, "end": 634, "loc": { "start": { "line": 22, "column": 8 }, "end": { "line": 22, "column": 34 } }, "expression": { "type": "AssignmentExpression", "start": 608, "end": 633, "loc": { "start": { "line": 22, "column": 8 }, "end": { "line": 22, "column": 33 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 608, "end": 623, "loc": { "start": { "line": 22, "column": 8 }, "end": { "line": 22, "column": 23 } }, "object": { "type": "MemberExpression", "start": 608, "end": 618, "loc": { "start": { "line": 22, "column": 8 }, "end": { "line": 22, "column": 18 } }, "object": { "type": "ThisExpression", "start": 608, "end": 612, "loc": { "start": { "line": 22, "column": 8 }, "end": { "line": 22, "column": 12 } } }, "property": { "type": "Identifier", "start": 613, "end": 618, "loc": { "start": { "line": 22, "column": 13 }, "end": { "line": 22, "column": 18 }, "identifierName": "posts" }, "name": "posts" }, "computed": false }, "property": { "type": "Identifier", "start": 619, "end": 622, "loc": { "start": { "line": 22, "column": 19 }, "end": { "line": 22, "column": 22 }, "identifierName": "key" }, "name": "key" }, "computed": true }, "right": { "type": "Identifier", "start": 626, "end": 633, "loc": { "start": { "line": 22, "column": 26 }, "end": { "line": 22, "column": 33 }, "identifierName": "message" }, "name": "message" } } }, { "type": "VariableDeclaration", "start": 643, "end": 693, "loc": { "start": { "line": 23, "column": 8 }, "end": { "line": 23, "column": 58 } }, "declarations": [ { "type": "VariableDeclarator", "start": 647, "end": 692, "loc": { "start": { "line": 23, "column": 12 }, "end": { "line": 23, "column": 57 } }, "id": { "type": "Identifier", "start": 647, "end": 658, "loc": { "start": { "line": 23, "column": 12 }, "end": { "line": 23, "column": 23 }, "identifierName": "watcherKeys" }, "name": "watcherKeys" }, "init": { "type": "CallExpression", "start": 661, "end": 692, "loc": { "start": { "line": 23, "column": 26 }, "end": { "line": 23, "column": 57 } }, "callee": { "type": "MemberExpression", "start": 661, "end": 672, "loc": { "start": { "line": 23, "column": 26 }, "end": { "line": 23, "column": 37 } }, "object": { "type": "Identifier", "start": 661, "end": 667, "loc": { "start": { "line": 23, "column": 26 }, "end": { "line": 23, "column": 32 }, "identifierName": "Object" }, "name": "Object" }, "property": { "type": "Identifier", "start": 668, "end": 672, "loc": { "start": { "line": 23, "column": 33 }, "end": { "line": 23, "column": 37 }, "identifierName": "keys" }, "name": "keys" }, "computed": false }, "arguments": [ { "type": "MemberExpression", "start": 673, "end": 691, "loc": { "start": { "line": 23, "column": 38 }, "end": { "line": 23, "column": 56 } }, "object": { "type": "MemberExpression", "start": 673, "end": 686, "loc": { "start": { "line": 23, "column": 38 }, "end": { "line": 23, "column": 51 } }, "object": { "type": "ThisExpression", "start": 673, "end": 677, "loc": { "start": { "line": 23, "column": 38 }, "end": { "line": 23, "column": 42 } } }, "property": { "type": "Identifier", "start": 678, "end": 686, "loc": { "start": { "line": 23, "column": 43 }, "end": { "line": 23, "column": 51 }, "identifierName": "watchers" }, "name": "watchers" }, "computed": false }, "property": { "type": "Identifier", "start": 687, "end": 690, "loc": { "start": { "line": 23, "column": 52 }, "end": { "line": 23, "column": 55 }, "identifierName": "key" }, "name": "key" }, "computed": true } ] } } ], "kind": "let" }, { "type": "ForStatement", "start": 702, "end": 820, "loc": { "start": { "line": 24, "column": 8 }, "end": { "line": 26, "column": 9 } }, "init": { "type": "VariableDeclaration", "start": 707, "end": 716, "loc": { "start": { "line": 24, "column": 13 }, "end": { "line": 24, "column": 22 } }, "declarations": [ { "type": "VariableDeclarator", "start": 711, "end": 716, "loc": { "start": { "line": 24, "column": 17 }, "end": { "line": 24, "column": 22 } }, "id": { "type": "Identifier", "start": 711, "end": 712, "loc": { "start": { "line": 24, "column": 17 }, "end": { "line": 24, "column": 18 }, "identifierName": "i" }, "name": "i" }, "init": { "type": "NumericLiteral", "start": 715, "end": 716, "loc": { "start": { "line": 24, "column": 21 }, "end": { "line": 24, "column": 22 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } } ], "kind": "let" }, "test": { "type": "BinaryExpression", "start": 718, "end": 745, "loc": { "start": { "line": 24, "column": 24 }, "end": { "line": 24, "column": 51 } }, "left": { "type": "Identifier", "start": 718, "end": 719, "loc": { "start": { "line": 24, "column": 24 }, "end": { "line": 24, "column": 25 }, "identifierName": "i" }, "name": "i" }, "operator": "<", "right": { "type": "MemberExpression", "start": 722, "end": 745, "loc": { "start": { "line": 24, "column": 28 }, "end": { "line": 24, "column": 51 } }, "object": { "type": "MemberExpression", "start": 722, "end": 738, "loc": { "start": { "line": 24, "column": 28 }, "end": { "line": 24, "column": 44 } }, "object": { "type": "ThisExpression", "start": 722, "end": 726, "loc": { "start": { "line": 24, "column": 28 }, "end": { "line": 24, "column": 32 } } }, "property": { "type": "Identifier", "start": 727, "end": 738, "loc": { "start": { "line": 24, "column": 33 }, "end": { "line": 24, "column": 44 }, "identifierName": "watcherKeys" }, "name": "watcherKeys" }, "computed": false }, "property": { "type": "Identifier", "start": 739, "end": 745, "loc": { "start": { "line": 24, "column": 45 }, "end": { "line": 24, "column": 51 }, "identifierName": "length" }, "name": "length" }, "computed": false } }, "update": { "type": "UpdateExpression", "start": 747, "end": 750, "loc": { "start": { "line": 24, "column": 53 }, "end": { "line": 24, "column": 56 } }, "operator": "++", "prefix": false, "argument": { "type": "Identifier", "start": 747, "end": 748, "loc": { "start": { "line": 24, "column": 53 }, "end": { "line": 24, "column": 54 }, "identifierName": "i" }, "name": "i" } }, "body": { "type": "BlockStatement", "start": 752, "end": 820, "loc": { "start": { "line": 24, "column": 58 }, "end": { "line": 26, "column": 9 } }, "body": [ { "type": "ExpressionStatement", "start": 766, "end": 810, "loc": { "start": { "line": 25, "column": 12 }, "end": { "line": 25, "column": 56 } }, "expression": { "type": "CallExpression", "start": 766, "end": 809, "loc": { "start": { "line": 25, "column": 12 }, "end": { "line": 25, "column": 55 } }, "callee": { "type": "MemberExpression", "start": 766, "end": 800, "loc": { "start": { "line": 25, "column": 12 }, "end": { "line": 25, "column": 46 } }, "object": { "type": "MemberExpression", "start": 766, "end": 784, "loc": { "start": { "line": 25, "column": 12 }, "end": { "line": 25, "column": 30 } }, "object": { "type": "MemberExpression", "start": 766, "end": 779, "loc": { "start": { "line": 25, "column": 12 }, "end": { "line": 25, "column": 25 } }, "object": { "type": "ThisExpression", "start": 766, "end": 770, "loc": { "start": { "line": 25, "column": 12 }, "end": { "line": 25, "column": 16 } }