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,509 lines (1,508 loc) • 710 kB
JSON
{
"type": "File",
"start": 0,
"end": 2965,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 73,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 2965,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 73,
"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": 130,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 51
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 86,
"end": 98,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 19
}
},
"local": {
"type": "Identifier",
"start": 86,
"end": 98,
"loc": {
"start": {
"line": 3,
"column": 7
},
"end": {
"line": 3,
"column": 19
},
"identifierName": "InputManager"
},
"name": "InputManager"
}
}
],
"source": {
"type": "StringLiteral",
"start": 104,
"end": 129,
"loc": {
"start": {
"line": 3,
"column": 25
},
"end": {
"line": 3,
"column": 50
}
},
"extra": {
"rawValue": "../manager/InputManager",
"raw": "'../manager/InputManager'"
},
"value": "../manager/InputManager"
},
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * \n ",
"start": 132,
"end": 143,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 7,
"column": 3
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 144,
"end": 2965,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 73,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 159,
"end": 2965,
"loc": {
"start": {
"line": 8,
"column": 15
},
"end": {
"line": 73,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 165,
"end": 180,
"loc": {
"start": {
"line": 8,
"column": 21
},
"end": {
"line": 8,
"column": 36
},
"identifierName": "ClickController"
},
"name": "ClickController",
"leadingComments": null
},
"superClass": {
"type": "Identifier",
"start": 189,
"end": 199,
"loc": {
"start": {
"line": 8,
"column": 45
},
"end": {
"line": 8,
"column": 55
},
"identifierName": "Controller"
},
"name": "Controller"
},
"body": {
"type": "ClassBody",
"start": 200,
"end": 2965,
"loc": {
"start": {
"line": 8,
"column": 56
},
"end": {
"line": 73,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 206,
"end": 1081,
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 29,
"column": 5
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 206,
"end": 217,
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 9,
"column": 15
},
"identifierName": "constructor"
},
"name": "constructor"
},
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 218,
"end": 228,
"loc": {
"start": {
"line": 9,
"column": 16
},
"end": {
"line": 9,
"column": 26
},
"identifierName": "viewportID"
},
"name": "viewportID"
},
{
"type": "AssignmentPattern",
"start": 230,
"end": 260,
"loc": {
"start": {
"line": 9,
"column": 28
},
"end": {
"line": 9,
"column": 58
}
},
"left": {
"type": "Identifier",
"start": 230,
"end": 244,
"loc": {
"start": {
"line": 9,
"column": 28
},
"end": {
"line": 9,
"column": 42
},
"identifierName": "onLeftReleased"
},
"name": "onLeftReleased"
},
"right": {
"type": "ArrowFunctionExpression",
"start": 247,
"end": 260,
"loc": {
"start": {
"line": 9,
"column": 45
},
"end": {
"line": 9,
"column": 58
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 248,
"end": 253,
"loc": {
"start": {
"line": 9,
"column": 46
},
"end": {
"line": 9,
"column": 51
},
"identifierName": "event"
},
"name": "event"
}
],
"body": {
"type": "BlockStatement",
"start": 258,
"end": 260,
"loc": {
"start": {
"line": 9,
"column": 56
},
"end": {
"line": 9,
"column": 58
}
},
"body": [],
"directives": []
}
}
},
{
"type": "AssignmentPattern",
"start": 262,
"end": 293,
"loc": {
"start": {
"line": 9,
"column": 60
},
"end": {
"line": 9,
"column": 91
}
},
"left": {
"type": "Identifier",
"start": 262,
"end": 277,
"loc": {
"start": {
"line": 9,
"column": 60
},
"end": {
"line": 9,
"column": 75
},
"identifierName": "onRightReleased"
},
"name": "onRightReleased"
},
"right": {
"type": "ArrowFunctionExpression",
"start": 280,
"end": 293,
"loc": {
"start": {
"line": 9,
"column": 78
},
"end": {
"line": 9,
"column": 91
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 281,
"end": 286,
"loc": {
"start": {
"line": 9,
"column": 79
},
"end": {
"line": 9,
"column": 84
},
"identifierName": "event"
},
"name": "event"
}
],
"body": {
"type": "BlockStatement",
"start": 291,
"end": 293,
"loc": {
"start": {
"line": 9,
"column": 89
},
"end": {
"line": 9,
"column": 91
}
},
"body": [],
"directives": []
}
}
},
{
"type": "AssignmentPattern",
"start": 295,
"end": 324,
"loc": {
"start": {
"line": 9,
"column": 93
},
"end": {
"line": 9,
"column": 122
}
},
"left": {
"type": "Identifier",
"start": 295,
"end": 308,
"loc": {
"start": {
"line": 9,
"column": 93
},
"end": {
"line": 9,
"column": 106
},
"identifierName": "onLeftPressed"
},
"name": "onLeftPressed"
},
"right": {
"type": "ArrowFunctionExpression",
"start": 311,
"end": 324,
"loc": {
"start": {
"line": 9,
"column": 109
},
"end": {
"line": 9,
"column": 122
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 312,
"end": 317,
"loc": {
"start": {
"line": 9,
"column": 110
},
"end": {
"line": 9,
"column": 115
},
"identifierName": "event"
},
"name": "event"
}
],
"body": {
"type": "BlockStatement",
"start": 322,
"end": 324,
"loc": {
"start": {
"line": 9,
"column": 120
},
"end": {
"line": 9,
"column": 122
}
},
"body": [],
"directives": []
}
}
},
{
"type": "AssignmentPattern",
"start": 326,
"end": 356,
"loc": {
"start": {
"line": 9,
"column": 124
},
"end": {
"line": 9,
"column": 154
}
},
"left": {
"type": "Identifier",
"start": 326,
"end": 340,
"loc": {
"start": {
"line": 9,
"column": 124
},
"end": {
"line": 9,
"column": 138
},
"identifierName": "onRightPressed"
},
"name": "onRightPressed"
},
"right": {
"type": "ArrowFunctionExpression",
"start": 343,
"end": 356,
"loc": {
"start": {
"line": 9,
"column": 141
},
"end": {
"line": 9,
"column": 154
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 344,
"end": 349,
"loc": {
"start": {
"line": 9,
"column": 142
},
"end": {
"line": 9,
"column": 147
},
"identifierName": "event"
},
"name": "event"
}
],
"body": {
"type": "BlockStatement",
"start": 354,
"end": 356,
"loc": {
"start": {
"line": 9,
"column": 152
},
"end": {
"line": 9,
"column": 154
}
},
"body": [],
"directives": []
}
}
},
{
"type": "AssignmentPattern",
"start": 358,
"end": 394,
"loc": {
"start": {
"line": 9,
"column": 156
},
"end": {
"line": 9,
"column": 192
}
},
"left": {
"type": "Identifier",
"start": 358,
"end": 378,
"loc": {
"start": {
"line": 9,
"column": 156
},
"end": {
"line": 9,
"column": 176
},
"identifierName": "onLeftReleaseOutside"
},
"name": "onLeftReleaseOutside"
},
"right": {
"type": "ArrowFunctionExpression",
"start": 381,
"end": 394,
"loc": {
"start": {
"line": 9,
"column": 179
},
"end": {
"line": 9,
"column": 192
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 382,
"end": 387,
"loc": {
"start": {
"line": 9,
"column": 180
},
"end": {
"line": 9,
"column": 185
},
"identifierName": "event"
},
"name": "event"
}
],
"body": {
"type": "BlockStatement",
"start": 392,
"end": 394,
"loc": {
"start": {
"line": 9,
"column": 190
},
"end": {
"line": 9,
"column": 192
}
},
"body": [],
"directives": []
}
}
},
{
"type": "AssignmentPattern",
"start": 396,
"end": 433,
"loc": {
"start": {
"line": 9,
"column": 194
},
"end": {
"line": 9,
"column": 231
}
},
"left": {
"type": "Identifier",
"start": 396,
"end": 417,
"loc": {
"start": {
"line": 9,
"column": 194
},
"end": {
"line": 9,
"column": 215
},
"identifierName": "onRightReleaseOutside"
},
"name": "onRightReleaseOutside"
},
"right": {
"type": "ArrowFunctionExpression",
"start": 420,
"end": 433,
"loc": {
"start": {
"line": 9,
"column": 218
},
"end": {
"line": 9,
"column": 231
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 421,
"end": 426,
"loc": {
"start": {
"line": 9,
"column": 219
},
"end": {
"line": 9,
"column": 224
},
"identifierName": "event"
},
"name": "event"
}
],
"body": {
"type": "BlockStatement",
"start": 431,
"end": 433,
"loc": {
"start": {
"line": 9,
"column": 229
},
"end": {
"line": 9,
"column": 231
}
},
"body": [],
"directives": []
}
}
}
],
"body": {
"type": "BlockStatement",
"start": 435,
"end": 1081,
"loc": {
"start": {
"line": 9,
"column": 233
},
"end": {
"line": 29,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 445,
"end": 453,
"loc": {
"start": {
"line": 10,
"column": 8
},
"end": {
"line": 10,
"column": 16
}
},
"expression": {
"type": "CallExpression",
"start": 445,
"end": 452,
"loc": {
"start": {
"line": 10,
"column": 8
},
"end": {
"line": 10,
"column": 15
}
},
"callee": {
"type": "Super",
"start": 445,
"end": 450,
"loc": {
"start": {
"line": 10,
"column": 8
},
"end": {
"line": 10,
"column": 13
}
}
},
"arguments": []
}
},
{
"type": "ExpressionStatement",
"start": 462,
"end": 497,
"loc": {
"start": {
"line": 11,
"column": 8
},
"end": {
"line": 11,
"column": 43
}
},
"expression": {
"type": "AssignmentExpression",
"start": 462,
"end": 496,
"loc": {
"start": {
"line": 11,
"column": 8
},
"end": {
"line": 11,
"column": 42
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 462,
"end": 476,
"loc": {
"start": {
"line": 11,
"column": 8
},
"end": {
"line": 11,
"column": 22
}
},
"object": {
"type": "ThisExpression",
"start": 462,
"end": 466,
"loc": {
"start": {
"line": 11,
"column": 8
},
"end": {
"line": 11,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 467,
"end": 476,
"loc": {
"start": {
"line": 11,
"column": 13
},
"end": {
"line": 11,
"column": 22
},
"identifierName": "className"
},
"name": "className"
},
"computed": false
},
"right": {
"type": "StringLiteral",
"start": 479,
"end": 496,
"loc": {
"start": {
"line": 11,
"column": 25
},
"end": {
"line": 11,
"column": 42
}
},
"extra": {
"rawValue": "ClickController",
"raw": "'ClickController'"
},
"value": "ClickController"
}
}
},
{
"type": "ExpressionStatement",
"start": 506,
"end": 535,
"loc": {
"start": {
"line": 12,
"column": 8
},
"end": {
"line": 12,
"column": 37
}
},
"expression": {
"type": "AssignmentExpression",
"start": 506,
"end": 534,
"loc": {
"start": {
"line": 12,
"column": 8
},
"end": {
"line": 12,
"column": 36
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 506,
"end": 521,
"loc": {
"start": {
"line": 12,
"column": 8
},
"end": {
"line": 12,
"column": 23
}
},
"object": {
"type": "ThisExpression",
"start": 506,
"end": 510,
"loc": {
"start": {
"line": 12,
"column": 8
},
"end": {
"line": 12,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 511,
"end": 521,
"loc": {
"start": {
"line": 12,
"column": 13
},
"end": {
"line": 12,
"column": 23
},
"identifierName": "viewportID"
},
"name": "viewportID"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 524,
"end": 534,
"loc": {
"start": {
"line": 12,
"column": 26
},
"end": {
"line": 12,
"column": 36
},
"identifierName": "viewportID"
},
"name": "viewportID"
}
}
},
{
"type": "ExpressionStatement",
"start": 544,
"end": 581,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 45
}
},
"expression": {
"type": "AssignmentExpression",
"start": 544,
"end": 580,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 44
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 544,
"end": 563,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 27
}
},
"object": {
"type": "ThisExpression",
"start": 544,
"end": 548,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 549,
"end": 563,
"loc": {
"start": {
"line": 13,
"column": 13
},
"end": {
"line": 13,
"column": 27
},
"identifierName": "onLeftReleased"
},
"name": "onLeftReleased"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 566,
"end": 580,
"loc": {
"start": {
"line": 13,
"column": 30
},
"end": {
"line": 13,
"column": 44
},
"identifierName": "onLeftReleased"
},
"name": "onLeftReleased"
}
}
},
{
"type": "ExpressionStatement",
"start": 590,
"end": 629,
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 14,
"column": 47
}
},
"expression": {
"type": "AssignmentExpression",
"start": 590,
"end": 628,
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 14,
"column": 46
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 590,
"end": 610,
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 14,
"column": 28
}
},
"object": {
"type": "ThisExpression",
"start": 590,
"end": 594,
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 14,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 595,
"end": 610,
"loc": {
"start": {
"line": 14,
"column": 13
},
"end": {
"line": 14,
"column": 28
},
"identifierName": "onRightReleased"
},
"name": "onRightReleased"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 613,
"end": 628,
"loc": {
"start": {
"line": 14,
"column": 31
},
"end": {
"line": 14,
"column": 46
},
"identifierName": "onRightReleased"
},
"name": "onRightReleased"
}
}
},
{
"type": "ExpressionStatement",
"start": 638,
"end": 673,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 15,
"column": 43
}
},
"expression": {
"type": "AssignmentExpression",
"start": 638,
"end": 672,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 15,
"column": 42
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 638,
"end": 656,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 15,
"column": 26
}
},
"object": {
"type": "ThisExpression",
"start": 638,
"end": 642,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 15,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 643,
"end": 656,
"loc": {
"start": {
"line": 15,
"column": 13
},
"end": {
"line": 15,
"column": 26
},
"identifierName": "onLeftPressed"
},
"name": "onLeftPressed"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 659,
"end": 672,
"loc": {
"start": {
"line": 15,
"column": 29
},
"end": {
"line": 15,
"column": 42
},
"identifierName": "onLeftPressed"
},
"name": "onLeftPressed"
}
}
},
{
"type": "ExpressionStatement",
"start": 682,
"end": 719,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 45
}
},
"expression": {
"type": "AssignmentExpression",
"start": 682,
"end": 718,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 44
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 682,
"end": 701,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 27
}
},
"object": {
"type": "ThisExpression",
"start": 682,
"end": 686,
"loc": {
"start": {
"line": 16,
"column": 8
},