Unnamed 3D Platformer
@Stage\n\nwhen I receive [system: rendering tick v]\nswitch backdrop to (Current Level)\n\nwhen I receive [end credits v]\nswitch backdrop to (skybox 4 v)\n\n@Controller\n\nwhen flag clicked\nset [current level v] to [1]\nbroadcast (Init: Objects v) and wait\nbroadcast (Init: Collisions v) and wait\nbroadcast (Init: Player v) and wait\nbroadcast (Init: Renderer v) and wait\nwait (0) seconds\nbroadcast (System: Loaded v)\n\nwhen I receive [system: loaded v]\nforever\n    broadcast (System: Update Player v) and wait\n    broadcast (System: Update Objects v) and wait\n    broadcast (System: Rendering Tick v) and wait\n    if <(Touching Flag?) = [1]> then\n        broadcast (Course Cleared v)\n    end\nend\n\nwhen I receive [course cleared v]\nstop [other scripts in sprite v]\nchange [current level v] by (1)\nif <(Current Level) = [5]> then\n    erase all\n    broadcast (End Credits v) and wait\nelse\n    broadcast (Init: Objects v) and wait\n    broadcast (Init: Collisions v) and wait\n    broadcast (Init: Player v) and wait\n    wait (0) seconds\n    broadcast (System: Loaded v)\nend\n\n@Objects\n\ndefine Add Point (x) (y) (z)\nadd (x) to [point data: x v]\nadd (y) to [point data: y v]\nadd (z) to [point data: z v]\nchange [point index v] by (1)\n\ndefine Add Triangle Surface (p1) (p2) (p3) Color (r) (g) (b)\nadd ((p1) + (Number of Points)) to [surfaces: p1 v]\nadd ((p2) + (Number of Points)) to [surfaces: p2 v]\nadd ((p3) + (Number of Points)) to [surfaces: p3 v]\nadd [] to [surfaces: diameter v]\nadd [1] to [surfaces: type v]\nadd (r) to [surfaces: r v]\nadd (g) to [surfaces: g v]\nadd (b) to [surfaces: b v]\n\ndefine Clear Object Data\ndelete all of [objects: x v]\ndelete all of [objects: y v]\ndelete all of [objects: z v]\ndelete all of [objects: rot x v]\ndelete all of [objects: rot y v]\ndelete all of [objects: rot z v]\ndelete all of [objects: point index v]\ndelete all of [objects: sign? v]\ndelete all of [signs: text # v]\ndelete all of [objects: enemy? v]\ndelete all of [enemies: x1 v]\ndelete all of [enemies: y1 v]\ndelete all of [enemies: z1 v]\ndelete all of [enemies: x2 v]\ndelete all of [enemies: y2 v]\ndelete all of [enemies: z2 v]\ndelete all of [objects: coin? v]\ndelete all of [objects: flag? v]\ndelete all of [point data: x v]\ndelete all of [point data: y v]\ndelete all of [point data: z v]\ndelete all of [surfaces: p1 v]\ndelete all of [surfaces: p2 v]\ndelete all of [surfaces: p3 v]\ndelete all of [surfaces: diameter v]\ndelete all of [surfaces: type v]\ndelete all of [surfaces: r v]\ndelete all of [surfaces: g v]\ndelete all of [surfaces: b v]\n\nwhen I receive [init: objects v]\nClear Object Data\nif <(Current Level) = [1]> then\n    Init Player\n    Init Level 1\n    Init Sign [-30] [100] [0] [0] [90] [0] Text # [1]\n    Init Sign [-30] [100] [100] [0] [90] [0] Text # [2]\n    Init Sign [-30] [100] [300] [0] [90] [0] Text # [3]\n    Init Sign [-200] [150] [430] [0] [0] [0] Text # [4]\n    Init Enemy [-400] [220] [650] [-400] [220] [450]\n    Init Flag [-200] [250] [700]\nend\nif <(Current Level) = [2]> then\n    Init Player\n    Init Level 2\n    Init Sign [-30] [100] [0] [0] [90] [0] Text # [5]\n    Init Sign [100] [400] [220] [0] [0] [0] Text # [6]\n    Init Coin [225] [425] [300]\n    Init Coin [225] [425] [350]\n    Init Coin [225] [425] [400]\n    Init Enemy [-125] [470] [600] [-275] [470] [600]\n    Init Flag [-250] [500] [800]\nend\nif <(Current Level) = [3]> then\n    Init Player\n    Init Level 3\n    Init Coin [25] [175] [200]\n    Init Coin [150] [250] [350]\n    Init Coin [300] [325] [175]\n    Init Sign [150] [400] [145] [0] [0] [0] Text # [7]\n    Init Enemy [-100] [420] [125] [-250] [420] [125]\n    Init Enemy [-225] [445] [450] [-225] [445] [300]\n    Init Enemy [50] [470] [550] [-100] [470] [550]\n    Init Flag [200] [475] [650]\nend\nif <(Current Level) = [4]> then\n    Init Player\n    Init Level 4\n    Init Sign [-30] [175] [200] [0] [90] [0] Text # [8]\n    Init Enemy [0] [270] [375] [0] [270] [525]\n    Init Enemy [325] [345] [500] [175] [345] [500]\n    Init Coin [350] [400] [300]\n    Init Coin [350] [475] [100]\n    Init Flag [300] [550] [-100]\nend\n\ndefine Begin Object (x) (y) (z) (rot x) (rot y) (rot z)\nadd (x) to [objects: x v]\nadd (y) to [objects: y v]\nadd (z) to [objects: z v]\nadd (rot x) to [objects: rot x v]\nadd (rot y) to [objects: rot y v]\nadd (rot z) to [objects: rot z v]\nset [point index v] to [0]\nset [number of points v] to (length of [point data: x v])\n\ndefine End Object <sign?> <enemy?> <coin?> <flag?>\nadd (Point Index) to [objects: point index v]\nadd (<sign?> + ()) to [objects: sign? v]\nadd (<enemy?> + ()) to [objects: enemy? v]\nadd (<coin?> + ()) to [objects: coin? v]\nadd (<flag?> + ()) to [objects: flag? v]\nif <not <sign?>> then\n    add [] to [signs: text # v]\nend\nif <not <enemy?>> then\n    add [] to [enemies: x1 v]\n    add [] to [enemies: y1 v]\n    add [] to [enemies: z1 v]\n    add [] to [enemies: x2 v]\n    add [] to [enemies: y2 v]\n    add [] to [enemies: z2 v]\nend\n\ndefine Init Player\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [20] [20] [20]\nAdd Point [20] [-20] [20]\nAdd Point [-20] [-20] [20]\nAdd Point [-20] [20] [20]\nAdd Point [20] [20] [-20]\nAdd Point [20] [-20] [-20]\nAdd Point [-20] [-20] [-20]\nAdd Point [-20] [20] [-20]\nAdd Triangle Surface [1] [2] [6] Color [0] [0] [255]\nAdd Triangle Surface [6] [5] [1] Color [0] [0] [255]\nAdd Triangle Surface [3] [4] [8] Color [0] [0] [255]\nAdd Triangle Surface [8] [7] [3] Color [0] [0] [255]\nAdd Triangle Surface [8] [4] [1] Color [0] [0] [255]\nAdd Triangle Surface [1] [5] [8] Color [0] [0] [255]\nAdd Triangle Surface [3] [2] [1] Color [0] [0] [255]\nAdd Triangle Surface [1] [4] [3] Color [0] [0] [255]\nAdd Triangle Surface [5] [6] [7] Color [0] [0] [255]\nAdd Triangle Surface [7] [8] [5] Color [0] [0] [255]\nEnd Object <> <> <> <>\n\nClear Object Data\n\ndefine Init Sign (x) (y) (z) (rot x) (rot y) (rot z) Text # (text #)\nBegin Object (x) (y) (z) (rot x) (rot y) (rot z)\nAdd Point [30] [50] [5]\nAdd Point [30] [10] [5]\nAdd Point [-30] [10] [5]\nAdd Point [-30] [50] [5]\nAdd Point [30] [50] [-5]\nAdd Point [30] [10] [-5]\nAdd Point [-30] [10] [-5]\nAdd Point [-30] [50] [-5]\nAdd Point [5] [10] [5]\nAdd Point [5] [0] [5]\nAdd Point [-5] [0] [5]\nAdd Point [-5] [10] [5]\nAdd Point [5] [10] [-5]\nAdd Point [5] [0] [-5]\nAdd Point [-5] [0] [-5]\nAdd Point [-5] [10] [-5]\nAdd Triangle Surface [1] [2] [6] Color [139] [69] [19]\nAdd Triangle Surface [6] [5] [1] Color [139] [69] [19]\nAdd Triangle Surface [3] [4] [8] Color [139] [69] [19]\nAdd Triangle Surface [8] [7] [3] Color [139] [69] [19]\nAdd Triangle Surface [8] [4] [1] Color [139] [69] [45]\nAdd Triangle Surface [1] [5] [8] Color [139] [69] [45]\nAdd Triangle Surface [2] [3] [7] Color [139] [69] [45]\nAdd Triangle Surface [7] [6] [2] Color [139] [69] [45]\nAdd Triangle Surface [3] [2] [1] Color [139] [69] [45]\nAdd Triangle Surface [1] [4] [3] Color [139] [69] [45]\nAdd Triangle Surface [5] [6] [7] Color [139] [69] [45]\nAdd Triangle Surface [7] [8] [5] Color [139] [69] [45]\nAdd Triangle Surface [9] [10] [14] Color [205] [133] [63]\nAdd Triangle Surface [14] [13] [9] Color [205] [133] [63]\nAdd Triangle Surface [11] [12] [16] Color [205] [133] [63]\nAdd Triangle Surface [16] [15] [11] Color [205] [133] [63]\nAdd Triangle Surface [11] [10] [9] Color [205] [133] [63]\nAdd Triangle Surface [9] [12] [11] Color [205] [133] [63]\nAdd Triangle Surface [13] [14] [15] Color [205] [133] [63]\nAdd Triangle Surface [15] [16] [13] Color [205] [133] [63]\nEnd Object  <> <> <>\nadd (text #) to [signs: text # v]\n\ndefine Init Enemy (x1) (y1) (z1) (x2) (y2) (z2)\nBegin Object (x1) (y1) (z1) [0] [0] [0]\nAdd Point [20] [20] [20]\nAdd Point [20] [-20] [20]\nAdd Point [-20] [-20] [20]\nAdd Point [-20] [20] [20]\nAdd Point [20] [20] [-20]\nAdd Point [20] [-20] [-20]\nAdd Point [-20] [-20] [-20]\nAdd Point [-20] [20] [-20]\nAdd Triangle Surface [1] [2] [6] Color [255] [0] [0]\nAdd Triangle Surface [6] [5] [1] Color [255] [0] [0]\nAdd Triangle Surface [3] [4] [8] Color [255] [0] [0]\nAdd Triangle Surface [8] [7] [3] Color [255] [0] [0]\nAdd Triangle Surface [8] [4] [1] Color [255] [0] [0]\nAdd Triangle Surface [1] [5] [8] Color [255] [0] [0]\nAdd Triangle Surface [3] [2] [1] Color [255] [0] [0]\nAdd Triangle Surface [1] [4] [3] Color [255] [0] [0]\nAdd Triangle Surface [5] [6] [7] Color [255] [0] [0]\nAdd Triangle Surface [7] [8] [5] Color [255] [0] [0]\nEnd Object <>  <> <>\nadd (x1) to [enemies: x1 v]\nadd (y1) to [enemies: y1 v]\nadd (z1) to [enemies: z1 v]\nadd (x2) to [enemies: x2 v]\nadd (y2) to [enemies: y2 v]\nadd (z2) to [enemies: z2 v]\n\ndefine Init Coin (x) (y) (z)\nBegin Object (x) (y) (z) [0] [0] [0]\nAdd Point [20] [32] [0]\nAdd Point [10] [16] [0]\nAdd Point [-10] [16] [0]\nAdd Point [-20] [32] [0]\nAdd Point [-10] [50] [0]\nAdd Point [10] [50] [0]\nAdd Triangle Surface [1] [2] [3] Color [255] [215] [0]\nAdd Triangle Surface [3] [4] [5] Color [255] [215] [0]\nAdd Triangle Surface [5] [6] [1] Color [255] [215] [0]\nAdd Triangle Surface [1] [3] [5] Color [255] [215] [0]\nAdd Triangle Surface [3] [2] [1] Color [255] [215] [0]\nAdd Triangle Surface [5] [4] [3] Color [255] [215] [0]\nAdd Triangle Surface [1] [6] [5] Color [255] [215] [0]\nAdd Triangle Surface [5] [3] [1] Color [255] [215] [0]\nEnd Object <> <>  <>\n\ndefine Add Line Surface (p1) (p2) Width (width) Color (r) (g) (b)\nadd ((p1) + (Number of Points)) to [surfaces: p1 v]\nadd ((p2) + (Number of Points)) to [surfaces: p2 v]\nadd [] to [surfaces: p3 v]\nadd (width) to [surfaces: diameter v]\nadd [2] to [surfaces: type v]\nadd (r) to [surfaces: r v]\nadd (g) to [surfaces: g v]\nadd (b) to [surfaces: b v]\n\ndefine Add Sphere Surface (point) Diameter (diameter) Color (r) (g) (b)\nadd ((point) + (Number of Points)) to [surfaces: p1 v]\nadd [] to [surfaces: p2 v]\nadd [] to [surfaces: p3 v]\nadd (diameter) to [surfaces: diameter v]\nadd [3] to [surfaces: type v]\nadd (r) to [surfaces: r v]\nadd (g) to [surfaces: g v]\nadd (b) to [surfaces: b v]\n\ndefine Init Flag (x) (y) (z)\nBegin Object (x) (y) (z) [0] [0] [0]\nAdd Point [0] [0] [0]\nAdd Point [0] [70] [0]\nAdd Point [0] [65] [0]\nAdd Point [0] [45] [0]\nAdd Point [30] [55] [0]\nAdd Line Surface [1] [2] Width [5] Color [205] [133] [63]\nAdd Triangle Surface [5] [4] [3] Color [255] [0] [0]\nAdd Triangle Surface [3] [4] [5] Color [255] [0] [0]\nEnd Object <> <> <> \n\ndefine Init Level 1\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [50] [100] [150]\nAdd Point [50] [0] [150]\nAdd Point [-50] [0] [150]\nAdd Point [-50] [100] [150]\nAdd Point [50] [100] [-50]\nAdd Point [50] [0] [-50]\nAdd Point [-50] [0] [-50]\nAdd Point [-50] [100] [-50]\nAdd Triangle Surface [1] [2] [6] Color [160] [82] [45]\nAdd Triangle Surface [6] [5] [1] Color [160] [82] [45]\nAdd Triangle Surface [3] [4] [8] Color [160] [82] [45]\nAdd Triangle Surface [8] [7] [3] Color [160] [82] [45]\nAdd Triangle Surface [8] [4] [1] Color [50] [205] [50]\nAdd Triangle Surface [1] [5] [8] Color [50] [205] [50]\nAdd Triangle Surface [3] [2] [1] Color [160] [82] [45]\nAdd Triangle Surface [1] [4] [3] Color [160] [82] [45]\nAdd Triangle Surface [5] [6] [7] Color [160] [82] [45]\nAdd Triangle Surface [7] [8] [5] Color [160] [82] [45]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [50] [100] [500]\nAdd Point [50] [0] [500]\nAdd Point [-50] [0] [500]\nAdd Point [-50] [100] [500]\nAdd Point [50] [100] [250]\nAdd Point [50] [0] [250]\nAdd Point [-50] [0] [250]\nAdd Point [-50] [100] [250]\nAdd Triangle Surface [1] [2] [6] Color [160] [82] [45]\nAdd Triangle Surface [6] [5] [1] Color [160] [82] [45]\nAdd Triangle Surface [3] [4] [8] Color [160] [82] [45]\nAdd Triangle Surface [8] [7] [3] Color [160] [82] [45]\nAdd Triangle Surface [8] [4] [1] Color [50] [205] [50]\nAdd Triangle Surface [1] [5] [8] Color [50] [205] [50]\nAdd Triangle Surface [3] [2] [1] Color [160] [82] [45]\nAdd Triangle Surface [1] [4] [3] Color [160] [82] [45]\nAdd Triangle Surface [5] [6] [7] Color [160] [82] [45]\nAdd Triangle Surface [7] [8] [5] Color [160] [82] [45]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [-50] [150] [500]\nAdd Point [-50] [0] [500]\nAdd Point [-250] [0] [500]\nAdd Point [-250] [150] [500]\nAdd Point [-50] [150] [400]\nAdd Point [-50] [0] [400]\nAdd Point [-250] [0] [400]\nAdd Point [-250] [150] [400]\nAdd Triangle Surface [1] [2] [6] Color [160] [82] [45]\nAdd Triangle Surface [6] [5] [1] Color [160] [82] [45]\nAdd Triangle Surface [3] [4] [8] Color [160] [82] [45]\nAdd Triangle Surface [8] [7] [3] Color [160] [82] [45]\nAdd Triangle Surface [8] [4] [1] Color [50] [205] [50]\nAdd Triangle Surface [1] [5] [8] Color [50] [205] [50]\nAdd Triangle Surface [3] [2] [1] Color [160] [82] [45]\nAdd Triangle Surface [1] [4] [3] Color [160] [82] [45]\nAdd Triangle Surface [5] [6] [7] Color [160] [82] [45]\nAdd Triangle Surface [7] [8] [5] Color [160] [82] [45]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [-350] [200] [700]\nAdd Point [-350] [0] [700]\nAdd Point [-450] [0] [700]\nAdd Point [-450] [200] [700]\nAdd Point [-350] [200] [400]\nAdd Point [-350] [0] [400]\nAdd Point [-450] [0] [400]\nAdd Point [-450] [200] [400]\nAdd Triangle Surface [1] [2] [6] Color [160] [82] [45]\nAdd Triangle Surface [6] [5] [1] Color [160] [82] [45]\nAdd Triangle Surface [3] [4] [8] Color [160] [82] [45]\nAdd Triangle Surface [8] [7] [3] Color [160] [82] [45]\nAdd Triangle Surface [8] [4] [1] Color [50] [205] [50]\nAdd Triangle Surface [1] [5] [8] Color [50] [205] [50]\nAdd Triangle Surface [3] [2] [1] Color [160] [82] [45]\nAdd Triangle Surface [1] [4] [3] Color [160] [82] [45]\nAdd Triangle Surface [5] [6] [7] Color [160] [82] [45]\nAdd Triangle Surface [7] [8] [5] Color [160] [82] [45]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [-150] [250] [750]\nAdd Point [-150] [0] [750]\nAdd Point [-250] [0] [750]\nAdd Point [-250] [250] [750]\nAdd Point [-150] [250] [650]\nAdd Point [-150] [0] [650]\nAdd Point [-250] [0] [650]\nAdd Point [-250] [250] [650]\nAdd Triangle Surface [1] [2] [6] Color [160] [82] [45]\nAdd Triangle Surface [6] [5] [1] Color [160] [82] [45]\nAdd Triangle Surface [3] [4] [8] Color [160] [82] [45]\nAdd Triangle Surface [8] [7] [3] Color [160] [82] [45]\nAdd Triangle Surface [8] [4] [1] Color [50] [205] [50]\nAdd Triangle Surface [1] [5] [8] Color [50] [205] [50]\nAdd Triangle Surface [3] [2] [1] Color [160] [82] [45]\nAdd Triangle Surface [1] [4] [3] Color [160] [82] [45]\nAdd Triangle Surface [5] [6] [7] Color [160] [82] [45]\nAdd Triangle Surface [7] [8] [5] Color [160] [82] [45]\nEnd Object <> <> <> <>\n\ndefine Init Level 2\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [50] [100] [50]\nAdd Point [50] [0] [50]\nAdd Point [-50] [0] [50]\nAdd Point [-50] [100] [50]\nAdd Point [50] [100] [-50]\nAdd Point [50] [0] [-50]\nAdd Point [-50] [0] [-50]\nAdd Point [-50] [100] [-50]\nAdd Triangle Surface [1] [2] [6] Color [204] [163] [102]\nAdd Triangle Surface [6] [5] [1] Color [204] [163] [102]\nAdd Triangle Surface [3] [4] [8] Color [204] [163] [102]\nAdd Triangle Surface [8] [7] [3] Color [204] [163] [102]\nAdd Triangle Surface [8] [4] [1] Color [248] [204] [127]\nAdd Triangle Surface [1] [5] [8] Color [248] [204] [127]\nAdd Triangle Surface [3] [2] [1] Color [204] [163] [102]\nAdd Triangle Surface [1] [4] [3] Color [204] [163] [102]\nAdd Triangle Surface [5] [6] [7] Color [204] [163] [102]\nAdd Triangle Surface [7] [8] [5] Color [204] [163] [102]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [50] [150] [250]\nAdd Point [50] [0] [250]\nAdd Point [-50] [0] [250]\nAdd Point [-50] [150] [250]\nAdd Point [50] [150] [150]\nAdd Point [50] [0] [150]\nAdd Point [-50] [0] [150]\nAdd Point [-50] [150] [150]\nAdd Triangle Surface [8] [4] [1] Color [248] [204] [127]\nAdd Triangle Surface [1] [5] [8] Color [248] [204] [127]\nAdd Triangle Surface [3] [2] [1] Color [204] [163] [102]\nAdd Triangle Surface [1] [4] [3] Color [204] [163] [102]\nAdd Triangle Surface [5] [6] [7] Color [204] [163] [102]\nAdd Triangle Surface [7] [8] [5] Color [204] [163] [102]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [150] [400] [250]\nAdd Point [150] [0] [250]\nAdd Point [50] [0] [250]\nAdd Point [50] [400] [250]\nAdd Point [150] [400] [150]\nAdd Point [150] [0] [150]\nAdd Point [50] [0] [150]\nAdd Point [50] [400] [150]\nAdd Triangle Surface [1] [2] [6] Color [204] [163] [102]\nAdd Triangle Surface [6] [5] [1] Color [204] [163] [102]\nAdd Triangle Surface [3] [4] [8] Color [204] [163] [102]\nAdd Triangle Surface [8] [7] [3] Color [204] [163] [102]\nAdd Triangle Surface [8] [4] [1] Color [248] [204] [127]\nAdd Triangle Surface [1] [5] [8] Color [248] [204] [127]\nAdd Triangle Surface [3] [2] [1] Color [204] [163] [102]\nAdd Triangle Surface [1] [4] [3] Color [204] [163] [102]\nAdd Triangle Surface [5] [6] [7] Color [204] [163] [102]\nAdd Triangle Surface [7] [8] [5] Color [204] [163] [102]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [-50] [350] [250]\nAdd Point [-50] [0] [250]\nAdd Point [-150] [0] [250]\nAdd Point [-150] [350] [250]\nAdd Point [-50] [350] [150]\nAdd Point [-50] [0] [150]\nAdd Point [-150] [0] [150]\nAdd Point [-150] [350] [150]\nAdd Triangle Surface [1] [2] [6] Color [204] [163] [102]\nAdd Triangle Surface [6] [5] [1] Color [204] [163] [102]\nAdd Triangle Surface [3] [4] [8] Color [204] [163] [102]\nAdd Triangle Surface [8] [7] [3] Color [204] [163] [102]\nAdd Triangle Surface [8] [4] [1] Color [248] [204] [127]\nAdd Triangle Surface [1] [5] [8] Color [248] [204] [127]\nAdd Triangle Surface [3] [2] [1] Color [204] [163] [102]\nAdd Triangle Surface [1] [4] [3] Color [204] [163] [102]\nAdd Triangle Surface [5] [6] [7] Color [204] [163] [102]\nAdd Triangle Surface [7] [8] [5] Color [204] [163] [102]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [275] [425] [450]\nAdd Point [275] [0] [450]\nAdd Point [175] [0] [450]\nAdd Point [175] [425] [450]\nAdd Point [275] [425] [250]\nAdd Point [275] [0] [250]\nAdd Point [175] [0] [250]\nAdd Point [175] [425] [250]\nAdd Triangle Surface [1] [2] [6] Color [204] [163] [102]\nAdd Triangle Surface [6] [5] [1] Color [204] [163] [102]\nAdd Triangle Surface [3] [4] [8] Color [204] [163] [102]\nAdd Triangle Surface [8] [7] [3] Color [204] [163] [102]\nAdd Triangle Surface [8] [4] [1] Color [248] [204] [127]\nAdd Triangle Surface [1] [5] [8] Color [248] [204] [127]\nAdd Triangle Surface [3] [2] [1] Color [204] [163] [102]\nAdd Triangle Surface [1] [4] [3] Color [204] [163] [102]\nAdd Triangle Surface [5] [6] [7] Color [204] [163] [102]\nAdd Triangle Surface [7] [8] [5] Color [204] [163] [102]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [150] [450] [650]\nAdd Point [150] [0] [650]\nAdd Point [50] [0] [650]\nAdd Point [50] [450] [650]\nAdd Point [150] [450] [550]\nAdd Point [150] [0] [550]\nAdd Point [50] [0] [550]\nAdd Point [50] [450] [550]\nAdd Triangle Surface [1] [2] [6] Color [204] [163] [102]\nAdd Triangle Surface [6] [5] [1] Color [204] [163] [102]\nAdd Triangle Surface [3] [4] [8] Color [204] [163] [102]\nAdd Triangle Surface [8] [7] [3] Color [204] [163] [102]\nAdd Triangle Surface [8] [4] [1] Color [248] [204] [127]\nAdd Triangle Surface [1] [5] [8] Color [248] [204] [127]\nAdd Triangle Surface [3] [2] [1] Color [204] [163] [102]\nAdd Triangle Surface [1] [4] [3] Color [204] [163] [102]\nAdd Triangle Surface [5] [6] [7] Color [204] [163] [102]\nAdd Triangle Surface [7] [8] [5] Color [204] [163] [102]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [50] [500] [650]\nAdd Point [50] [0] [650]\nAdd Point [0] [0] [650]\nAdd Point [0] [500] [650]\nAdd Point [50] [500] [550]\nAdd Point [50] [0] [550]\nAdd Point [0] [0] [550]\nAdd Point [0] [500] [550]\nAdd Triangle Surface [1] [2] [6] Color [204] [163] [102]\nAdd Triangle Surface [6] [5] [1] Color [204] [163] [102]\nAdd Triangle Surface [3] [4] [8] Color [204] [163] [102]\nAdd Triangle Surface [8] [7] [3] Color [204] [163] [102]\nAdd Triangle Surface [8] [4] [1] Color [248] [204] [127]\nAdd Triangle Surface [1] [5] [8] Color [248] [204] [127]\nAdd Triangle Surface [3] [2] [1] Color [204] [163] [102]\nAdd Triangle Surface [1] [4] [3] Color [204] [163] [102]\nAdd Triangle Surface [5] [6] [7] Color [204] [163] [102]\nAdd Triangle Surface [7] [8] [5] Color [204] [163] [102]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [-100] [450] [650]\nAdd Point [-100] [0] [650]\nAdd Point [-300] [0] [650]\nAdd Point [-300] [450] [650]\nAdd Point [-100] [450] [550]\nAdd Point [-100] [0] [550]\nAdd Point [-300] [0] [550]\nAdd Point [-300] [450] [550]\nAdd Triangle Surface [1] [2] [6] Color [204] [163] [102]\nAdd Triangle Surface [6] [5] [1] Color [204] [163] [102]\nAdd Triangle Surface [3] [4] [8] Color [204] [163] [102]\nAdd Triangle Surface [8] [7] [3] Color [204] [163] [102]\nAdd Triangle Surface [8] [4] [1] Color [248] [204] [127]\nAdd Triangle Surface [1] [5] [8] Color [248] [204] [127]\nAdd Triangle Surface [3] [2] [1] Color [204] [163] [102]\nAdd Triangle Surface [1] [4] [3] Color [204] [163] [102]\nAdd Triangle Surface [5] [6] [7] Color [204] [163] [102]\nAdd Triangle Surface [7] [8] [5] Color [204] [163] [102]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [-200] [500] [850]\nAdd Point [-200] [0] [850]\nAdd Point [-300] [0] [850]\nAdd Point [-300] [500] [850]\nAdd Point [-200] [500] [750]\nAdd Point [-200] [0] [750]\nAdd Point [-300] [0] [750]\nAdd Point [-300] [500] [750]\nAdd Triangle Surface [1] [2] [6] Color [204] [163] [102]\nAdd Triangle Surface [6] [5] [1] Color [204] [163] [102]\nAdd Triangle Surface [3] [4] [8] Color [204] [163] [102]\nAdd Triangle Surface [8] [7] [3] Color [204] [163] [102]\nAdd Triangle Surface [8] [4] [1] Color [248] [204] [127]\nAdd Triangle Surface [1] [5] [8] Color [248] [204] [127]\nAdd Triangle Surface [3] [2] [1] Color [204] [163] [102]\nAdd Triangle Surface [1] [4] [3] Color [204] [163] [102]\nAdd Triangle Surface [5] [6] [7] Color [204] [163] [102]\nAdd Triangle Surface [7] [8] [5] Color [204] [163] [102]\nEnd Object <> <> <> <>\n\ndefine Init Level 3\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [50] [100] [50]\nAdd Point [50] [0] [50]\nAdd Point [-50] [0] [50]\nAdd Point [-50] [100] [50]\nAdd Point [50] [100] [-50]\nAdd Point [50] [0] [-50]\nAdd Point [-50] [0] [-50]\nAdd Point [-50] [100] [-50]\nAdd Triangle Surface [1] [2] [6] Color [81] [130] [153]\nAdd Triangle Surface [6] [5] [1] Color [81] [130] [153]\nAdd Triangle Surface [3] [4] [8] Color [81] [130] [153]\nAdd Triangle Surface [8] [7] [3] Color [81] [130] [153]\nAdd Triangle Surface [8] [4] [1] Color [122] [195] [229]\nAdd Triangle Surface [1] [5] [8] Color [122] [195] [229]\nAdd Triangle Surface [3] [2] [1] Color [81] [130] [153]\nAdd Triangle Surface [1] [4] [3] Color [81] [130] [153]\nAdd Triangle Surface [5] [6] [7] Color [81] [130] [153]\nAdd Triangle Surface [7] [8] [5] Color [81] [130] [153]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [75] [175] [250]\nAdd Point [75] [0] [250]\nAdd Point [-25] [0] [250]\nAdd Point [-25] [175] [250]\nAdd Point [75] [175] [150]\nAdd Point [75] [0] [150]\nAdd Point [-25] [0] [150]\nAdd Point [-25] [175] [150]\nAdd Triangle Surface [1] [2] [6] Color [81] [130] [153]\nAdd Triangle Surface [6] [5] [1] Color [81] [130] [153]\nAdd Triangle Surface [3] [4] [8] Color [81] [130] [153]\nAdd Triangle Surface [8] [7] [3] Color [81] [130] [153]\nAdd Triangle Surface [8] [4] [1] Color [122] [195] [229]\nAdd Triangle Surface [1] [5] [8] Color [122] [195] [229]\nAdd Triangle Surface [3] [2] [1] Color [81] [130] [153]\nAdd Triangle Surface [1] [4] [3] Color [81] [130] [153]\nAdd Triangle Surface [5] [6] [7] Color [81] [130] [153]\nAdd Triangle Surface [7] [8] [5] Color [81] [130] [153]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [200] [250] [400]\nAdd Point [200] [0] [400]\nAdd Point [100] [0] [400]\nAdd Point [100] [250] [400]\nAdd Point [200] [250] [300]\nAdd Point [200] [0] [300]\nAdd Point [100] [0] [300]\nAdd Point [100] [250] [300]\nAdd Triangle Surface [1] [2] [6] Color [81] [130] [153]\nAdd Triangle Surface [6] [5] [1] Color [81] [130] [153]\nAdd Triangle Surface [3] [4] [8] Color [81] [130] [153]\nAdd Triangle Surface [8] [7] [3] Color [81] [130] [153]\nAdd Triangle Surface [8] [4] [1] Color [122] [195] [229]\nAdd Triangle Surface [1] [5] [8] Color [122] [195] [229]\nAdd Triangle Surface [3] [2] [1] Color [81] [130] [153]\nAdd Triangle Surface [1] [4] [3] Color [81] [130] [153]\nAdd Triangle Surface [5] [6] [7] Color [81] [130] [153]\nAdd Triangle Surface [7] [8] [5] Color [81] [130] [153]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [350] [325] [225]\nAdd Point [350] [0] [225]\nAdd Point [250] [0] [225]\nAdd Point [250] [325] [225]\nAdd Point [350] [325] [125]\nAdd Point [350] [0] [125]\nAdd Point [250] [0] [125]\nAdd Point [250] [325] [125]\nAdd Triangle Surface [1] [2] [6] Color [81] [130] [153]\nAdd Triangle Surface [6] [5] [1] Color [81] [130] [153]\nAdd Triangle Surface [3] [4] [8] Color [81] [130] [153]\nAdd Triangle Surface [8] [7] [3] Color [81] [130] [153]\nAdd Triangle Surface [8] [4] [1] Color [122] [195] [229]\nAdd Triangle Surface [1] [5] [8] Color [122] [195] [229]\nAdd Triangle Surface [3] [2] [1] Color [81] [130] [153]\nAdd Triangle Surface [1] [4] [3] Color [81] [130] [153]\nAdd Triangle Surface [5] [6] [7] Color [81] [130] [153]\nAdd Triangle Surface [7] [8] [5] Color [81] [130] [153]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [200] [400] [175]\nAdd Point [200] [0] [175]\nAdd Point [100] [0] [175]\nAdd Point [100] [400] [175]\nAdd Point [200] [400] [75]\nAdd Point [200] [0] [75]\nAdd Point [100] [0] [75]\nAdd Point [100] [400] [75]\nAdd Triangle Surface [1] [2] [6] Color [81] [130] [153]\nAdd Triangle Surface [6] [5] [1] Color [81] [130] [153]\nAdd Triangle Surface [3] [4] [8] Color [81] [130] [153]\nAdd Triangle Surface [8] [7] [3] Color [81] [130] [153]\nAdd Triangle Surface [8] [4] [1] Color [122] [195] [229]\nAdd Triangle Surface [1] [5] [8] Color [122] [195] [229]\nAdd Triangle Surface [3] [2] [1] Color [81] [130] [153]\nAdd Triangle Surface [1] [4] [3] Color [81] [130] [153]\nAdd Triangle Surface [5] [6] [7] Color [81] [130] [153]\nAdd Triangle Surface [7] [8] [5] Color [81] [130] [153]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [-75] [400] [175]\nAdd Point [-75] [0] [175]\nAdd Point [-275] [0] [175]\nAdd Point [-275] [400] [175]\nAdd Point [-75] [400] [75]\nAdd Point [-75] [0] [75]\nAdd Point [-275] [0] [75]\nAdd Point [-275] [400] [75]\nAdd Triangle Surface [1] [2] [6] Color [81] [130] [153]\nAdd Triangle Surface [6] [5] [1] Color [81] [130] [153]\nAdd Triangle Surface [3] [4] [8] Color [81] [130] [153]\nAdd Triangle Surface [8] [7] [3] Color [81] [130] [153]\nAdd Triangle Surface [8] [4] [1] Color [122] [195] [229]\nAdd Triangle Surface [1] [5] [8] Color [122] [195] [229]\nAdd Triangle Surface [3] [2] [1] Color [81] [130] [153]\nAdd Triangle Surface [1] [4] [3] Color [81] [130] [153]\nAdd Triangle Surface [5] [6] [7] Color [81] [130] [153]\nAdd Triangle Surface [7] [8] [5] Color [81] [130] [153]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [-175] [425] [475]\nAdd Point [-175] [0] [475]\nAdd Point [-275] [0] [475]\nAdd Point [-275] [425] [475]\nAdd Point [-175] [425] [275]\nAdd Point [-175] [0] [275]\nAdd Point [-275] [0] [275]\nAdd Point [-275] [425] [275]\nAdd Triangle Surface [1] [2] [6] Color [81] [130] [153]\nAdd Triangle Surface [6] [5] [1] Color [81] [130] [153]\nAdd Triangle Surface [3] [4] [8] Color [81] [130] [153]\nAdd Triangle Surface [8] [7] [3] Color [81] [130] [153]\nAdd Triangle Surface [8] [4] [1] Color [122] [195] [229]\nAdd Triangle Surface [1] [5] [8] Color [122] [195] [229]\nAdd Triangle Surface [3] [2] [1] Color [81] [130] [153]\nAdd Triangle Surface [1] [4] [3] Color [81] [130] [153]\nAdd Triangle Surface [5] [6] [7] Color [81] [130] [153]\nAdd Triangle Surface [7] [8] [5] Color [81] [130] [153]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [75] [450] [600]\nAdd Point [75] [0] [600]\nAdd Point [-125] [0] [600]\nAdd Point [-125] [450] [600]\nAdd Point [75] [450] [500]\nAdd Point [75] [0] [500]\nAdd Point [-125] [0] [500]\nAdd Point [-125] [450] [500]\nAdd Triangle Surface [1] [2] [6] Color [81] [130] [153]\nAdd Triangle Surface [6] [5] [1] Color [81] [130] [153]\nAdd Triangle Surface [3] [4] [8] Color [81] [130] [153]\nAdd Triangle Surface [8] [7] [3] Color [81] [130] [153]\nAdd Triangle Surface [8] [4] [1] Color [122] [195] [229]\nAdd Triangle Surface [1] [5] [8] Color [122] [195] [229]\nAdd Triangle Surface [3] [2] [1] Color [81] [130] [153]\nAdd Triangle Surface [1] [4] [3] Color [81] [130] [153]\nAdd Triangle Surface [5] [6] [7] Color [81] [130] [153]\nAdd Triangle Surface [7] [8] [5] Color [81] [130] [153]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [250] [475] [700]\nAdd Point [250] [0] [700]\nAdd Point [150] [0] [700]\nAdd Point [150] [475] [700]\nAdd Point [250] [475] [600]\nAdd Point [250] [0] [600]\nAdd Point [150] [0] [600]\nAdd Point [150] [475] [600]\nAdd Triangle Surface [1] [2] [6] Color [81] [130] [153]\nAdd Triangle Surface [6] [5] [1] Color [81] [130] [153]\nAdd Triangle Surface [3] [4] [8] Color [81] [130] [153]\nAdd Triangle Surface [8] [7] [3] Color [81] [130] [153]\nAdd Triangle Surface [8] [4] [1] Color [122] [195] [229]\nAdd Triangle Surface [1] [5] [8] Color [122] [195] [229]\nAdd Triangle Surface [3] [2] [1] Color [81] [130] [153]\nAdd Triangle Surface [1] [4] [3] Color [81] [130] [153]\nAdd Triangle Surface [5] [6] [7] Color [81] [130] [153]\nAdd Triangle Surface [7] [8] [5] Color [81] [130] [153]\nEnd Object <> <> <> <>\n\ndefine Init Level 4\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [50] [100] [50]\nAdd Point [50] [0] [50]\nAdd Point [-50] [0] [50]\nAdd Point [-50] [100] [50]\nAdd Point [50] [100] [-50]\nAdd Point [50] [0] [-50]\nAdd Point [-50] [0] [-50]\nAdd Point [-50] [100] [-50]\nAdd Triangle Surface [1] [2] [6] Color [128] [128] [128]\nAdd Triangle Surface [6] [5] [1] Color [128] [128] [128]\nAdd Triangle Surface [3] [4] [8] Color [128] [128] [128]\nAdd Triangle Surface [8] [7] [3] Color [128] [128] [128]\nAdd Triangle Surface [8] [4] [1] Color [192] [192] [192]\nAdd Triangle Surface [1] [5] [8] Color [192] [192] [192]\nAdd Triangle Surface [3] [2] [1] Color [128] [128] [128]\nAdd Triangle Surface [1] [4] [3] Color [128] [128] [128]\nAdd Triangle Surface [5] [6] [7] Color [128] [128] [128]\nAdd Triangle Surface [7] [8] [5] Color [128] [128] [128]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [50] [175] [250]\nAdd Point [50] [0] [250]\nAdd Point [-50] [0] [250]\nAdd Point [-50] [175] [250]\nAdd Point [50] [175] [150]\nAdd Point [50] [0] [150]\nAdd Point [-50] [0] [150]\nAdd Point [-50] [175] [150]\nAdd Triangle Surface [1] [2] [6] Color [128] [128] [128]\nAdd Triangle Surface [6] [5] [1] Color [128] [128] [128]\nAdd Triangle Surface [3] [4] [8] Color [128] [128] [128]\nAdd Triangle Surface [8] [7] [3] Color [128] [128] [128]\nAdd Triangle Surface [8] [4] [1] Color [192] [192] [192]\nAdd Triangle Surface [1] [5] [8] Color [192] [192] [192]\nAdd Triangle Surface [3] [2] [1] Color [128] [128] [128]\nAdd Triangle Surface [1] [4] [3] Color [128] [128] [128]\nAdd Triangle Surface [5] [6] [7] Color [128] [128] [128]\nAdd Triangle Surface [7] [8] [5] Color [128] [128] [128]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [50] [250] [550]\nAdd Point [50] [0] [550]\nAdd Point [-50] [0] [550]\nAdd Point [-50] [250] [550]\nAdd Point [50] [250] [350]\nAdd Point [50] [0] [350]\nAdd Point [-50] [0] [350]\nAdd Point [-50] [250] [350]\nAdd Triangle Surface [1] [2] [6] Color [128] [128] [128]\nAdd Triangle Surface [6] [5] [1] Color [128] [128] [128]\nAdd Triangle Surface [3] [4] [8] Color [128] [128] [128]\nAdd Triangle Surface [8] [7] [3] Color [128] [128] [128]\nAdd Triangle Surface [8] [4] [1] Color [192] [192] [192]\nAdd Triangle Surface [1] [5] [8] Color [192] [192] [192]\nAdd Triangle Surface [3] [2] [1] Color [128] [128] [128]\nAdd Triangle Surface [1] [4] [3] Color [128] [128] [128]\nAdd Triangle Surface [5] [6] [7] Color [128] [128] [128]\nAdd Triangle Surface [7] [8] [5] Color [128] [128] [128]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [350] [325] [550]\nAdd Point [350] [0] [550]\nAdd Point [150] [0] [550]\nAdd Point [150] [325] [550]\nAdd Point [350] [325] [450]\nAdd Point [350] [0] [450]\nAdd Point [150] [0] [450]\nAdd Point [150] [325] [450]\nAdd Triangle Surface [1] [2] [6] Color [128] [128] [128]\nAdd Triangle Surface [6] [5] [1] Color [128] [128] [128]\nAdd Triangle Surface [3] [4] [8] Color [128] [128] [128]\nAdd Triangle Surface [8] [7] [3] Color [128] [128] [128]\nAdd Triangle Surface [8] [4] [1] Color [192] [192] [192]\nAdd Triangle Surface [1] [5] [8] Color [192] [192] [192]\nAdd Triangle Surface [3] [2] [1] Color [128] [128] [128]\nAdd Triangle Surface [1] [4] [3] Color [128] [128] [128]\nAdd Triangle Surface [5] [6] [7] Color [128] [128] [128]\nAdd Triangle Surface [7] [8] [5] Color [128] [128] [128]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [400] [400] [350]\nAdd Point [400] [0] [350]\nAdd Point [300] [0] [350]\nAdd Point [300] [400] [350]\nAdd Point [400] [400] [250]\nAdd Point [400] [0] [250]\nAdd Point [300] [0] [250]\nAdd Point [300] [400] [250]\nAdd Triangle Surface [1] [2] [6] Color [128] [128] [128]\nAdd Triangle Surface [6] [5] [1] Color [128] [128] [128]\nAdd Triangle Surface [3] [4] [8] Color [128] [128] [128]\nAdd Triangle Surface [8] [7] [3] Color [128] [128] [128]\nAdd Triangle Surface [8] [4] [1] Color [192] [192] [192]\nAdd Triangle Surface [1] [5] [8] Color [192] [192] [192]\nAdd Triangle Surface [3] [2] [1] Color [128] [128] [128]\nAdd Triangle Surface [1] [4] [3] Color [128] [128] [128]\nAdd Triangle Surface [5] [6] [7] Color [128] [128] [128]\nAdd Triangle Surface [7] [8] [5] Color [128] [128] [128]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [400] [475] [150]\nAdd Point [400] [0] [150]\nAdd Point [300] [0] [150]\nAdd Point [300] [475] [150]\nAdd Point [400] [475] [50]\nAdd Point [400] [0] [50]\nAdd Point [300] [0] [50]\nAdd Point [300] [475] [50]\nAdd Triangle Surface [1] [2] [6] Color [128] [128] [128]\nAdd Triangle Surface [6] [5] [1] Color [128] [128] [128]\nAdd Triangle Surface [3] [4] [8] Color [128] [128] [128]\nAdd Triangle Surface [8] [7] [3] Color [128] [128] [128]\nAdd Triangle Surface [8] [4] [1] Color [192] [192] [192]\nAdd Triangle Surface [1] [5] [8] Color [192] [192] [192]\nAdd Triangle Surface [3] [2] [1] Color [128] [128] [128]\nAdd Triangle Surface [1] [4] [3] Color [128] [128] [128]\nAdd Triangle Surface [5] [6] [7] Color [128] [128] [128]\nAdd Triangle Surface [7] [8] [5] Color [128] [128] [128]\nEnd Object <> <> <> <>\nBegin Object [0] [0] [0] [0] [0] [0]\nAdd Point [350] [550] [-150]\nAdd Point [350] [0] [-150]\nAdd Point [350] [0] [-50]\nAdd Point [350] [550] [-50]\nAdd Point [250] [550] [-150]\nAdd Point [250] [0] [-150]\nAdd Point [250] [0] [-50]\nAdd Point [250] [550] [-50]\nAdd Triangle Surface [1] [2] [6] Color [128] [128] [128]\nAdd Triangle Surface [6] [5] [1] Color [128] [128] [128]\nAdd Triangle Surface [3] [4] [8] Color [128] [128] [128]\nAdd Triangle Surface [8] [7] [3] Color [128] [128] [128]\nAdd Triangle Surface [8] [4] [1] Color [192] [192] [192]\nAdd Triangle Surface [1] [5] [8] Color [192] [192] [192]\nAdd Triangle Surface [3] [2] [1] Color [128] [128] [128]\nAdd Triangle Surface [1] [4] [3] Color [128] [128] [128]\nAdd Triangle Surface [5] [6] [7] Color [128] [128] [128]\nAdd Triangle Surface [7] [8] [5] Color [128] [128] [128]\nEnd Object <> <> <> <>\n\n@Collisions\n\nwhen I receive [init: collisions v]\nClear Collisions\nif <(Current Level) = [1]> then\n    Init Level 1\nend\nif <(Current Level) = [2]> then\n    Init Level 2\nend\nif <(Current Level) = [3]> then\n    Init Level 3\nend\nif <(Current Level) = [4]> then\n    Init Level 4\nend\n\ndefine Clear Collisions\ndelete all of [collisions boxes: x1 v]\ndelete all of [collisions boxes: y1 v]\ndelete all of [collisions boxes: z1 v]\ndelete all of [collisions boxes: x2 v]\ndelete all of [collisions boxes: y2 v]\ndelete all of [collisions boxes: z2 v]\n\ndefine Add Collision Box (x1) (y1) (z1) (x2) (y2) (z2)\nadd (x1) to [collisions boxes: x1 v]\nadd (y1) to [collisions boxes: y1 v]\nadd (z1) to [collisions boxes: z1 v]\nadd (x2) to [collisions boxes: x2 v]\nadd (y2) to [collisions boxes: y2 v]\nadd (z2) to [collisions boxes: z2 v]\n\nClear Collisions\n\ndefine Init Level 1\nAdd Collision Box [50] [100] [150] [-50] [0] [-50]\nAdd Collision Box [50] [100] [500] [-50] [0] [250]\nAdd Collision Box [-50] [150] [500] [-250] [0] [400]\nAdd Collision Box [-350] [200] [700] [-450] [0] [400]\nAdd Collision Box [-150] [250] [750] [-250] [0] [650]\n\ndefine Init Level 2\nAdd Collision Box [50] [100] [50] [-50] [0] [-50]\nAdd Collision Box [50] [150] [250] [-50] [0] [150]\nAdd Collision Box [150] [400] [250] [50] [0] [150]\nAdd Collision Box [-50] [350] [250] [-150] [0] [150]\nAdd Collision Box [275] [425] [450] [175] [0] [250]\nAdd Collision Box [150] [450] [650] [50] [0] [550]\nAdd Collision Box [50] [500] [650] [0] [0] [550]\nAdd Collision Box [-100] [450] [650] [-300] [0] [550]\nAdd Collision Box [-200] [500] [850] [-300] [0] [750]\n\ndefine Init Level 3\nAdd Collision Box [50] [100] [50] [-50] [0] [-50]\nAdd Collision Box [75] [175] [250] [-25] [0] [150]\nAdd Collision Box [200] [250] [400] [100] [0] [300]\nAdd Collision Box [350] [325] [225] [250] [0] [125]\nAdd Collision Box [200] [400] [175] [100] [0] [75]\nAdd Collision Box [-75] [400] [175] [-275] [0] [75]\nAdd Collision Box [-175] [425] [475] [-275] [0] [275]\nAdd Collision Box [75] [450] [600] [-125] [0] [500]\nAdd Collision Box [250] [475] [700] [150] [0] [600]\n\ndefine Init Level 4\nAdd Collision Box [50] [100] [50] [-50] [0] [-50]\nAdd Collision Box [50] [175] [250] [-50] [0] [150]\nAdd Collision Box [50] [250] [550] [-50] [0] [350]\nAdd Collision Box [350] [325] [550] [150] [0] [450]\nAdd Collision Box [400] [400] [350] [300] [0] [250]\nAdd Collision Box [400] [475] [150] [300] [0] [50]\nAdd Collision Box [350] [550] [-50] [250] [0] [-150]\n\n@Player\n\ndefine Delete Object (object)\nif <<(object) < [1]> or <(object) > (length of [objects: x v])>> then\n    stop [this script v]\nend\nset [index 1 v] to [1]\nset [index 2 v] to [1]\nrepeat ((object) - (1))\n    change [index 2 v] by (item (Index 1) of [objects: point index v])\n    change [index 1 v] by (1)\nend\nset [index 1 v] to [1]\nrepeat (length of [surfaces: p1 v])\n    if <<(item (Index 1) of [surfaces: p1 v]) > ((Index 2) + ((item (object) of [objects: point index v]) - (1)))> or <<(item (Index 1) of [surfaces: p2 v]) > ((Index 2) + ((item (object) of [objects: point index v]) - (1)))> or <(item (Index 1) of [surfaces: p3 v]) > ((Index 2) + ((item (object) of [objects: point index v]) - (1)))>>> then\n        replace item (Index 1) of [surfaces: p1 v] with ((item (Index 1) of [surfaces: p1 v]) - (item (object) of [objects: point index v]))\n        replace item (Index 1) of [surfaces: p2 v] with ((item (Index 1) of [surfaces: p2 v]) - (item (object) of [objects: point index v]))\n        replace item (Index 1) of [surfaces: p3 v] with ((item (Index 1) of [surfaces: p3 v]) - (item (object) of [objects: point index v]))\n        change [index 1 v] by (1)\n    else\n        if <<not <(item (Index 1) of [surfaces: p1 v]) < (Index 2)>> or <<not <(item (Index 1) of [surfaces: p2 v]) < (Index 2)>> or <not <(item (Index 1) of [surfaces: p3 v]) < (Index 2)>>>> then\n            delete (Index 1) of [surfaces: p1 v]\n            delete (Index 1) of [surfaces: p2 v]\n            delete (Index 1) of [surfaces: p3 v]\n            delete (Index 1) of [surfaces: diameter v]\n            delete (Index 1) of [surfaces: type v]\n            delete (Index 1) of [surfaces: r v]\n            delete (Index 1) of [surfaces: g v]\n            delete (Index 1) of [surfaces: b v]\n        else\n            change [index 1 v] by (1)\n        end\n    end\nend\nrepeat (item (object) of [objects: point index v])\n    delete (Index 2) of [point data: x v]\n    delete (Index 2) of [point data: y v]\n    delete (Index 2) of [point data: z v]\nend\ndelete (object) of [objects: x v]\ndelete (object) of [objects: y v]\ndelete (object) of [objects: z v]\ndelete (object) of [objects: rot x v]\ndelete (object) of [objects: rot y v]\ndelete (object) of [objects: rot z v]\ndelete (object) of [objects: point index v]\ndelete (object) of [objects: sign? v]\ndelete (object) of [signs: text # v]\ndelete (object) of [objects: enemy? v]\ndelete (object) of [enemies: x1 v]\ndelete (object) of [enemies: y1 v]\ndelete (object) of [enemies: z1 v]\ndelete (object) of [enemies: x2 v]\ndelete (object) of [enemies: y2 v]\ndelete (object) of [enemies: z2 v]\ndelete (object) of [objects: coin? v]\ndelete (object) of [objects: flag? v]\n\nwhen I receive [init: player v]\nset [player: x v] to [0]\nset [player: y v] to [120]\nset [player: z v] to [0]\nset [player: vel x v] to [0]\nset [player: vel y v] to [0]\nset [player: vel z v] to [0]\nset [falling? v] to [3]\nset [camera: x v] to [0]\nset [camera: y v] to [0]\nset [camera: z v] to [0]\nset [camera: rot x v] to [-25]\nset [camera: rot y v] to [0]\n\nwhen I receive [system: update player v]\nif <not <(Wall Jump) > [0]>> then\n    if <key (w v) pressed?> then\n        change [player: vel x v] by ((1.5) * ([sin v] of (Camera: Rot Y) ))\n        change [player: vel z v] by ((1.5) * ([cos v] of (Camera: Rot Y) ))\n    end\n    if <key (s v) pressed?> then\n        change [player: vel x v] by ((-1.5) * ([sin v] of (Camera: Rot Y) ))\n        change [player: vel z v] by ((-1.5) * ([cos v] of (Camera: Rot Y) ))\n    end\n    if <key (a v) pressed?> then\n        change [player: vel x v] by ((-1.5) * ([cos v] of (Camera: Rot Y) ))\n        change [player: vel z v] by ((1.5) * ([sin v] of (Camera: Rot Y) ))\n    end\n    if <key (d v) pressed?> then\n        change [player: vel x v] by ((1.5) * ([cos v] of (Camera: Rot Y) ))\n        change [player: vel z v] by ((-1.5) * ([sin v] of (Camera: Rot Y) ))\n    end\nend\nif <<key (space v) pressed?> and <(Falling?) < [3]>> then\n    set [player: vel y v] to [12]\nend\nif <key (up arrow v) pressed?> then\n    change [camera: rot x v] by (5)\nend\nif <key (down arrow v) pressed?> then\n    change [camera: rot x v] by (-5)\nend\nif <key (left arrow v) pressed?> then\n    change [camera: rot y v] by (-5)\nend\nif <key (right arrow v) pressed?> then\n    change [camera: rot y v] by (5)\nend\nif <(Camera: Rot X) > [0]> then\n    set [camera: rot x v] to [0]\nend\nif <(Camera: Rot X) < [-90]> then\n    set [camera: rot x v] to [-90]\nend\nUpdate Player\nTest if Touching Enemy\nif <<(Touching Enemy?) = [1]> or <(Player: Y) < [0]>> then\n    set [player: x v] to [0]\n    set [player: y v] to [120]\n    set [player: z v] to [0]\n    set [player: vel x v] to [0]\n    set [player: vel y v] to [0]\n    set [player: vel z v] to [0]\n    set [falling? v] to [3]\n    set [camera: x v] to [0]\n    set [camera: y v] to [0]\n    set [camera: z v] to [0]\n    set [camera: rot x v] to [-25]\n    set [camera: rot y v] to [0]\nend\nTest if Touching Flag\nset [camera: x v] to ((Player: X) + ((250) * (([sin v] of ((0) - (Camera: Rot Y)) ) * ([cos v] of (Camera: Rot X) ))))\nset [camera: y v] to ((Player: Y) - ((250) * ([sin v] of (Camera: Rot X) )))\nset [camera: z v] to ((Player: Z) + ((-250) * (([cos v] of ((0) - (Camera: Rot Y)) ) * ([cos v] of (Camera: Rot X) ))))\n\ndefine Update Player\nchange [player: x v] by (Player: Vel X)\nTest for Collision\nif <(In Collision Box?) = [1]> then\n    repeat until <not <(In Collision Box?) = [1]>>\n        if <(Player: Vel X) > [0]> then\n            change [player: x v] by (-1)\n        else\n            change [player: x v] by (1)\n        end\n        Test for Collision\n    end\n    if <<key (space v) pressed?> and <([abs v] of (Player: Vel X) ) > [3]>> then\n        if <(Wall Jump) = [0]> then\n            set [player: vel x v] to ((-1.2) * (Player: Vel X))\n            set [player: vel y v] to [11]\n            set [falling? v] to [6]\n            set [wall jump v] to [16]\n        end\n    else\n        set [player: vel x v] to [0]\n    end\nend\nif <not <(Wall Jump) > [0]>> then\n    set [player: vel x v] to ((Player: Vel X) * (0.7))\nend\nchange [player: y v] by (Player: Vel Y)\nchange [falling? v] by (1)\nTest for Collision\nif <(In Collision Box?) = [1]> then\n    repeat until <not <(In Collision Box?) = [1]>>\n        if <(Player: Vel Y) > [0]> then\n            change [player: y v] by (-1)\n        else\n            change [player: y v] by (1)\n        end\n        Test for Collision\n    end\n    set [falling? v] to [0]\n    set [player: vel y v] to [0]\nend\nchange [player: vel y v] by (-1)\nchange [player: z v] by (Player: Vel Z)\nTest for Collision\nif <(In Collision Box?) = [1]> then\n    repeat until <not <(In Collision Box?) = [1]>>\n        if <(Player: Vel Z) > [0]> then\n            change [player: z v] by (-1)\n        else\n            change [player: z v] by (1)\n        end\n        Test for Collision\n    end\n    if <<key (space v) pressed?> and <([abs v] of (Player: Vel Z) ) > [3]>> then\n        if <(Wall Jump) = [0]> then\n            set [player: vel z v] to ((-1.2) * (Player: Vel Z))\n            set [player: vel y v] to [11]\n            set [falling? v] to [6]\n            set [wall jump v] to [16]\n        end\n    else\n        set [player: vel z v] to [0]\n    end\nend\nif <not <(Wall Jump) > [0]>> then\n    set [player: vel z v] to ((Player: Vel Z) * (0.7))\nend\nif <(Wall Jump) > [0]> then\n    change [wall jump v] by (-1)\nend\n\ndefine Test if Touching Enemy\nset [touching enemy? v] to [0]\nset [index 1 v] to [1]\nrepeat (length of [objects: x v])\n    if <(item (Index 1) of [objects: enemy? v]) = [1]> then\n        if <<((Player: X) - (20)) < ((item (Index 1) of [objects: x v]) + (20))> and <((Player: X) + (20)) > ((item (Index 1) of [objects: x v]) - (20))>> then\n            if <<((Player: Y) - (20)) < ((item (Index 1) of [objects: y v]) + (20))> and <((Player: Y) + (20)) > ((item (Index 1) of [objects: y v]) - (20))>> then\n                if <<((Player: Z) - (20)) < ((item (Index 1) of [objects: z v]) + (20))> and <((Player: Z) + (20)) > ((item (Index 1) of [objects: z v]) - (20))>> then\n                    if <(Player: Vel Y) < [-1]> then\n                        Delete Object (Index 1)\n                        set [player: vel y v] to [10]\n                    else\n                        set [touching enemy? v] to [1]\n                    end\n                end\n            end\n        end\n    end\n    change [index 1 v] by (1)\nend\n\ndefine Test if Touching Flag\nset [touching flag? v] to [0]\nset [index 1 v] to [1]\nrepeat (length of [objects: x v])\n    if <(item (Index 1) of [objects: flag? v]) = [1]> then\n        if <<((Player: X) - (20)) < ((item (Index 1) of [objects: x v]) + (10))> and <((Player: X) + (20)) > ((item (Index 1) of [objects: x v]) - (10))>> then\n            if <<((Player: Y) - (20)) < ((item (Index 1) of [objects: y v]) + (70))> and <((Player: Y) + (20)) > (item (Index 1) of [objects: y v])>> then\n                if <<((Player: Z) - (20)) < ((item (Index 1) of [objects: z v]) + (10))> and <((Player: Z) + (20)) > ((item (Index 1) of [objects: z v]) - (10))>> then\n                    set [touching flag? v] to [1]\n                end\n            end\n        end\n    end\n    change [index 1 v] by (1)\nend\n\ndefine Test for Collision\nset [in collision box? v] to [0]\nset [index 1 v] to [1]\nrepeat (length of [collisions boxes: x1 v])\n    if <<((Player: X) - (20)) < (item (Index 1) of [collisions boxes: x1 v])> and <((Player: X) + (20)) > (item (Index 1) of [collisions boxes: x2 v])>> then\n        if <<((Player: Y) - (20)) < (item (Index 1) of [collisions boxes: y1 v])> and <((Player: Y) + (20)) > (item (Index 1) of [collisions boxes: y2 v])>> then\n            if <<((Player: Z) - (20)) < (item (Index 1) of [collisions boxes: z1 v])> and <((Player: Z) + (20)) > (item (Index 1) of [collisions boxes: z2 v])>> then\n                set [in collision box? v] to [1]\n            end\n        end\n    end\n    change [index 1 v] by (1)\nend\n\nchange [camera: x v] by ((5) * ((<key (w v) pressed?> - <key (s v) pressed?>) * ([sin v] of (Camera: Rot Y) )))\nchange [camera: z v] by ((5) * ((<key (w v) pressed?> - <key (s v) pressed?>) * ([cos v] of (Camera: Rot Y) )))\nchange [camera: x v] by ((5) * ((<key (d v) pressed?> - <key (a v) pressed?>) * ([cos v] of (Camera: Rot Y) )))\nchange [camera: z v] by ((-5) * ((<key (d v) pressed?> - <key (a v) pressed?>) * ([sin v] of (Camera: Rot Y) )))\nchange [camera: y v] by ((5) * (<key (e v) pressed?> - <key (q v) pressed?>))\nchange [camera: rot x v] by ((5) * (<key (up arrow v) pressed?> - <key (down arrow v) pressed?>))\nchange [camera: rot y v] by ((5) * (<key (right arrow v) pressed?> - <key (left arrow v) pressed?>))\n\n@Runtime\n\nwhen I receive [system: update objects v]\nMove Object [1] to (Player: X) (Player: Y) (Player: Z)\nUpdate Signs\nUpdate Enemies\nUpdate Coins\n\ndefine Move Object (object) to (x) (y) (z)\nreplace item (object) of [objects: x v] with (x)\nreplace item (object) of [objects: y v] with (y)\nreplace item (object) of [objects: z v] with (z)\n\ndefine Rotate Object (object) to (rot x) (rot y)\nreplace item (object) of [objects: rot x v] with (rot x)\nreplace item (object) of [objects: rot y v] with (rot y)\n\ndefine Calculate Distance (x1) (y1) (z1) (x2) (y2) (z2)\nset [distance v] to ([sqrt v] of ((((x1) - (x2)) * ((x1) - (x2))) + ((((y1) - (y2)) * ((y1) - (y2))) + (((z1) - (z2)) * ((z1) - (z2))))) )\n\ndefine Delete Object (object)\nif <<(object) < [1]> or <(object) > (length of [objects: x v])>> then\n    stop [this script v]\nend\nset [index 1 v] to [1]\nset [index 2 v] to [1]\nrepeat ((object) - (1))\n    change [index 2 v] by (item (Index 1) of [objects: point index v])\n    change [index 1 v] by (1)\nend\nset [index 1 v] to [1]\nrepeat (length of [surfaces: p1 v])\n    if <<(item (Index 1) of [surfaces: p1 v]) > ((Index 2) + ((item (object) of [objects: point index v]) - (1)))> or <<(item (Index 1) of [surfaces: p2 v]) > ((Index 2) + ((item (object) of [objects: point index v]) - (1)))> or <(item (Index 1) of [surfaces: p3 v]) > ((Index 2) + ((item (object) of [objects: point index v]) - (1)))>>> then\n        replace item (Index 1) of [surfaces: p1 v] with ((item (Index 1) of [surfaces: p1 v]) - (item (object) of [objects: point index v]))\n        replace item (Index 1) of [surfaces: p2 v] with ((item (Index 1) of [surfaces: p2 v]) - (item (object) of [objects: point index v]))\n        replace item (Index 1) of [surfaces: p3 v] with ((item (Index 1) of [surfaces: p3 v]) - (item (object) of [objects: point index v]))\n        change [index 1 v] by (1)\n    else\n        if <<not <(item (Index 1) of [surfaces: p1 v]) < (Index 2)>> or <<not <(item (Index 1) of [surfaces: p2 v]) < (Index 2)>> or <not <(item (Index 1) of [surfaces: p3 v]) < (Index 2)>>>> then\n            delete (Index 1) of [surfaces: p1 v]\n            delete (Index 1) of [surfaces: p2 v]\n            delete (Index 1) of [surfaces: p3 v]\n            delete (Index 1) of [surfaces: diameter v]\n            delete (Index 1) of [surfaces: type v]\n            delete (Index 1) of [surfaces: r v]\n            delete (Index 1) of [surfaces: g v]\n            delete (Index 1) of [surfaces: b v]\n        else\n            change [index 1 v] by (1)\n        end\n    end\nend\nrepeat (item (object) of [objects: point index v])\n    delete (Index 2) of [point data: x v]\n    delete (Index 2) of [point data: y v]\n    delete (Index 2) of [point data: z v]\nend\ndelete (object) of [objects: x v]\ndelete (object) of [objects: y v]\ndelete (object) of [objects: z v]\ndelete (object) of [objects: rot x v]\ndelete (object) of [objects: rot y v]\ndelete (object) of [objects: rot z v]\ndelete (object) of [objects: point index v]\ndelete (object) of [objects: sign? v]\ndelete (object) of [signs: text # v]\ndelete (object) of [objects: enemy? v]\ndelete (object) of [enemies: x1 v]\ndelete (object) of [enemies: y1 v]\ndelete (object) of [enemies: z1 v]\ndelete (object) of [enemies: x2 v]\ndelete (object) of [enemies: y2 v]\ndelete (object) of [enemies: z2 v]\ndelete (object) of [objects: coin? v]\ndelete (object) of [objects: flag? v]\n\ndefine Update Signs\nset [nearest sign v] to []\nset [index 1 v] to [1]\nrepeat (length of [objects: x v])\n    if <(item (Index 1) of [objects: sign? v]) = [1]> then\n        Calculate Distance (item (Index 1) of [objects: x v]) (item (Index 1) of [objects: y v]) (item (Index 1) of [objects: z v]) (Player: X) (Player: Y) (Player: Z)\n        if <(Distance) < [75]> then\n            set [nearest sign v] to (item (Index 1) of [signs: text # v])\n        end\n    end\n    change [index 1 v] by (1)\nend\n\ndefine Update Enemies\nset [index 1 v] to [1]\nrepeat (length of [objects: x v])\n    if <(item (Index 1) of [objects: enemy? v]) = [1]> then\n        Update Enemy (item (Index 1) of [enemies: x1 v]) (item (Index 1) of [enemies: y1 v]) (item (Index 1) of [enemies: z1 v]) (item (Index 1) of [enemies: x2 v]) (item (Index 1) of [enemies: y2 v]) (item (Index 1) of [enemies: z2 v])\n    end\n    change [index 1 v] by (1)\nend\n\ndefine Update Enemy (x1) (y1) (z1) (x2) (y2) (z2)\nset [temp speed v] to (([sin v] of ((timer) * (50)) ) + (1))\nMove Object (Index 1) to (((((x2) - (x1)) / (2)) * (Temp Speed)) + (x1)) (((((y2) - (y1)) / (2)) * (Temp Speed)) + (y1)) (((((z2) - (z1)) / (2)) * (Temp Speed)) + (z1))\n\ndefine Update Coins\nset [index 1 v] to [1]\nrepeat (length of [objects: x v])\n    if <(item (Index 1) of [objects: coin? v]) = [1]> then\n        Rotate Object (Index 1) to [0] ((timer) * (150))\n        Calculate Distance (item (Index 1) of [objects: x v]) (item (Index 1) of [objects: y v]) (item (Index 1) of [objects: z v]) (Player: X) (Player: Y) (Player: Z)\n        if <(Distance) < [40]> then\n            Delete Object (Index 1)\n        end\n    end\n    change [index 1 v] by (1)\nend\n\n@Renderer\n\ndefine Transform All Points\nCalculate View Matrix\ndelete all of [point data: x' v]\ndelete all of [point data: y' v]\ndelete all of [point data: z' v]\ndelete all of [screen: x v]\ndelete all of [screen: y v]\nset [index 1 v] to [1]\nset [index 2 v] to [1]\nrepeat (length of [objects: x v])\n    Calculate World Matrix ((0) - (item (Index 1) of [objects: rot x v])) ((0) - (item (Index 1) of [objects: rot y v])) ((0) - (item (Index 1) of [objects: rot z v]))\n    repeat (item (Index 1) of [objects: point index v])\n        Transform Point (item (Index 2) of [point data: x v]) (item (Index 2) of [point data: y v]) (item (Index 2) of [point data: z v])\n        Project Point (length of [point data: x' v])\n        change [index 2 v] by (1)\n    end\n    change [index 1 v] by (1)\nend\n\ndefine Render Surfaces\nerase all\nSort Surfaces\nif <(Current Level) = [4]> then\n    Set Pen Color to RGB [200] [0] [0]\n    Render Plane ((0) - ((240) * ([tan v] of (Camera: Rot X) )))\nend\nset [index 1 v] to [1]\nrepeat (length of [surfaces: order v])\n    set [index 2 v] to (item (Index 1) of [surfaces: order v])\n    set [index 3 v] to (item (Index 2) of [clipped surfaces: perent v])\n    Set Pen Color to RGB (item (Index 3) of [surfaces: r v]) (item (Index 3) of [surfaces: g v]) (item (Index 3) of [surfaces: b v])\n    if <(item (Index 3) of [surfaces: type v]) = [1]> then\n        Render Triangle Surface (item (Index 2) of [clipped surfaces: p1 v]) (item (Index 2) of [clipped surfaces: p2 v]) (item (Index 2) of [clipped surfaces: p3 v])\n    else\n        if <(item (Index 3) of [surfaces: type v]) = [2]> then\n            Render Line Surface (item (Index 2) of [clipped surfaces: p1 v]) (item (Index 2) of [clipped surfaces: p2 v]) Width (item (Index 3) of [surfaces: diameter v])\n        else\n            if <(item (Index 3) of [surfaces: type v]) = [3]> then\n                Render Sphere Surface (item (Index 2) of [clipped surfaces: p1 v]) Diameter (item (Index 3) of [surfaces: diameter v])\n            end\n        end\n    end\n    change [index 1 v] by (1)\nend\n\ndefine Calculate View Matrix\nset [view matrix: 11 v] to ([cos v] of (Camera: Rot Y) )\nset [view matrix: 12 v] to [0]\nset [view matrix: 13 v] to ((0) - ([sin v] of (Camera: Rot Y) ))\nset [view matrix: 21 v] to ((0) - (([sin v] of (Camera: Rot Y) ) * ([sin v] of (Camera: Rot X) )))\nset [view matrix: 22 v] to ([cos v] of (Camera: Rot X) )\nset [view matrix: 23 v] to ((0) - (([cos v] of (Camera: Rot Y) ) * ([sin v] of (Camera: Rot X) )))\nset [view matrix: 31 v] to (([sin v] of (Camera: Rot Y) ) * ([cos v] of (Camera: Rot X) ))\nset [view matrix: 32 v] to ([sin v] of (Camera: Rot X) )\nset [view matrix: 33 v] to (([cos v] of (Camera: Rot Y) ) * ([cos v] of (Camera: Rot X) ))\n\ndefine Transform Point (x) (y) (z)\ndelete all of [temp list v]\nApply World Transformations (x) (y) (z)\nApply View Transformations (item (1) of [temp list v]) (item (2) of [temp list v]) (item (3) of [temp list v])\nadd (item (1) of [temp list v]) to [point data: x' v]\nadd (item (2) of [temp list v]) to [point data: y' v]\nadd (item (3) of [temp list v]) to [point data: z' v]\n\ndefine Project Point (point)\nadd (((item (point) of [point data: x' v]) / (item (point) of [point data: z' v])) * (240)) to [screen: x v]\nadd (((item (point) of [point data: y' v]) / (item (point) of [point data: z' v])) * (240)) to [screen: y v]\n\ndefine Render Triangle Surface (p1) (p2) (p3)\nFill Triangle (item (p1) of [screen: x v]) (item (p1) of [screen: y v]) (item (p2) of [screen: x v]) (item (p2) of [screen: y v]) (item (p3) of [screen: x v]) (item (p3) of [screen: y v]) Resolution [1]\n\ndefine Fill Triangle (ax) (ay) (bx) (by) (cx) (cy) Resolution (resolution)\nset [triangle fill: 2 v] to ([sqrt v] of ((((cx) - (bx)) * ((cx) - (bx))) + (((cy) - (by)) * ((cy) - (by)))) )\nset [triangle fill: 3 v] to ([sqrt v] of ((((cx) - (ax)) * ((cx) - (ax))) + (((cy) - (ay)) * ((cy) - (ay)))) )\nset [triangle fill: 4 v] to ([sqrt v] of ((((ax) - (bx)) * ((ax) - (bx))) + (((ay) - (by)) * ((ay) - (by)))) )\nset [triangle fill: 1 v] to (((Triangle Fill: 2) + ((Triangle Fill: 3) + (Triangle Fill: 4))) / (2))\nset [triangle fill: 0 v] to ((2) * ([sqrt v] of ((((Triangle Fill: 1) - (Triangle Fill: 2)) * (((Triangle Fill: 1) - (Triangle Fill: 3)) * ((Triangle Fill: 1) - (Triangle Fill: 4)))) / (Triangle Fill: 1)) ))\nchange [triangle fill: 1 v] by (Triangle Fill: 1)\ngo to x: ((((Triangle Fill: 2) * (ax)) + (((Triangle Fill: 3) * (bx)) + ((Triangle Fill: 4) * (cx)))) / (Triangle Fill: 1)) y: ((((Triangle Fill: 2) * (ay)) + (((Triangle Fill: 3) * (by)) + ((Triangle Fill: 4) * (cy)))) / (Triangle Fill: 1))\nset pen size to (Triangle Fill: 0)\npen down\nif <(Triangle Fill: 0) > [0]> then\n    if <<(Triangle Fill: 3) < (Triangle Fill: 2)> or <(Triangle Fill: 4) < (Triangle Fill: 2)>> then\n        if <<(Triangle Fill: 2) < (Triangle Fill: 3)> or <(Triangle Fill: 4) < (Triangle Fill: 3)>> then\n            set [triangle fill: 1 v] to ((x position) - (cx))\n            set [triangle fill: 2 v] to ((y position) - (cy))\n        else\n            set [triangle fill: 1 v] to ((x position) - (bx))\n            set [triangle fill: 2 v] to ((y position) - (by))\n        end\n    else\n        set [triangle fill: 1 v] to ((x position) - (ax))\n        set [triangle fill: 2 v] to ((y position) - (ay))\n    end\n    set [triangle fill: 1 v] to (([sqrt v] of (((Triangle Fill: 1) * (Triangle Fill: 1)) + ((Triangle Fill: 2) * (Triangle Fill: 2))) ) / ((Triangle Fill: 0) / (2)))\n    set [triangle fill: 8 v] to (((Triangle Fill: 1) * (resolution)) / ((Triangle Fill: 1) - (1)))\n    set [triangle fill: 1 v] to ((0.5) - ((0.5) / (Triangle Fill: 1)))\n    set [triangle fill: 2 v] to (((x position) - (ax)) / (Triangle Fill: 0))\n    set [triangle fill: 3 v] to (((y position) - (ay)) / (Triangle Fill: 0))\n    set [triangle fill: 4 v] to (((x position) - (bx)) / (Triangle Fill: 0))\n    set [triangle fill: 5 v] to (((y position) - (by)) / (Triangle Fill: 0))\n    set [triangle fill: 6 v] to (((x position) - (cx)) / (Triangle Fill: 0))\n    set [triangle fill: 7 v] to (((y position) - (cy)) / (Triangle Fill: 0))\n    repeat ([floor v] of (([log v] of ((1) / (Triangle Fill: 0)) ) / ([log v] of (Triangle Fill: 1) )) )\n        set [triangle fill: 0 v] to ((Triangle Fill: 1) * (Triangle Fill: 0))\n        set pen size to ((Triangle Fill: 0) + (0.5))\n        go to x: ((ax) + ((Triangle Fill: 0) * (Triangle Fill: 2))) y: ((ay) + ((Triangle Fill: 0) * (Triangle Fill: 3)))\n        go to x: ((bx) + ((Triangle Fill: 0) * (Triangle Fill: 4))) y: ((by) + ((Triangle Fill: 0) * (Triangle Fill: 5)))\n        go to x: ((cx) + ((Triangle Fill: 0) * (Triangle Fill: 6))) y: ((cy) + ((Triangle Fill: 0) * (Triangle Fill: 7)))\n        go to x: ((ax) + ((Triangle Fill: 0) * (Triangle Fill: 2))) y: ((ay) + ((Triangle Fill: 0) * (Triangle Fill: 3)))\n    end\nend\nset pen size to (resolution)\ngo to x: (ax) y: (ay)\ngo to x: (bx) y: (by)\ngo to x: (cx) y: (cy)\ngo to x: (ax) y: (ay)\npen up\n\ndefine Sort Surfaces\nTransform All Points\ndelete all of [surfaces: depth v]\ndelete all of [surfaces: order v]\ndelete all of [clipped surfaces: p1 v]\ndelete all of [clipped surfaces: p2 v]\ndelete all of [clipped surfaces: p3 v]\ndelete all of [clipped surfaces: perent v]\nset [index 1 v] to [1]\nrepeat (length of [surfaces: p1 v])\n    if <(item (Index 1) of [surfaces: type v]) = [1]> then\n        Load Triangle Surface (item (Index 1) of [surfaces: p1 v]) (item (Index 1) of [surfaces: p2 v]) (item (Index 1) of [surfaces: p3 v])\n    else\n        if <(item (Index 1) of [surfaces: type v]) = [2]> then\n            Load Line Surface (item (Index 1) of [surfaces: p1 v]) (item (Index 1) of [surfaces: p2 v])\n        else\n            if <(item (Index 1) of [surfaces: type v]) = [3]> then\n                Load Sphere Surface (item (Index 1) of [surfaces: p1 v])\n            end\n        end\n    end\n    change [index 1 v] by (1)\nend\nMerge Sort (length of [surfaces: depth v])\n\ndefine Load Triangle Surface (p1) (p2) (p3)\ndelete all of [temp list v]\nClip (item (p1) of [point data: x' v]) (item (p1) of [point data: y' v]) (item (p1) of [point data: z' v]) (item (p2) of [point data: x' v]) (item (p2) of [point data: y' v]) (item (p2) of [point data: z' v]) (p1)\nClip (item (p2) of [point data: x' v]) (item (p2) of [point data: y' v]) (item (p2) of [point data: z' v]) (item (p3) of [point data: x' v]) (item (p3) of [point data: y' v]) (item (p3) of [point data: z' v]) (p2)\nClip (item (p3) of [point data: x' v]) (item (p3) of [point data: y' v]) (item (p3) of [point data: z' v]) (item (p1) of [point data: x' v]) (item (p1) of [point data: y' v]) (item (p1) of [point data: z' v]) (p3)\nif <(length of [temp list v]) > [2]> then\n    Add Clipped Triangle Surface (item (1) of [temp list v]) (item (2) of [temp list v]) (item (3) of [temp list v])\n    if <(length of [temp list v]) = [4]> then\n        Add Clipped Triangle Surface (item (3) of [temp list v]) (item (4) of [temp list v]) (item (1) of [temp list v])\n    end\nend\n\ndefine Merge Sort (length)\nset [group size v] to [1]\nrepeat ([ceiling v] of (([log v] of (length) ) / ([log v] of (2) )) )\n    set [group size v] to ((Group Size) * (2))\n    Merge All Groups (Group Size) (length)\nend\n\ndefine Merge All Groups (gs) (ll)\nset [ig v] to [0]\nrepeat ([floor v] of ((ll) / (gs)) )\n    change [ig v] by (1)\n    Merge (((gs) * ((iG) - (1))) + (1)) ((gs) * ((iG) - (0.5))) and (((gs) * ((iG) - (0.5))) + (1)) ((gs) * (iG))\nend\nif <(((ll) mod (gs)) / (gs)) > [0.5]> then\n    change [ig v] by (1)\n    Merge (((gs) * ((iG) - (1))) + (1)) ((gs) * ((iG) - (0.5))) and (((gs) * ((iG) - (0.5))) + (1)) (ll)\nend\n\ndefine Merge (a min) (a max) and (b min) (b max)\nset [ib v] to (b min)\nrepeat (((a max) - (a min)) + (1))\n    repeat until <<(item (a min) of [surfaces: depth v]) > (item (iB) of [surfaces: depth v])> or <(iB) > (b max)>>\n        change [ib v] by (1)\n    end\n    insert (item (a min) of [surfaces: depth v]) at (iB) of [surfaces: depth v] \n    delete (a min) of [surfaces: depth v]\n    insert (item (a min) of [surfaces: order v]) at (iB) of [surfaces: order v] \n    delete (a min) of [surfaces: order v]\nend\n\ndefine Set Pen Color to RGB (r) (g) (b)\nset pen color to (((r) * (65536)) + (((g) * (256)) + (b)))\n\nwhen I receive [init: renderer v]\nswitch costume to (dot v)\nset size to (50000) %\nswitch costume to (big rect v)\n\nwhen I receive [system: rendering tick v]\nRender Surfaces\n\ndefine Clip (x1) (y1) (z1) (x2) (y2) (z2) (point)\nif <(z1) > [1]> then\n    add (point) to [temp list v]\nend\nif <(((z1) - (1)) * ((z2) - (1))) < [0]> then\n    add ((x1) - ((((x1) - (x2)) / ((z1) - (z2))) * ((z1) - (1)))) to [point data: x' v]\n    add ((y1) - ((((y1) - (y2)) / ((z1) - (z2))) * ((z1) - (1)))) to [point data: y' v]\n    add [1] to [point data: z' v]\n    Project Point (length of [point data: x' v])\n    add (length of [screen: x v]) to [temp list v]\nend\n\ndefine Add Clipped Triangle Surface (p1) (p2) (p3)\nif <[0] > ((((item (p2) of [screen: x v]) - (item (p1) of [screen: x v])) * ((item (p3) of [screen: y v]) - (item (p1) of [screen: y v]))) - (((item (p3) of [screen: x v]) - (item (p1) of [screen: x v])) * ((item (p2) of [screen: y v]) - (item (p1) of [screen: y v]))))> then\n    add (p1) to [clipped surfaces: p1 v]\n    add (p2) to [clipped surfaces: p2 v]\n    add (p3) to [clipped surfaces: p3 v]\n    add (Index 1) to [clipped surfaces: perent v]\n    add (((item (p1) of [point data: z' v]) + ((item (p2) of [point data: z' v]) + (item (p3) of [point data: z' v]))) / (3)) to [surfaces: depth v]\n    add (length of [clipped surfaces: p1 v]) to [surfaces: order v]\nend\n\ndefine Calculate World Matrix (rot x) (rot y) (rot z)\nset [world matrix: 11 v] to (([cos v] of (rot y) ) * ([cos v] of (rot z) ))\nset [world matrix: 12 v] to ((([sin v] of (rot x) ) * (([sin v] of (rot y) ) * ([cos v] of (rot z) ))) - (([cos v] of (rot x) ) * ([sin v] of (rot z) )))\nset [world matrix: 13 v] to ((([cos v] of (rot x) ) * (([sin v] of (rot y) ) * ([cos v] of (rot z) ))) + (([sin v] of (rot x) ) * ([sin v] of (rot z) )))\nset [world matrix: 21 v] to (([cos v] of (rot y) ) * ([sin v] of (rot z) ))\nset [world matrix: 22 v] to ((([sin v] of (rot x) ) * (([sin v] of (rot y) ) * ([sin v] of (rot z) ))) + (([cos v] of (rot x) ) * ([cos v] of (rot z) )))\nset [world matrix: 23 v] to ((([cos v] of (rot x) ) * (([sin v] of (rot y) ) * ([sin v] of (rot z) ))) - (([sin v] of (rot x) ) * ([cos v] of (rot z) )))\nset [world matrix: 31 v] to ((0) - ([sin v] of (rot y) ))\nset [world matrix: 32 v] to (([sin v] of (rot x) ) * ([cos v] of (rot y) ))\nset [world matrix: 33 v] to (([cos v] of (rot x) ) * ([cos v] of (rot y) ))\n\ndefine Apply World Transformations (x) (y) (z)\nadd ((((x) * (World Matrix: 11)) + (((y) * (World Matrix: 12)) + ((z) * (World Matrix: 13)))) + (item (Index 1) of [objects: x v])) to [temp list v]\nadd ((((x) * (World Matrix: 21)) + (((y) * (World Matrix: 22)) + ((z) * (World Matrix: 23)))) + (item (Index 1) of [objects: y v])) to [temp list v]\nadd ((((x) * (World Matrix: 31)) + (((y) * (World Matrix: 32)) + ((z) * (World Matrix: 33)))) + (item (Index 1) of [objects: z v])) to [temp list v]\n\ndefine Apply View Transformations (x) (y) (z)\nreplace item (1) of [temp list v] with ((((x) - (Camera: X)) * (View Matrix: 11)) + ((((y) - (Camera: Y)) * (View Matrix: 12)) + (((z) - (Camera: Z)) * (View Matrix: 13))))\nreplace item (2) of [temp list v] with ((((x) - (Camera: X)) * (View Matrix: 21)) + ((((y) - (Camera: Y)) * (View Matrix: 22)) + (((z) - (Camera: Z)) * (View Matrix: 23))))\nreplace item (3) of [temp list v] with ((((x) - (Camera: X)) * (View Matrix: 31)) + ((((y) - (Camera: Y)) * (View Matrix: 32)) + (((z) - (Camera: Z)) * (View Matrix: 33))))\n\ndefine Render Line Surface (p1) (p2) Width (width)\nset pen size to (((((width) * (480)) / (((item (p1) of [point data: z' v]) + (item (p2) of [point data: z' v])) / (2))) / (2)) + (0.5))\ngo to x: (item (p1) of [screen: x v]) y: (item (p1) of [screen: y v])\npen down\ngo to x: (item (p2) of [screen: x v]) y: (item (p2) of [screen: y v])\npen up\n\ndefine Render Sphere Surface (point) Diameter (diameter)\nset pen size to (((((diameter) * (480)) / (item (point) of [point data: z' v])) / (2)) + (0.5))\ngo to x: (item (point) of [screen: x v]) y: (item (point) of [screen: y v])\npen down\npen up\n\ndefine Load Line Surface (p1) (p2)\ndelete all of [temp list v]\nClip (item (p1) of [point data: x' v]) (item (p1) of [point data: y' v]) (item (p1) of [point data: z' v]) (item (p2) of [point data: x' v]) (item (p2) of [point data: y' v]) (item (p2) of [point data: z' v]) (p1)\nClip (item (p2) of [point data: x' v]) (item (p2) of [point data: y' v]) (item (p2) of [point data: z' v]) (item (p1) of [point data: x' v]) (item (p1) of [point data: y' v]) (item (p1) of [point data: z' v]) (p2)\nif <(length of [temp list v]) > [1]> then\n    add (item (1) of [temp list v]) to [clipped surfaces: p1 v]\n    add (item (2) of [temp list v]) to [clipped surfaces: p2 v]\n    add [] to [clipped surfaces: p3 v]\n    add (Index 1) to [clipped surfaces: perent v]\n    add (((item (item (1) of [temp list v]) of [point data: z' v]) + (item (item (2) of [temp list v]) of [point data: z' v])) / (2)) to [surfaces: depth v]\n    add (length of [clipped surfaces: p1 v]) to [surfaces: order v]\nend\n\ndefine Load Sphere Surface (point)\nif <(item (point) of [point data: z' v]) > [1]> then\n    add (point) to [clipped surfaces: p1 v]\n    add [] to [clipped surfaces: p2 v]\n    add [] to [clipped surfaces: p3 v]\n    add (Index 1) to [clipped surfaces: perent v]\n    add (item (point) of [point data: z' v]) to [surfaces: depth v]\n    add (length of [clipped surfaces: p1 v]) to [surfaces: order v]\nend\n\ndefine Render Plane (y)\nif <(y) > [-180]> then\n    if <(y) < [180]> then\n        Fill Triangle [240] (y) [240] [-180] [-240] [-180] Resolution [1]\n        Fill Triangle [-240] [-180] [-240] (y) [240] (y) Resolution [1]\n    else\n        Fill Triangle [240] [180] [240] [-180] [-240] [-180] Resolution [1]\n        Fill Triangle [-240] [-180] [-240] [180] [240] [180] Resolution [1]\n    end\nend\n\n@Signs\n\nwhen I receive [system: rendering tick v]\nif <not <(Nearest Sign) = []>> then\n    switch costume to (Nearest Sign)\n    show\nelse\n    hide\nend\n\nwhen flag clicked\ngo to x: (0) y: (-150)\nhide\n\n@End Screen\n\nwhen flag clicked\nhide\n\nwhen I receive [end credits v]\nwait (1) seconds\nset [ghost v] effect to (100)\nshow\nrepeat (100)\n    change [ghost v] effect by (-1)\nend\n\n@Audio\n\nwhen flag clicked\nforever\n    play sound [Dreadbox Typhon - One Synth Ambient_Cinematic Track v] until done\nend\n\nwhen I receive [end credits v]\nstop [other scripts in sprite v]\nstop all sounds\n\n