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,435 lines (1,434 loc) • 350 kB
JSON
{
"type": "File",
"start": 0,
"end": 3496,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 135,
"column": 1
}
},
"program": {
"type": "Program",
"start": 0,
"end": 3496,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 135,
"column": 1
}
},
"sourceType": "module",
"body": [
{
"type": "ExportDefaultDeclaration",
"start": 80,
"end": 3496,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 135,
"column": 1
}
},
"declaration": {
"type": "ClassDeclaration",
"start": 95,
"end": 3496,
"loc": {
"start": {
"line": 4,
"column": 15
},
"end": {
"line": 135,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 101,
"end": 106,
"loc": {
"start": {
"line": 4,
"column": 21
},
"end": {
"line": 4,
"column": 26
},
"identifierName": "Point"
},
"name": "Point",
"leadingComments": null
},
"superClass": null,
"body": {
"type": "ClassBody",
"start": 107,
"end": 3496,
"loc": {
"start": {
"line": 4,
"column": 27
},
"end": {
"line": 135,
"column": 1
}
},
"body": [
{
"type": "ClassMethod",
"start": 345,
"end": 654,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 27,
"column": 5
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 345,
"end": 356,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 12,
"column": 15
},
"identifierName": "constructor"
},
"name": "constructor",
"leadingComments": null
},
"kind": "constructor",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "AssignmentPattern",
"start": 357,
"end": 362,
"loc": {
"start": {
"line": 12,
"column": 16
},
"end": {
"line": 12,
"column": 21
}
},
"left": {
"type": "Identifier",
"start": 357,
"end": 358,
"loc": {
"start": {
"line": 12,
"column": 16
},
"end": {
"line": 12,
"column": 17
},
"identifierName": "x"
},
"name": "x"
},
"right": {
"type": "NumericLiteral",
"start": 361,
"end": 362,
"loc": {
"start": {
"line": 12,
"column": 20
},
"end": {
"line": 12,
"column": 21
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
},
{
"type": "AssignmentPattern",
"start": 364,
"end": 369,
"loc": {
"start": {
"line": 12,
"column": 23
},
"end": {
"line": 12,
"column": 28
}
},
"left": {
"type": "Identifier",
"start": 364,
"end": 365,
"loc": {
"start": {
"line": 12,
"column": 23
},
"end": {
"line": 12,
"column": 24
},
"identifierName": "y"
},
"name": "y"
},
"right": {
"type": "NumericLiteral",
"start": 368,
"end": 369,
"loc": {
"start": {
"line": 12,
"column": 27
},
"end": {
"line": 12,
"column": 28
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
},
{
"type": "AssignmentPattern",
"start": 371,
"end": 376,
"loc": {
"start": {
"line": 12,
"column": 30
},
"end": {
"line": 12,
"column": 35
}
},
"left": {
"type": "Identifier",
"start": 371,
"end": 372,
"loc": {
"start": {
"line": 12,
"column": 30
},
"end": {
"line": 12,
"column": 31
},
"identifierName": "z"
},
"name": "z"
},
"right": {
"type": "NumericLiteral",
"start": 375,
"end": 376,
"loc": {
"start": {
"line": 12,
"column": 34
},
"end": {
"line": 12,
"column": 35
}
},
"extra": {
"rawValue": 0,
"raw": "0"
},
"value": 0
}
}
],
"body": {
"type": "BlockStatement",
"start": 378,
"end": 654,
"loc": {
"start": {
"line": 12,
"column": 37
},
"end": {
"line": 27,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 457,
"end": 468,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 19
}
},
"expression": {
"type": "AssignmentExpression",
"start": 457,
"end": 467,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 18
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 457,
"end": 463,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 14
}
},
"object": {
"type": "ThisExpression",
"start": 457,
"end": 461,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 12
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 462,
"end": 463,
"loc": {
"start": {
"line": 16,
"column": 13
},
"end": {
"line": 16,
"column": 14
},
"identifierName": "x"
},
"name": "x"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 466,
"end": 467,
"loc": {
"start": {
"line": 16,
"column": 17
},
"end": {
"line": 16,
"column": 18
},
"identifierName": "x"
},
"name": "x"
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * {number} X position of the point.\n ",
"start": 388,
"end": 448,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 15,
"column": 11
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * {number} Y position of the point.\n ",
"start": 478,
"end": 538,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 20,
"column": 11
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 548,
"end": 559,
"loc": {
"start": {
"line": 22,
"column": 8
},
"end": {
"line": 22,
"column": 19
}
},
"expression": {
"type": "AssignmentExpression",
"start": 548,
"end": 558,
"loc": {
"start": {
"line": 22,
"column": 8
},
"end": {
"line": 22,
"column": 18
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 548,
"end": 554,
"loc": {
"start": {
"line": 22,
"column": 8
},
"end": {
"line": 22,
"column": 14
}
},
"object": {
"type": "ThisExpression",
"start": 548,
"end": 552,
"loc": {
"start": {
"line": 22,
"column": 8
},
"end": {
"line": 22,
"column": 12
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 553,
"end": 554,
"loc": {
"start": {
"line": 22,
"column": 13
},
"end": {
"line": 22,
"column": 14
},
"identifierName": "y"
},
"name": "y"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 557,
"end": 558,
"loc": {
"start": {
"line": 22,
"column": 17
},
"end": {
"line": 22,
"column": 18
},
"identifierName": "y"
},
"name": "y"
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * {number} Y position of the point.\n ",
"start": 478,
"end": 538,
"loc": {
"start": {
"line": 18,
"column": 8
},
"end": {
"line": 20,
"column": 11
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * {number} Z position of the point.\n ",
"start": 568,
"end": 628,
"loc": {
"start": {
"line": 23,
"column": 8
},
"end": {
"line": 25,
"column": 11
}
}
}
]
},
{
"type": "ExpressionStatement",
"start": 637,
"end": 648,
"loc": {
"start": {
"line": 26,
"column": 8
},
"end": {
"line": 26,
"column": 19
}
},
"expression": {
"type": "AssignmentExpression",
"start": 637,
"end": 647,
"loc": {
"start": {
"line": 26,
"column": 8
},
"end": {
"line": 26,
"column": 18
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 637,
"end": 643,
"loc": {
"start": {
"line": 26,
"column": 8
},
"end": {
"line": 26,
"column": 14
}
},
"object": {
"type": "ThisExpression",
"start": 637,
"end": 641,
"loc": {
"start": {
"line": 26,
"column": 8
},
"end": {
"line": 26,
"column": 12
}
},
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 642,
"end": 643,
"loc": {
"start": {
"line": 26,
"column": 13
},
"end": {
"line": 26,
"column": 14
},
"identifierName": "z"
},
"name": "z"
},
"computed": false,
"leadingComments": null
},
"right": {
"type": "Identifier",
"start": 646,
"end": 647,
"loc": {
"start": {
"line": 26,
"column": 17
},
"end": {
"line": 26,
"column": 18
},
"identifierName": "z"
},
"name": "z"
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * {number} Z position of the point.\n ",
"start": 568,
"end": 628,
"loc": {
"start": {
"line": 23,
"column": 8
},
"end": {
"line": 25,
"column": 11
}
}
}
]
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * An x, y, z point. Default parameters are set as 0.\n * \n * @param {number} x X position of the point.\n * @param {number} y Y position of the point.\n * @param {number} z Z position of the point.\n ",
"start": 113,
"end": 340,
"loc": {
"start": {
"line": 5,
"column": 4
},
"end": {
"line": 11,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Sets the point to a new x, y, z. Previous values are set\n * as default parameters.\n * \n * @param {number} x X position of the point.\n * @param {number} y Y position of the point.\n * @param {number} z Z position of the point.\n ",
"start": 664,
"end": 927,
"loc": {
"start": {
"line": 29,
"column": 4
},
"end": {
"line": 36,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 932,
"end": 1039,
"loc": {
"start": {
"line": 37,
"column": 4
},
"end": {
"line": 41,
"column": 5
}
},
"static": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 932,
"end": 935,
"loc": {
"start": {
"line": 37,
"column": 4
},
"end": {
"line": 37,
"column": 7
},
"identifierName": "set"
},
"name": "set",
"leadingComments": null
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "AssignmentPattern",
"start": 936,
"end": 946,
"loc": {
"start": {
"line": 37,
"column": 8
},
"end": {
"line": 37,
"column": 18
}
},
"left": {
"type": "Identifier",
"start": 936,
"end": 937,
"loc": {
"start": {
"line": 37,
"column": 8
},
"end": {
"line": 37,
"column": 9
},
"identifierName": "x"
},
"name": "x"
},
"right": {
"type": "MemberExpression",
"start": 940,
"end": 946,
"loc": {
"start": {
"line": 37,
"column": 12
},
"end": {
"line": 37,
"column": 18
}
},
"object": {
"type": "ThisExpression",
"start": 940,
"end": 944,
"loc": {
"start": {
"line": 37,
"column": 12
},
"end": {
"line": 37,
"column": 16
}
}
},
"property": {
"type": "Identifier",
"start": 945,
"end": 946,
"loc": {
"start": {
"line": 37,
"column": 17
},
"end": {
"line": 37,
"column": 18
},
"identifierName": "x"
},
"name": "x"
},
"computed": false
}
},
{
"type": "AssignmentPattern",
"start": 948,
"end": 958,
"loc": {
"start": {
"line": 37,
"column": 20
},
"end": {
"line": 37,
"column": 30
}
},
"left": {
"type": "Identifier",
"start": 948,
"end": 949,
"loc": {
"start": {
"line": 37,
"column": 20
},
"end": {
"line": 37,
"column": 21
},
"identifierName": "y"
},
"name": "y"
},
"right": {
"type": "MemberExpression",
"start": 952,
"end": 958,
"loc": {
"start": {
"line": 37,
"column": 24
},
"end": {
"line": 37,
"column": 30
}
},
"object": {
"type": "ThisExpression",
"start": 952,
"end": 956,
"loc": {
"start": {
"line": 37,
"column": 24
},
"end": {
"line": 37,
"column": 28
}
}
},
"property": {
"type": "Identifier",
"start": 957,
"end": 958,
"loc": {
"start": {
"line": 37,
"column": 29
},
"end": {
"line": 37,
"column": 30
},
"identifierName": "y"
},
"name": "y"
},
"computed": false
}
},
{
"type": "AssignmentPattern",
"start": 960,
"end": 970,
"loc": {
"start": {
"line": 37,
"column": 32
},
"end": {
"line": 37,
"column": 42
}
},
"left": {
"type": "Identifier",
"start": 960,
"end": 961,
"loc": {
"start": {
"line": 37,
"column": 32
},
"end": {
"line": 37,
"column": 33
},
"identifierName": "z"
},
"name": "z"
},
"right": {
"type": "MemberExpression",
"start": 964,
"end": 970,
"loc": {
"start": {
"line": 37,
"column": 36
},
"end": {
"line": 37,
"column": 42
}
},
"object": {
"type": "ThisExpression",
"start": 964,
"end": 968,
"loc": {
"start": {
"line": 37,
"column": 36
},
"end": {
"line": 37,
"column": 40
}
}
},
"property": {
"type": "Identifier",
"start": 969,
"end": 970,
"loc": {
"start": {
"line": 37,
"column": 41
},
"end": {
"line": 37,
"column": 42
},
"identifierName": "z"
},
"name": "z"
},
"computed": false
}
}
],
"body": {
"type": "BlockStatement",
"start": 972,
"end": 1039,
"loc": {
"start": {
"line": 37,
"column": 44
},
"end": {
"line": 41,
"column": 5
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 982,
"end": 993,
"loc": {
"start": {
"line": 38,
"column": 8
},
"end": {
"line": 38,
"column": 19
}
},
"expression": {
"type": "AssignmentExpression",
"start": 982,
"end": 992,
"loc": {
"start": {
"line": 38,
"column": 8
},
"end": {
"line": 38,
"column": 18
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 982,
"end": 988,
"loc": {
"start": {
"line": 38,
"column": 8
},
"end": {
"line": 38,
"column": 14
}
},
"object": {
"type": "ThisExpression",
"start": 982,
"end": 986,
"loc": {
"start": {
"line": 38,
"column": 8
},
"end": {
"line": 38,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 987,
"end": 988,
"loc": {
"start": {
"line": 38,
"column": 13
},
"end": {
"line": 38,
"column": 14
},
"identifierName": "x"
},
"name": "x"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 991,
"end": 992,
"loc": {
"start": {
"line": 38,
"column": 17
},
"end": {
"line": 38,
"column": 18
},
"identifierName": "x"
},
"name": "x"
}
}
},
{
"type": "ExpressionStatement",
"start": 1002,
"end": 1013,
"loc": {
"start": {
"line": 39,
"column": 8
},
"end": {
"line": 39,
"column": 19
}
},
"expression": {
"type": "AssignmentExpression",
"start": 1002,
"end": 1012,
"loc": {
"start": {
"line": 39,
"column": 8
},
"end": {
"line": 39,
"column": 18
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 1002,
"end": 1008,
"loc": {
"start": {
"line": 39,
"column": 8
},
"end": {
"line": 39,
"column": 14
}
},
"object": {
"type": "ThisExpression",
"start": 1002,
"end": 1006,
"loc": {
"start": {
"line": 39,
"column": 8
},
"end": {
"line": 39,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 1007,
"end": 1008,
"loc": {
"start": {
"line": 39,
"column": 13
},
"end": {
"line": 39,
"column": 14
},
"identifierName": "y"
},
"name": "y"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 1011,
"end": 1012,
"loc": {
"start": {
"line": 39,
"column": 17
},
"end": {
"line": 39,
"column": 18
},
"identifierName": "y"
},
"name": "y"
}
}
},
{
"type": "ExpressionStatement",
"start": 1022,
"end": 1033,
"loc": {
"start": {
"line": 40,
"column": 8
},
"end": {
"line": 40,
"column": 19
}
},
"expression": {
"type": "AssignmentExpression",
"start": 1022,
"end": 1032,
"loc": {
"start": {
"line": 40,
"column": 8
},
"end": {
"line": 40,
"column": 18
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 1022,
"end": 1028,
"loc": {
"start": {
"line": 40,
"column": 8
},
"end": {
"line": 40,
"column": 14
}
},
"object": {
"type": "ThisExpression",
"start": 1022,
"end": 1026,
"loc": {
"start": {
"line": 40,
"column": 8
},
"end": {
"line": 40,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"start": 1027,
"end": 1028,
"loc": {
"start": {
"line": 40,
"column": 13
},
"end": {
"line": 40,
"column": 14
},
"identifierName": "z"
},
"name": "z"
},
"computed": false
},
"right": {
"type": "Identifier",
"start": 1031,
"end": 1032,
"loc": {
"start": {
"line": 40,
"column": 17
},
"end": {
"line": 40,
"column": 18
},
"identifierName": "z"
},
"name": "z"
}
}
}
],
"directives": [],
"trailingComments": null
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "*\n * Sets the point to a new x, y, z. Previous values are set\n * as default parameters.\n * \n * @param {number} x X position of the point.\n * @param {number} y Y position of the point.\n * @param {number} z Z position of the point.\n ",
"start": 664,
"end": 927,
"loc": {
"start": {
"line": 29,
"column": 4
},
"end": {
"line": 36,
"column": 7
}
}
}
],
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Returns a copy of a point.\n * \n * @param {Point} point Point to copy.\n ",
"start": 1045,
"end": 1141,
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 47,
"column": 7
}
}
}
]
},
{
"type": "ClassMethod",
"start": 1146,
"end": 1225,
"loc": {
"start": {
"line": 48,
"column": 4
},
"end": {
"line": 50,
"column": 5
}
},
"static": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 1153,
"end": 1157,
"loc": {
"start": {
"line": 48,
"column": 11
},
"end": {
"line": 48,
"column": 15
},
"identifierName": "copy"
},
"name": "copy"
},
"kind": "method",
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 1158,
"end": 1163,
"loc": {
"start": {
"line": 48,
"column": 16
},
"end": {
"line": 48,
"column": 21
},
"identifierName": "point"
},
"name": "point"
}
],
"body": {
"type": "BlockStatement",
"start": 1165,
"end": 1225,
"loc": {
"start": {
"line": 48,
"column": 23
},
"end": {
"line": 50,
"column": 5
}
},
"body": [
{
"type": "ReturnStatement",
"start": 1175,
"end": 1219,
"loc": {