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,471 lines (1,470 loc) 142 kB
{ "type": "File", "start": 0, "end": 1244, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 42, "column": 1 } }, "program": { "type": "Program", "start": 0, "end": 1244, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 42, "column": 1 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 38, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 38 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 7, "end": 17, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 17 } }, "local": { "type": "Identifier", "start": 7, "end": 17, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 17 }, "identifierName": "Controller" }, "name": "Controller" } } ], "source": { "type": "StringLiteral", "start": 23, "end": 37, "loc": { "start": { "line": 1, "column": 23 }, "end": { "line": 1, "column": 37 } }, "extra": { "rawValue": "./Controller", "raw": "'./Controller'" }, "value": "./Controller" } }, { "type": "ImportDeclaration", "start": 39, "end": 78, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 39 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 46, "end": 53, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 } }, "local": { "type": "Identifier", "start": 46, "end": 53, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 14 }, "identifierName": "KeyCode" }, "name": "KeyCode" } } ], "source": { "type": "StringLiteral", "start": 59, "end": 77, "loc": { "start": { "line": 2, "column": 20 }, "end": { "line": 2, "column": 38 } }, "extra": { "rawValue": "../const/KeyCode", "raw": "'../const/KeyCode'" }, "value": "../const/KeyCode" } }, { "type": "ImportDeclaration", "start": 79, "end": 126, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 47 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 88, "end": 100, "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 21 } }, "imported": { "type": "Identifier", "start": 88, "end": 100, "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 21 }, "identifierName": "InputManager" }, "name": "InputManager" }, "local": { "type": "Identifier", "start": 88, "end": 100, "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 21 }, "identifierName": "InputManager" }, "name": "InputManager" } }, { "type": "ImportSpecifier", "start": 102, "end": 107, "loc": { "start": { "line": 3, "column": 23 }, "end": { "line": 3, "column": 28 } }, "imported": { "type": "Identifier", "start": 102, "end": 107, "loc": { "start": { "line": 3, "column": 23 }, "end": { "line": 3, "column": 28 }, "identifierName": "Point" }, "name": "Point" }, "local": { "type": "Identifier", "start": 102, "end": 107, "loc": { "start": { "line": 3, "column": 23 }, "end": { "line": 3, "column": 28 }, "identifierName": "Point" }, "name": "Point" } } ], "source": { "type": "StringLiteral", "start": 115, "end": 125, "loc": { "start": { "line": 3, "column": 36 }, "end": { "line": 3, "column": 46 } }, "extra": { "rawValue": "../entry", "raw": "'../entry'" }, "value": "../entry" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * A Controller Component with extra methods designed for controlling a \n * character in a Top-Down Perspective view.\n ", "start": 128, "end": 253, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 8, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 254, "end": 1244, "loc": { "start": { "line": 9, "column": 0 }, "end": { "line": 42, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 269, "end": 1244, "loc": { "start": { "line": 9, "column": 15 }, "end": { "line": 42, "column": 1 } }, "id": { "type": "Identifier", "start": 275, "end": 292, "loc": { "start": { "line": 9, "column": 21 }, "end": { "line": 9, "column": 38 }, "identifierName": "TopDownController" }, "name": "TopDownController", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 301, "end": 311, "loc": { "start": { "line": 9, "column": 47 }, "end": { "line": 9, "column": 57 }, "identifierName": "Controller" }, "name": "Controller" }, "body": { "type": "ClassBody", "start": 312, "end": 1244, "loc": { "start": { "line": 9, "column": 58 }, "end": { "line": 42, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 318, "end": 356, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 12, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 318, "end": 329, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 15 }, "identifierName": "constructor" }, "name": "constructor" }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 332, "end": 356, "loc": { "start": { "line": 10, "column": 18 }, "end": { "line": 12, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 342, "end": 350, "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 16 } }, "expression": { "type": "CallExpression", "start": 342, "end": 349, "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 15 } }, "callee": { "type": "Super", "start": 342, "end": 347, "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 13 } } }, "arguments": [] } } ], "directives": [], "trailingComments": null }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Returns true if this game update notices a key press for 'W' or Up key.\n ", "start": 362, "end": 452, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 16, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 457, "end": 572, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 19, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 457, "end": 468, "loc": { "start": { "line": 17, "column": 4 }, "end": { "line": 17, "column": 15 }, "identifierName": "isUpPressed" }, "name": "isUpPressed", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 471, "end": 572, "loc": { "start": { "line": 17, "column": 18 }, "end": { "line": 19, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 481, "end": 566, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 93 } }, "argument": { "type": "LogicalExpression", "start": 488, "end": 565, "loc": { "start": { "line": 18, "column": 15 }, "end": { "line": 18, "column": 92 } }, "left": { "type": "CallExpression", "start": 488, "end": 524, "loc": { "start": { "line": 18, "column": 15 }, "end": { "line": 18, "column": 51 } }, "callee": { "type": "MemberExpression", "start": 488, "end": 513, "loc": { "start": { "line": 18, "column": 15 }, "end": { "line": 18, "column": 40 } }, "object": { "type": "Identifier", "start": 488, "end": 500, "loc": { "start": { "line": 18, "column": 15 }, "end": { "line": 18, "column": 27 }, "identifierName": "InputManager" }, "name": "InputManager" }, "property": { "type": "Identifier", "start": 501, "end": 513, "loc": { "start": { "line": 18, "column": 28 }, "end": { "line": 18, "column": 40 }, "identifierName": "isKeyPressed" }, "name": "isKeyPressed" }, "computed": false }, "arguments": [ { "type": "MemberExpression", "start": 514, "end": 523, "loc": { "start": { "line": 18, "column": 41 }, "end": { "line": 18, "column": 50 } }, "object": { "type": "Identifier", "start": 514, "end": 521, "loc": { "start": { "line": 18, "column": 41 }, "end": { "line": 18, "column": 48 }, "identifierName": "KeyCode" }, "name": "KeyCode" }, "property": { "type": "Identifier", "start": 522, "end": 523, "loc": { "start": { "line": 18, "column": 49 }, "end": { "line": 18, "column": 50 }, "identifierName": "W" }, "name": "W" }, "computed": false } ] }, "operator": "||", "right": { "type": "CallExpression", "start": 528, "end": 565, "loc": { "start": { "line": 18, "column": 55 }, "end": { "line": 18, "column": 92 } }, "callee": { "type": "MemberExpression", "start": 528, "end": 553, "loc": { "start": { "line": 18, "column": 55 }, "end": { "line": 18, "column": 80 } }, "object": { "type": "Identifier", "start": 528, "end": 540, "loc": { "start": { "line": 18, "column": 55 }, "end": { "line": 18, "column": 67 }, "identifierName": "InputManager" }, "name": "InputManager" }, "property": { "type": "Identifier", "start": 541, "end": 553, "loc": { "start": { "line": 18, "column": 68 }, "end": { "line": 18, "column": 80 }, "identifierName": "isKeyPressed" }, "name": "isKeyPressed" }, "computed": false }, "arguments": [ { "type": "MemberExpression", "start": 554, "end": 564, "loc": { "start": { "line": 18, "column": 81 }, "end": { "line": 18, "column": 91 } }, "object": { "type": "Identifier", "start": 554, "end": 561, "loc": { "start": { "line": 18, "column": 81 }, "end": { "line": 18, "column": 88 }, "identifierName": "KeyCode" }, "name": "KeyCode" }, "property": { "type": "Identifier", "start": 562, "end": 564, "loc": { "start": { "line": 18, "column": 89 }, "end": { "line": 18, "column": 91 }, "identifierName": "UP" }, "name": "UP" }, "computed": false } ] } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Returns true if this game update notices a key press for 'W' or Up key.\n ", "start": 362, "end": 452, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 16, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Returns true if this game update notices a key press for 'S' or Down key.\n ", "start": 578, "end": 670, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 23, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 675, "end": 794, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 26, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 675, "end": 688, "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 24, "column": 17 }, "identifierName": "isDownPressed" }, "name": "isDownPressed", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 691, "end": 794, "loc": { "start": { "line": 24, "column": 20 }, "end": { "line": 26, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 701, "end": 788, "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 95 } }, "argument": { "type": "LogicalExpression", "start": 708, "end": 787, "loc": { "start": { "line": 25, "column": 15 }, "end": { "line": 25, "column": 94 } }, "left": { "type": "CallExpression", "start": 708, "end": 744, "loc": { "start": { "line": 25, "column": 15 }, "end": { "line": 25, "column": 51 } }, "callee": { "type": "MemberExpression", "start": 708, "end": 733, "loc": { "start": { "line": 25, "column": 15 }, "end": { "line": 25, "column": 40 } }, "object": { "type": "Identifier", "start": 708, "end": 720, "loc": { "start": { "line": 25, "column": 15 }, "end": { "line": 25, "column": 27 }, "identifierName": "InputManager" }, "name": "InputManager" }, "property": { "type": "Identifier", "start": 721, "end": 733, "loc": { "start": { "line": 25, "column": 28 }, "end": { "line": 25, "column": 40 }, "identifierName": "isKeyPressed" }, "name": "isKeyPressed" }, "computed": false }, "arguments": [ { "type": "MemberExpression", "start": 734, "end": 743, "loc": { "start": { "line": 25, "column": 41 }, "end": { "line": 25, "column": 50 } }, "object": { "type": "Identifier", "start": 734, "end": 741, "loc": { "start": { "line": 25, "column": 41 }, "end": { "line": 25, "column": 48 }, "identifierName": "KeyCode" }, "name": "KeyCode" }, "property": { "type": "Identifier", "start": 742, "end": 743, "loc": { "start": { "line": 25, "column": 49 }, "end": { "line": 25, "column": 50 }, "identifierName": "S" }, "name": "S" }, "computed": false } ] }, "operator": "||", "right": { "type": "CallExpression", "start": 748, "end": 787, "loc": { "start": { "line": 25, "column": 55 }, "end": { "line": 25, "column": 94 } }, "callee": { "type": "MemberExpression", "start": 748, "end": 773, "loc": { "start": { "line": 25, "column": 55 }, "end": { "line": 25, "column": 80 } }, "object": { "type": "Identifier", "start": 748, "end": 760, "loc": { "start": { "line": 25, "column": 55 }, "end": { "line": 25, "column": 67 }, "identifierName": "InputManager" }, "name": "InputManager" }, "property": { "type": "Identifier", "start": 761, "end": 773, "loc": { "start": { "line": 25, "column": 68 }, "end": { "line": 25, "column": 80 }, "identifierName": "isKeyPressed" }, "name": "isKeyPressed" }, "computed": false }, "arguments": [ { "type": "MemberExpression", "start": 774, "end": 786, "loc": { "start": { "line": 25, "column": 81 }, "end": { "line": 25, "column": 93 } }, "object": { "type": "Identifier", "start": 774, "end": 781, "loc": { "start": { "line": 25, "column": 81 }, "end": { "line": 25, "column": 88 }, "identifierName": "KeyCode" }, "name": "KeyCode" }, "property": { "type": "Identifier", "start": 782, "end": 786, "loc": { "start": { "line": 25, "column": 89 }, "end": { "line": 25, "column": 93 }, "identifierName": "DOWN" }, "name": "DOWN" }, "computed": false } ] } } } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * Returns true if this game update notices a key press for 'S' or Down key.\n ", "start": 578, "end": 670, "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 23, "column": 7 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Returns true if this game update notices a key press for 'A' or Left key.\n ", "start": 800, "end": 892, "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 30, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 897, "end": 1016, "loc": { "start": { "line": 31, "column": 4 }, "end": { "line": 33, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 897, "end": 910, "loc": { "start": { "line": 31, "column": 4 }, "end": { "line": 31, "column": 17 }, "identifierName": "isLeftPressed" }, "name": "isLeftPressed", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 913, "end": 1016, "loc": { "start": { "line": 31, "column": 20 }, "end": { "line": 33, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 923, "end": 1010, "loc": { "start": { "line": 32, "column": 8 }, "end": { "line": 32, "column": 95 } }, "argument": { "type": "LogicalExpression", "start": 930, "end": 1009, "loc": { "start": { "line": 32, "column": 15 }, "end": { "line": 32, "column": 94 } }, "left": { "type": "CallExpression", "start": 930, "end": 966, "loc": { "start": { "line": 32, "column": 15 }, "end": { "line": 32, "column": 51 } }, "callee": { "type": "MemberExpression", "start": 930, "end": 955, "loc": { "start": { "line": 32, "column": 15 }, "end": { "line": 32, "column": 40 } }, "object": { "type": "Identifier", "start": 930, "end": 942, "loc": { "start": { "line": 32, "column": 15 }, "end": { "line": 32, "column": 27 }, "identifierName": "InputManager" }, "name": "InputManager" }, "property": { "type": "Identifier", "start": 943, "end": 955, "loc": { "start": { "line": 32, "column": 28 }, "end": { "line": 32, "column": 40 }, "identifierName": "isKeyPressed" }, "name": "isKeyPressed" }, "computed": false }, "arguments": [ { "type": "MemberExpression", "start": 956, "end": 965, "loc": { "start": { "line": 32, "column": 41 }, "end": { "line": 32, "column": 50 } }, "object": { "type": "Identifier", "start": 956, "end": 963, "loc": { "start": { "line": 32, "column": 41 }, "end": { "line": 32, "column": 48 }, "identifierName": "KeyCode" }, "name": "KeyCode" }, "property": { "type": "Identifier", "start": 964, "end": 965, "loc": { "start": { "line": 32, "column": 49 }, "end": { "line": 32, "column": 50 }, "identifierName": "A" }, "name": "A" }, "computed": false } ] }, "operator": "||", "right": { "type": "CallExpression", "start": 970, "end": 1009, "loc": { "start": { "line": 32, "column": 55 }, "end": { "line": 32, "column": 94 } }, "callee": { "type": "MemberExpression", "start": 970, "end": 995, "loc": { "start": { "line": 32, "column": 55 }, "end": { "line": 32,