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,815 lines 40.7 kB
{ "type": "File", "start": 0, "end": 262, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 18, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 262, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 18, "column": 1 } }, "sourceType": "module", "body": [ { "type": "ExportDefaultDeclaration", "start": 86, "end": 262, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 18, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 101, "end": 262, "loc": { "start": { "line": 5, "column": 15 }, "end": { "line": 18, "column": 1 } }, "id": { "type": "Identifier", "start": 107, "end": 113, "loc": { "start": { "line": 5, "column": 21 }, "end": { "line": 5, "column": 27 }, "identifierName": "Matrix" }, "name": "Matrix", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 114, "end": 262, "loc": { "start": { "line": 5, "column": 28 }, "end": { "line": 18, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 121, "end": 141, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 24 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 121, "end": 132, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 15 }, "identifierName": "setPosition" }, "name": "setPosition" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 133, "end": 134, "loc": { "start": { "line": 7, "column": 16 }, "end": { "line": 7, "column": 17 }, "identifierName": "x" }, "name": "x" }, { "type": "Identifier", "start": 136, "end": 137, "loc": { "start": { "line": 7, "column": 19 }, "end": { "line": 7, "column": 20 }, "identifierName": "y" }, "name": "y" } ], "body": { "type": "BlockStatement", "start": 139, "end": 141, "loc": { "start": { "line": 7, "column": 22 }, "end": { "line": 7, "column": 24 } }, "body": [], "directives": [] } }, { "type": "ClassMethod", "start": 147, "end": 174, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 31 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 147, "end": 155, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 12 }, "identifierName": "setScale" }, "name": "setScale" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 156, "end": 162, "loc": { "start": { "line": 9, "column": 13 }, "end": { "line": 9, "column": 19 }, "identifierName": "scaleX" }, "name": "scaleX" }, { "type": "Identifier", "start": 164, "end": 170, "loc": { "start": { "line": 9, "column": 21 }, "end": { "line": 9, "column": 27 }, "identifierName": "scaleY" }, "name": "scaleY" } ], "body": { "type": "BlockStatement", "start": 172, "end": 174, "loc": { "start": { "line": 9, "column": 29 }, "end": { "line": 9, "column": 31 } }, "body": [], "directives": [] } }, { "type": "ClassMethod", "start": 180, "end": 210, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 11, "column": 34 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 180, "end": 191, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 11, "column": 15 }, "identifierName": "setRotation" }, "name": "setRotation" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 192, "end": 206, "loc": { "start": { "line": 11, "column": 16 }, "end": { "line": 11, "column": 30 }, "identifierName": "rotationDegree" }, "name": "rotationDegree" } ], "body": { "type": "BlockStatement", "start": 208, "end": 210, "loc": { "start": { "line": 11, "column": 32 }, "end": { "line": 11, "column": 34 } }, "body": [], "directives": [] } }, { "type": "ClassMethod", "start": 216, "end": 225, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 13 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 216, "end": 220, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 8 }, "identifierName": "copy" }, "name": "copy" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 223, "end": 225, "loc": { "start": { "line": 13, "column": 11 }, "end": { "line": 13, "column": 13 } }, "body": [], "directives": [] } }, { "type": "ClassMethod", "start": 231, "end": 240, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 13 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 231, "end": 234, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 7 }, "identifierName": "add" }, "name": "add" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 235, "end": 236, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 9 }, "identifierName": "m" }, "name": "m" } ], "body": { "type": "BlockStatement", "start": 238, "end": 240, "loc": { "start": { "line": 15, "column": 11 }, "end": { "line": 15, "column": 13 } }, "body": [], "directives": [] } }, { "type": "ClassMethod", "start": 246, "end": 260, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 18 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 246, "end": 254, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 12 }, "identifierName": "multiply" }, "name": "multiply" }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 255, "end": 256, "loc": { "start": { "line": 17, "column": 13 }, "end": { "line": 17, "column": 14 }, "identifierName": "m" }, "name": "m" } ], "body": { "type": "BlockStatement", "start": 258, "end": 260, "loc": { "start": { "line": 17, "column": 16 }, "end": { "line": 17, "column": 18 } }, "body": [], "directives": [] } } ] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Baseclass for a Matrix. Use Matrix3 or Matrix4 for 2D and 3D matrix math.\n ", "start": 1, "end": 85, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 4, "column": 3 } } } ], "trailingComments": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Baseclass for a Matrix. Use Matrix3 or Matrix4 for 2D and 3D matrix math.\n ", "start": 1, "end": 85, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 4, "column": 3 } } } ] } ], "directives": [] }, "comments": [ { "type": "CommentBlock", "value": "*\n * Baseclass for a Matrix. Use Matrix3 or Matrix4 for 2D and 3D matrix math.\n ", "start": 1, "end": 85, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 4, "column": 3 } } } ], "tokens": [ { "type": "CommentBlock", "value": "*\n * Baseclass for a Matrix. Use Matrix3 or Matrix4 for 2D and 3D matrix math.\n ", "start": 1, "end": 85, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 4, "column": 3 } } }, { "type": { "label": "export", "keyword": "export", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "export", "start": 86, "end": 92, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 6 } } }, { "type": { "label": "default", "keyword": "default", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "default", "start": 93, "end": 100, "loc": { "start": { "line": 5, "column": 7 }, "end": { "line": 5, "column": 14 } } }, { "type": { "label": "class", "keyword": "class", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "class", "start": 101, "end": 106, "loc": { "start": { "line": 5, "column": 15 }, "end": { "line": 5, "column": 20 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "Matrix", "start": 107, "end": 113, "loc": { "start": { "line": 5, "column": 21 }, "end": { "line": 5, "column": 27 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 114, "end": 115, "loc": { "start": { "line": 5, "column": 28 }, "end": { "line": 5, "column": 29 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "setPosition", "start": 121, "end": 132, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 15 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 132, "end": 133, "loc": { "start": { "line": 7, "column": 15 }, "end": { "line": 7, "column": 16 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "x", "start": 133, "end": 134, "loc": { "start": { "line": 7, "column": 16 }, "end": { "line": 7, "column": 17 } } }, { "type": { "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 134, "end": 135, "loc": { "start": { "line": 7, "column": 17 }, "end": { "line": 7, "column": 18 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "y", "start": 136, "end": 137, "loc": { "start": { "line": 7, "column": 19 }, "end": { "line": 7, "column": 20 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 137, "end": 138, "loc": { "start": { "line": 7, "column": 20 }, "end": { "line": 7, "column": 21 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 139, "end": 140, "loc": { "start": { "line": 7, "column": 22 }, "end": { "line": 7, "column": 23 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 140, "end": 141, "loc": { "start": { "line": 7, "column": 23 }, "end": { "line": 7, "column": 24 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "setScale", "start": 147, "end": 155, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 12 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 155, "end": 156, "loc": { "start": { "line": 9, "column": 12 }, "end": { "line": 9, "column": 13 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "scaleX", "start": 156, "end": 162, "loc": { "start": { "line": 9, "column": 13 }, "end": { "line": 9, "column": 19 } } }, { "type": { "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 162, "end": 163, "loc": { "start": { "line": 9, "column": 19 }, "end": { "line": 9, "column": 20 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "scaleY", "start": 164, "end": 170, "loc": { "start": { "line": 9, "column": 21 }, "end": { "line": 9, "column": 27 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 170, "end": 171, "loc": { "start": { "line": 9, "column": 27 }, "end": { "line": 9, "column": 28 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 172, "end": 173, "loc": { "start": { "line": 9, "column": 29 }, "end": { "line": 9, "column": 30 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 173, "end": 174, "loc": { "start": { "line": 9, "column": 30 }, "end": { "line": 9, "column": 31 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "setRotation", "start": 180, "end": 191, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 11, "column": 15 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 191, "end": 192, "loc": { "start": { "line": 11, "column": 15 }, "end": { "line": 11, "column": 16 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "rotationDegree", "start": 192, "end": 206, "loc": { "start": { "line": 11, "column": 16 }, "end": { "line": 11, "column": 30 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 206, "end": 207, "loc": { "start": { "line": 11, "column": 30 }, "end": { "line": 11, "column": 31 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 208, "end": 209, "loc": { "start": { "line": 11, "column": 32 }, "end": { "line": 11, "column": 33 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 209, "end": 210, "loc": { "start": { "line": 11, "column": 33 }, "end": { "line": 11, "column": 34 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "copy", "start": 216, "end": 220, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 8 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 220, "end": 221, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 9 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 221, "end": 222, "loc": { "start": { "line": 13, "column": 9 }, "end": { "line": 13, "column": 10 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 223, "end": 224, "loc": { "start": { "line": 13, "column": 11 }, "end": { "line": 13, "column": 12 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 224, "end": 225, "loc": { "start": { "line": 13, "column": 12 }, "end": { "line": 13, "column": 13 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "add", "start": 231, "end": 234, "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 7 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 234, "end": 235, "loc": { "start": { "line": 15, "column": 7 }, "end": { "line": 15, "column": 8 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "m", "start": 235, "end": 236, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 9 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 236, "end": 237, "loc": { "start": { "line": 15, "column": 9 }, "end": { "line": 15, "column": 10 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 238, "end": 239, "loc": { "start": { "line": 15, "column": 11 }, "end": { "line": 15, "column": 12 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 239, "end": 240, "loc": { "start": { "line": 15, "column": 12 }, "end": { "line": 15, "column": 13 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "multiply", "start": 246, "end": 254, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 12 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 254, "end": 255, "loc": { "start": { "line": 17, "column": 12 }, "end": { "line": 17, "column": 13 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "m", "start": 255, "end": 256, "loc": { "start": { "line": 17, "column": 13 }, "end": { "line": 17, "column": 14 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 256, "end": 257, "loc": { "start": { "line": 17, "column": 14 }, "end": { "line": 17, "column": 15 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 258, "end": 259, "loc": { "start": { "line": 17, "column": 16 }, "end": { "line": 17, "column": 17 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 259, "end": 260, "loc": { "start": { "line": 17, "column": 17 }, "end": { "line": 17, "column": 18 } } }, { "type": { "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 261, "end": 262, "loc": { "start": { "line": 18, "column": 0 }, "end": { "line": 18, "column": 1 } } }, { "type": { "label": "eof", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 262, "end": 262, "loc": { "start": { "line": 18, "column": 1 }, "end": { "line": 18, "column": 1 } } } ] }