Cuber 3D - A Platformer (Alpha v1.10)

Instructions: Welcome to Cuber 3D - A Platformer!\n\nTurbowarp blocked? Use this one:\nhttps://mirror.turbowarp.xyz/?hqpen#721839318\n\nIt’s cool, right? So why don’t give it a love, favourite, comment or even a remix? And a follow for me? It’s gonna help a lot :D\n\nRunning this project on the Scratch website is really slow, so it’s highly recommend to run it on Turbowarp with HD graphics: https://turbowarp.org/721839318?hqpen\n\nThis is game is basically a demo of my first 3D engine, it works really inefficient and there is still a little problem with the depth sorting. So there are still a lot of improvements needed.\n\nWASD to move, arrow keys to move camera. Reach to the flag to go to the next level. Try aim to complete all 4 levels. Tell me in the comments if you have completed :)\n\nBefore you go, don’t forget to check out the editor too. Where you can create your own levels and play it!\n\nHere are the editor’s controls:\n\nIf you selected to move object:\nTo move an object, use WASD keys. To move up and down, use the R and F keys.\nTo change the scale of the object, use arrow keys. To change the Y scale, use the T and G keys.\n\nIf you selected to move camera:\nTo move the camera, use WASD keys. To move up and down, use the R and F keys.\nTo change the angle of the camera, use arrow keys.\n\nHave fun :)\n\nOriginal shared date: 20th August, 2022\nAdvertising is allowed at here :D\n\nUpdate log:\n\nV0.1 - Game released - 20th August, 2022\n\nV1.0 - Level 1-4 released - 22th September, 2022\n\nV1.1 - Improved depth sorting script - 23th September, 2022\n\nV1.2 - Reversed camera left and right rotation so it controls better - 24th September, 2022\n\nV1.3 - Added music - 25th September, 2022\n\nV1.4 - Added sound effects - 27th September, 2022\n\nV1.5 - Added level interactive buttons - 2nd October, 2022\n\nV1.6 - Added Turbowarp notice at the start - 4th October, 2022\n\nV1.7 - Oh heeeyyy the depth sorting script has improved a little more now :D - 6th October, 2022\n\nV1.8 - Fixed object rotations so it finally works! (The previous one is totally glitched out if you try rotate them) Even through it was never being used in the entire game LOL - 23rd October, 2022\n\nV1.9 - Did some minor changes to the congratulations message at the end, also moved the two lava pieces higher in level 4 - 12th November, 2022\n\nV1.10 - The depth sorting script is the major reason why this game runs extremely laggy. It has to keep parsing every time while sorting for each polygon. But after an improvement right now, it only need to parse once, and the game now runs at least 2× faster (Actually 4× faster on my device). Even though it’s still slow in other ways, but at least it now finally playable, right? - 12th November, 2022\n\n3D engine: Evininius 3D Engine v1.0\n\n#3D #Platformer\n\nEvininius 2022

@Stage\n\nwhen I receive [intro ended v]\nforever\n    play sound [Off to Osaka - Kevin MacLeod v] until done\nend\n\nwhen flag clicked\nforever\n    if <(Music) = [1]> then\n        set volume to (100) %\n    else\n        set volume to (0) %\n    end\nend\n\n@Blank\n\n@The whole 3D game\n\ndefine Render\nerase all\nset [at polygon v] to [0]\nrepeat (length of [sorted render data v])\n    change [at polygon v] by (1)\n    Read polygon data: (item (At polygon) of [sorted render data v])\n    set [x1 v] to ((Focal length) * ((Vertex1 X) / (Vertex1 Z)))\n    if <(X1) > [460]> then\n        set [x1 v] to [460]\n    end\n    if <(X1) < [-460]> then\n        set [x1 v] to [-460]\n    end\n    set [y1 v] to ((Focal length) * ((Vertex1 Y) / (Vertex1 Z)))\n    if <(Y1) > [340]> then\n        set [y1 v] to [340]\n    end\n    if <(Y1) < [-340]> then\n        set [y1 v] to [-340]\n    end\n    set [x2 v] to ((Focal length) * ((Vertex2 X) / (Vertex2 Z)))\n    if <(X2) > [460]> then\n        set [x2 v] to [460]\n    end\n    if <(X2) < [-460]> then\n        set [x2 v] to [-460]\n    end\n    set [y2 v] to ((Focal length) * ((Vertex2 Y) / (Vertex2 Z)))\n    if <(Y2) > [340]> then\n        set [y2 v] to [340]\n    end\n    if <(Y2) < [-340]> then\n        set [y2 v] to [-340]\n    end\n    set [x3 v] to ((Focal length) * ((Vertex3 X) / (Vertex3 Z)))\n    if <(X3) > [460]> then\n        set [x3 v] to [460]\n    end\n    if <(X3) < [-460]> then\n        set [x3 v] to [-460]\n    end\n    set [y3 v] to ((Focal length) * ((Vertex3 Y) / (Vertex3 Z)))\n    if <(Y3) > [340]> then\n        set [y3 v] to [340]\n    end\n    if <(Y3) < [-340]> then\n        set [y3 v] to [-340]\n    end\n    Draw polygon at Start X: (X1) Start Y: (Y1) Middle X: (X2) Middle Y: (Y2) End X: (X3) End Y: (Y3)\nend\n\ndefine Rotate to camera X angle X1: (x1) Z1: (z1) X2: (x2) Z2: (z2) X3: (x3) Z3: (z3)\nset [rotated vertex1 x v] to (((z1) * ([sin v] of (Camera X angle) )) + ((x1) * ([cos v] of (Camera X angle) )))\nset [rotated vertex1 z v] to (((z1) * ([cos v] of (Camera X angle) )) - ((x1) * ([sin v] of (Camera X angle) )))\nset [rotated vertex2 x v] to (((z2) * ([sin v] of (Camera X angle) )) + ((x2) * ([cos v] of (Camera X angle) )))\nset [rotated vertex2 z v] to (((z2) * ([cos v] of (Camera X angle) )) - ((x2) * ([sin v] of (Camera X angle) )))\nset [rotated vertex3 x v] to (((z3) * ([sin v] of (Camera X angle) )) + ((x3) * ([cos v] of (Camera X angle) )))\nset [rotated vertex3 z v] to (((z3) * ([cos v] of (Camera X angle) )) - ((x3) * ([sin v] of (Camera X angle) )))\n\ndefine Draw polygon at Start X: (x1) Start Y: (y1) Middle X: (x2) Middle Y: (y2) End X: (x3) End Y: (y3)\nset pen size to (Resolution)\nset pen (color v) to (Colour)\nset pen (saturation v) to (Saturation)\nset pen (brightness v) to (Brightness)\nset pen (transparency v) to (Transparency)\nset [next pen v] to [0]\nset [lines v] to (([sqrt v] of ((((x3) - (x1)) * ((x3) - (x1))) + (((y3) - (y1)) * ((y3) - (y1)))) ) / (Resolution))\nrepeat (Lines)\n    change [next pen v] by (1)\n    pen up\n    go to x: (x2) y: (y2)\n    pen down\n    go to x: (((((x1) - (x3)) / (Lines)) * (next pen)) + (x3)) y: (((((y1) - (y3)) / (Lines)) * (next pen)) + (y3))\nend\n\ndefine Rotate to camera Y angle Y1: (y1) Z1: (z1) Y2: (y2) Z2: (z2) Y3: (y3) Z3: (z3)\nset [rotated vertex1 y v] to (((z1) * ([sin v] of (Camera Y angle) )) + ((y1) * ([cos v] of (Camera Y angle) )))\nset [rotated vertex1 z v] to (((z1) * ([cos v] of (Camera Y angle) )) - ((y1) * ([sin v] of (Camera Y angle) )))\nset [rotated vertex2 y v] to (((z2) * ([sin v] of (Camera Y angle) )) + ((y2) * ([cos v] of (Camera Y angle) )))\nset [rotated vertex2 z v] to (((z2) * ([cos v] of (Camera Y angle) )) - ((y2) * ([sin v] of (Camera Y angle) )))\nset [rotated vertex3 y v] to (((z3) * ([sin v] of (Camera Y angle) )) + ((y3) * ([cos v] of (Camera Y angle) )))\nset [rotated vertex3 z v] to (((z3) * ([cos v] of (Camera Y angle) )) - ((y3) * ([sin v] of (Camera Y angle) )))\n\ndefine The full 3D script\n3D calculations\nSorting polygons from farest to closest\nRender\n\ndefine 3D calculations\ndelete all of [render data v]\nset [at polygon v] to [0]\nrepeat (length of [3d data v])\n    change [at polygon v] by (1)\n    Read polygon data: (item (At polygon) of [3d data v])\n    Rotate to camera X angle X1: ((Vertex1 X) + (Camera X)) Z1: ((Vertex1 Z) + (Camera Z)) X2: ((Vertex2 X) + (Camera X)) Z2: ((Vertex2 Z) + (Camera Z)) X3: ((Vertex3 X) + (Camera X)) Z3: ((Vertex3 Z) + (Camera Z))\n    Rotate to camera Y angle Y1: ((Vertex1 Y) + (Camera Y)) Z1: (Rotated vertex1 Z) Y2: ((Vertex2 Y) + (Camera Y)) Z2: (Rotated vertex2 Z) Y3: ((Vertex3 Y) + (Camera Y)) Z3: (Rotated vertex3 Z)\n    if <<<(Rotated vertex1 Z) > [0]> and <(Rotated vertex2 Z) > [0]>> and <(Rotated vertex3 Z) > [0]>> then\n        Join all data to polygon data\n        add (Joined result) to [render data v]\n    end\nend\n\ndefine Sorting polygons from farest to closest\ndelete all of [sorted render data v]\ndelete all of [distance v]\nset [current polygon v] to [0]\nrepeat (length of [render data v])\n    change [current polygon v] by (1)\n    Read current distance (Current polygon)\n    set [at item v] to [1]\n    if <not <(length of [sorted render data v]) = [0]>> then\n        repeat until <<not <(Current distance) < (item (At item) of [distance v])>> or <(At item) = (length of [sorted render data v])>>\n            change [at item v] by (1)\n        end\n    end\n    insert (item (Current polygon) of [render data v]) at (At item) of [sorted render data v] \n    insert (Current distance) at (At item) of [distance v] \nend\n\ndefine Read current distance (item)\nRead polygon data: (item (item) of [render data v])\nset [highest x v] to (Vertex1 X)\nset [lowest x v] to (Vertex1 X)\nset [highest y v] to (Vertex1 Y)\nset [lowest y v] to (Vertex1 Y)\nset [highest z v] to (Vertex1 Z)\nset [lowest z v] to (Vertex1 Z)\nif <(Vertex2 X) > (Highest X)> then\n    set [highest x v] to (Vertex2 X)\nend\nif <(Vertex2 X) < (Lowest X)> then\n    set [lowest x v] to (Vertex2 X)\nend\nif <(Vertex2 Y) > (Highest Y)> then\n    set [highest y v] to (Vertex2 Y)\nend\nif <(Vertex2 Y) < (Lowest Y)> then\n    set [lowest y v] to (Vertex2 Y)\nend\nif <(Vertex2 Z) > (Highest Z)> then\n    set [highest z v] to (Vertex2 Z)\nend\nif <(Vertex2 Z) < (Lowest Z)> then\n    set [lowest z v] to (Vertex2 Z)\nend\nif <(Vertex3 X) > (Highest X)> then\n    set [highest x v] to (Vertex3 X)\nend\nif <(Vertex3 X) < (Lowest X)> then\n    set [lowest x v] to (Vertex3 X)\nend\nif <(Vertex3 Y) > (Highest Y)> then\n    set [highest y v] to (Vertex3 Y)\nend\nif <(Vertex3 Y) < (Lowest Y)> then\n    set [lowest y v] to (Vertex3 Y)\nend\nif <(Vertex3 Z) > (Highest Z)> then\n    set [highest z v] to (Vertex3 Z)\nend\nif <(Vertex3 Z) < (Lowest Z)> then\n    set [lowest z v] to (Vertex3 Z)\nend\nset [center x v] to ((Lowest X) + (((Highest X) - (Lowest X)) / (2)))\nset [center y v] to ((Lowest Y) + (((Highest Y) - (Lowest Y)) / (2)))\nset [center z v] to (Highest Z)\nset [current distance v] to (((Center X) * (Center X)) + (((Center Y) * (Center Y)) + ((Center Z) * (Center Z))))\n\nset [at letter v] to [0]\nset [current item distance v] to []\nrepeat until <(letter ((At letter) + (1)) of (item (item) of [sorted render data v])) = [,]>\n    change [at letter v] by (1)\nend\nchange [at letter v] by (1)\nrepeat until <(letter ((At letter) + (1)) of (item (item) of [sorted render data v])) = [,]>\n    change [at letter v] by (1)\nend\nchange [at letter v] by (1)\nrepeat until <(letter ((At letter) + (1)) of (item (item) of [sorted render data v])) = [.]>\n    change [at letter v] by (1)\n    set [current item distance v] to (join (Current item distance) (letter (At letter) of (item (item) of [sorted render data v])))\nend\n\nadd [-20,-20,-20.-20,20,-20.20,-20,-20.65,100,100,0] to [player model v]\nadd [20,20,-20.-20,20,-20.20,-20,-20.65,100,100,0] to [player model v]\nadd [-20,-20,20.-20,20,20.20,-20,20.65,100,100,0] to [player model v]\nadd [20,20,20.-20,20,20.20,-20,20.65,100,100,0] to [player model v]\nadd [-20,-20,-20.-20,20,-20.-20,-20,20.65,100,100,0] to [player model v]\nadd [-20,20,20.-20,20,-20.-20,-20,20.65,100,100,0] to [player model v]\nadd [20,-20,-20.20,20,-20.20,-20,20.65,100,100,0] to [player model v]\nadd [20,20,20.20,20,-20.20,-20,20.65,100,100,0] to [player model v]\nadd [-20,20,-20.-20,20,20.20,20,20.65,100,100,0] to [player model v]\nadd [20,20,-20.-20,20,-20.20,20,20.65,100,100,0] to [player model v]\nadd [-20,-20,-20.-20,-20,20.20,-20,20.65,100,100,0] to [player model v]\nadd [20,-20,-20.-20,-20,-20.20,-20,20.65,100,100,0] to [player model v]\n\ndelete (3) of [player model v]\n\ndefine Add player object at X: (x) Y: (y) Z: (z) X angle: (x angle) Y angle: (y angle) Z angle: (z angle) X scale: (x scale) Y scale: (y scale) Z scale: (z scale)\nset [at polygon v] to [0]\nrepeat (length of [player model v])\n    change [at polygon v] by (1)\n    Read polygon data: (item (At polygon) of [player model v])\n    Transform X: (x) Y: (y) Z: (z) X angle: (x angle) Y angle: (y angle) Z angle: (z angle) X scale: (x scale) Y scale: (y scale) Z scale: (z scale)\n    Join all data to polygon data\n    add (Joined result) to [3d data v]\nend\n\ndelete all of [player model v]\n\ndefine Read polygon data: (data)\nset [at letter v] to [0]\nset [vertex1 x v] to []\nset [vertex1 y v] to []\nset [vertex1 z v] to []\nrepeat until <(letter ((At letter) + (1)) of (data)) = [,]>\n    change [at letter v] by (1)\n    set [vertex1 x v] to (join (Vertex1 X) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nrepeat until <(letter ((At letter) + (1)) of (data)) = [,]>\n    change [at letter v] by (1)\n    set [vertex1 y v] to (join (Vertex1 Y) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nrepeat until <(letter ((At letter) + (1)) of (data)) = [.]>\n    change [at letter v] by (1)\n    set [vertex1 z v] to (join (Vertex1 Z) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nset [vertex2 x v] to []\nset [vertex2 y v] to []\nset [vertex2 z v] to []\nrepeat until <(letter ((At letter) + (1)) of (data)) = [,]>\n    change [at letter v] by (1)\n    set [vertex2 x v] to (join (Vertex2 X) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nrepeat until <(letter ((At letter) + (1)) of (data)) = [,]>\n    change [at letter v] by (1)\n    set [vertex2 y v] to (join (Vertex2 Y) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nrepeat until <(letter ((At letter) + (1)) of (data)) = [.]>\n    change [at letter v] by (1)\n    set [vertex2 z v] to (join (Vertex2 Z) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nset [vertex3 x v] to []\nset [vertex3 y v] to []\nset [vertex3 z v] to []\nrepeat until <(letter ((At letter) + (1)) of (data)) = [,]>\n    change [at letter v] by (1)\n    set [vertex3 x v] to (join (Vertex3 X) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nrepeat until <(letter ((At letter) + (1)) of (data)) = [,]>\n    change [at letter v] by (1)\n    set [vertex3 y v] to (join (Vertex3 Y) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nrepeat until <(letter ((At letter) + (1)) of (data)) = [.]>\n    change [at letter v] by (1)\n    set [vertex3 z v] to (join (Vertex3 Z) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nset [colour v] to []\nset [saturation v] to []\nset [brightness v] to []\nset [transparency v] to []\nrepeat until <(letter ((At letter) + (1)) of (data)) = [,]>\n    change [at letter v] by (1)\n    set [colour v] to (join (Colour) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nrepeat until <(letter ((At letter) + (1)) of (data)) = [,]>\n    change [at letter v] by (1)\n    set [saturation v] to (join (Saturation) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nrepeat until <(letter ((At letter) + (1)) of (data)) = [,]>\n    change [at letter v] by (1)\n    set [brightness v] to (join (Brightness) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nrepeat until <(At letter) = (length of (data))>\n    change [at letter v] by (1)\n    set [transparency v] to (join (Transparency) (letter (At letter) of (data)))\nend\n\nadd [-20,-20,-20.-20,20,-20.20,-20,-20.10,100,100,0] to [ground model v]\nadd [20,20,-20.-20,20,-20.20,-20,-20.10,100,100,0] to [ground model v]\nadd [-20,-20,20.-20,20,20.20,-20,20.10,100,100,0] to [ground model v]\nadd [20,20,20.-20,20,20.20,-20,20.10,100,100,0] to [ground model v]\nadd [-20,-20,-20.-20,20,-20.-20,-20,20.10,100,100,0] to [ground model v]\nadd [-20,20,20.-20,20,-20.-20,-20,20.10,100,100,0] to [ground model v]\nadd [20,-20,-20.20,20,-20.20,-20,20.10,100,100,0] to [ground model v]\nadd [20,20,20.20,20,-20.20,-20,20.10,100,100,0] to [ground model v]\nadd [-20,20,-20.-20,20,20.20,20,20.30,100,100,0] to [ground model v]\nadd [20,20,-20.-20,20,-20.20,20,20.30,100,100,0] to [ground model v]\nadd [-20,-20,-20.-20,-20,20.20,-20,20.10,100,100,0] to [ground model v]\nadd [20,-20,-20.-20,-20,-20.20,-20,20.10,100,100,0] to [ground model v]\n\ndelete all of [ground model v]\n\ndefine Add ground object at X: (x) Y: (y) Z: (z) X angle: (x angle) Y angle: (y angle) Z angle: (z angle) X scale: (x scale) Y scale: (y scale) Z scale: (z scale)\nset [at polygon v] to [0]\nrepeat (length of [ground model v])\n    change [at polygon v] by (1)\n    Read polygon data: (item (At polygon) of [ground model v])\n    Transform X: (x) Y: (y) Z: (z) X angle: (x angle) Y angle: (y angle) Z angle: (z angle) X scale: (x scale) Y scale: (y scale) Z scale: (z scale)\n    Join all data to polygon data\n    add (Joined result) to [3d data v]\nend\n\ndefine Read object data: (data)\nset [at letter v] to [0]\nset [object type v] to []\nrepeat until <(letter ((At letter) + (1)) of (data)) = [.]>\n    change [at letter v] by (1)\n    set [object type v] to (join (Object type) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nset [x position v] to []\nset [y position v] to []\nset [z position v] to []\nrepeat until <(letter ((At letter) + (1)) of (data)) = [,]>\n    change [at letter v] by (1)\n    set [x position v] to (join (X position) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nrepeat until <(letter ((At letter) + (1)) of (data)) = [,]>\n    change [at letter v] by (1)\n    set [y position v] to (join (Y position) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nrepeat until <(letter ((At letter) + (1)) of (data)) = [.]>\n    change [at letter v] by (1)\n    set [z position v] to (join (Z position) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nset [x scale v] to []\nset [y scale v] to []\nset [z scale v] to []\nrepeat until <(letter ((At letter) + (1)) of (data)) = [,]>\n    change [at letter v] by (1)\n    set [x scale v] to (join (X scale) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nrepeat until <(letter ((At letter) + (1)) of (data)) = [,]>\n    change [at letter v] by (1)\n    set [y scale v] to (join (Y scale) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nrepeat until <(At letter) = (length of (data))>\n    change [at letter v] by (1)\n    set [z scale v] to (join (Z scale) (letter (At letter) of (data)))\nend\n\ndefine Transform X: (x) Y: (y) Z: (z) X angle: (x angle) Y angle: (y angle) Z angle: (z angle) X scale: (x scale) Y scale: (y scale) Z scale: (z scale)\nset [vertex1 x v] to ((Vertex1 X) * (x scale))\nset [vertex1 y v] to ((Vertex1 Y) * (y scale))\nset [vertex1 z v] to ((Vertex1 Z) * (z scale))\nset [vertex2 x v] to ((Vertex2 X) * (x scale))\nset [vertex2 y v] to ((Vertex2 Y) * (y scale))\nset [vertex2 z v] to ((Vertex2 Z) * (z scale))\nset [vertex3 x v] to ((Vertex3 X) * (x scale))\nset [vertex3 y v] to ((Vertex3 Y) * (y scale))\nset [vertex3 z v] to ((Vertex3 Z) * (z scale))\nset [rotated vertex1 x v] to (Vertex1 X)\nset [rotated vertex1 y v] to (((Vertex1 Y) * ([cos v] of (x angle) )) - ((Vertex1 Z) * ([sin v] of (x angle) )))\nset [rotated vertex1 z v] to (((Vertex1 Y) * ([sin v] of (x angle) )) + ((Vertex1 Z) * ([cos v] of (x angle) )))\nset [rotated vertex2 x v] to (Vertex2 X)\nset [rotated vertex2 y v] to (((Vertex2 Y) * ([cos v] of (x angle) )) - ((Vertex2 Z) * ([sin v] of (x angle) )))\nset [rotated vertex2 z v] to (((Vertex2 Y) * ([sin v] of (x angle) )) + ((Vertex2 Z) * ([cos v] of (x angle) )))\nset [rotated vertex3 x v] to (Vertex3 X)\nset [rotated vertex3 y v] to (((Vertex3 Y) * ([cos v] of (x angle) )) - ((Vertex3 Z) * ([sin v] of (x angle) )))\nset [rotated vertex3 z v] to (((Vertex3 Y) * ([sin v] of (x angle) )) + ((Vertex3 Z) * ([cos v] of (x angle) )))\nUpdate values to be rotated\nset [rotated vertex1 x v] to (((Vertex1 Z) * ([sin v] of (y angle) )) + ((Vertex1 X) * ([cos v] of (y angle) )))\nset [rotated vertex1 y v] to (Vertex1 Y)\nset [rotated vertex1 z v] to (((Vertex1 Z) * ([cos v] of (y angle) )) - ((Vertex1 X) * ([sin v] of (y angle) )))\nset [rotated vertex2 x v] to (((Vertex2 Z) * ([sin v] of (y angle) )) + ((Vertex2 X) * ([cos v] of (y angle) )))\nset [rotated vertex2 y v] to (Vertex2 Y)\nset [rotated vertex2 z v] to (((Vertex2 Z) * ([cos v] of (y angle) )) - ((Vertex2 X) * ([sin v] of (y angle) )))\nset [rotated vertex3 x v] to (((Vertex3 Z) * ([sin v] of (y angle) )) + ((Vertex3 X) * ([cos v] of (y angle) )))\nset [rotated vertex3 y v] to (Vertex3 Y)\nset [rotated vertex3 z v] to (((Vertex3 Z) * ([cos v] of (y angle) )) - ((Vertex3 X) * ([sin v] of (y angle) )))\nUpdate values to be rotated\nset [rotated vertex1 x v] to (((Vertex1 X) * ([cos v] of (z angle) )) - ((Vertex1 Y) * ([sin v] of (z angle) )))\nset [rotated vertex1 y v] to (((Vertex1 X) * ([sin v] of (z angle) )) + ((Vertex1 Y) * ([cos v] of (z angle) )))\nset [rotated vertex1 z v] to (Vertex1 Z)\nset [rotated vertex2 x v] to (((Vertex2 X) * ([cos v] of (z angle) )) - ((Vertex2 Y) * ([sin v] of (z angle) )))\nset [rotated vertex2 y v] to (((Vertex2 X) * ([sin v] of (z angle) )) + ((Vertex2 Y) * ([cos v] of (z angle) )))\nset [rotated vertex2 z v] to (Vertex2 Z)\nset [rotated vertex3 x v] to (((Vertex3 X) * ([cos v] of (z angle) )) - ((Vertex3 Y) * ([sin v] of (z angle) )))\nset [rotated vertex3 y v] to (((Vertex3 X) * ([sin v] of (z angle) )) + ((Vertex3 Y) * ([cos v] of (z angle) )))\nset [rotated vertex3 z v] to (Vertex3 Z)\nset [rotated vertex1 x v] to ((Rotated vertex1 X) + (x))\nset [rotated vertex1 y v] to ((Rotated vertex1 Y) + (y))\nset [rotated vertex1 z v] to ((Rotated vertex1 Z) + (z))\nset [rotated vertex2 x v] to ((Rotated vertex2 X) + (x))\nset [rotated vertex2 y v] to ((Rotated vertex2 Y) + (y))\nset [rotated vertex2 z v] to ((Rotated vertex2 Z) + (z))\nset [rotated vertex3 x v] to ((Rotated vertex3 X) + (x))\nset [rotated vertex3 y v] to ((Rotated vertex3 Y) + (y))\nset [rotated vertex3 z v] to ((Rotated vertex3 Z) + (z))\n\ndefine Join all data to polygon data\nset [joined result v] to (join (join (join (join (join (join (join (join (join (join (join (join (join (join (join (join (join (join (join (join (join (join (join (join (round (Rotated vertex1 X)) [,]) (round (Rotated vertex1 Y))) [,]) (round (Rotated vertex1 Z))) [.]) (round (Rotated vertex2 X))) [,]) (round (Rotated vertex2 Y))) [,]) (round (Rotated vertex2 Z))) [.]) (round (Rotated vertex3 X))) [,]) (round (Rotated vertex3 Y))) [,]) (round (Rotated vertex3 Z))) [.]) (round (Colour))) [,]) (round (Saturation))) [,]) (round (Brightness))) [,]) (round (Transparency)))\n\nwhen I receive [start background v]\nLoad level [Title screen]\nforever\n    if <(Player X angle) = [360]> then\n        set [player x angle v] to [0]\n    else\n        change [player x angle v] by (1)\n    end\n    Camera positioning\n    Add objects\n    The full 3D script\nend\n\ndefine Add objects\ndelete all of [3d data v]\nAdd player object at X: (Player X) Y: (Player Y) Z: (Player Z) X angle: [0] Y angle: [0] Z angle: [0] X scale: [1] Y scale: [1] Z scale: [1]\nAdd flag object at X: (Flag X) Y: (Flag Y) Z: (Flag Z) X angle: [0] Y angle: [0] Z angle: [0] X scale: [1] Y scale: [1] Z scale: [1]\nset [at object v] to [0]\nrepeat (length of [object data v])\n    change [at object v] by (1)\n    Read object data: (item (At object) of [object data v])\n    if <(Object type) = [1]> then\n        Add ground object at X: (X position) Y: (Y position) Z: (Z position) X angle: [0] Y angle: [0] Z angle: [0] X scale: (X scale) Y scale: (Y scale) Z scale: (Z scale)\n    end\n    if <(Object type) = [2]> then\n        Add lava object at X: (X position) Y: (Y position) Z: (Z position) X angle: [0] Y angle: [0] Z angle: [0] X scale: (X scale) Y scale: (Y scale) Z scale: (Z scale)\n    end\n    if <(Object type) = [3]> then\n        Add spike object at X: (X position) Y: (Y position) Z: (Z position) X angle: [0] Y angle: [0] Z angle: [0] X scale: (X scale) Y scale: (Y scale) Z scale: (Z scale)\n    end\n    if <(Object type) = [4]> then\n        Add rock object at X: (X position) Y: (Y position) Z: (Z position) X angle: [0] Y angle: [0] Z angle: [0] X scale: (X scale) Y scale: (Y scale) Z scale: (Z scale)\n    end\n    if <(Object type) = [5]> then\n        Add bush object at X: (X position) Y: (Y position) Z: (Z position) X angle: [0] Y angle: [0] Z angle: [0] X scale: (X scale) Y scale: (Y scale) Z scale: (Z scale)\n    end\nend\n\ndefine Add lava object at X: (x) Y: (y) Z: (z) X angle: (x angle) Y angle: (y angle) Z angle: (z angle:) X scale: (x scale) Y scale: (y scale) Z scale: (z scale)\nset [at polygon v] to [0]\nrepeat (length of [lava model v])\n    change [at polygon v] by (1)\n    Read polygon data: (item (At polygon) of [lava model v])\n    Transform X: (x) Y: (y) Z: (z) X angle: (x angle) Y angle: (y angle) Z angle: (z angle) X scale: (x scale) Y scale: (y scale) Z scale: (z scale)\n    Join all data to polygon data\n    add (Joined result) to [3d data v]\nend\n\nadd [-20,-20,-20.-20,20,-20.20,-20,-20.0,100,100,0] to [lava model v]\nadd [20,20,-20.-20,20,-20.20,-20,-20.0,100,100,0] to [lava model v]\nadd [-20,-20,20.-20,20,20.20,-20,20.0,100,100,0] to [lava model v]\nadd [20,20,20.-20,20,20.20,-20,20.0,100,100,0] to [lava model v]\nadd [-20,-20,-20.-20,20,-20.-20,-20,20.0,100,100,0] to [lava model v]\nadd [-20,20,20.-20,20,-20.-20,-20,20.0,100,100,0] to [lava model v]\nadd [20,-20,-20.20,20,-20.20,-20,20.0,100,100,0] to [lava model v]\nadd [20,20,20.20,20,-20.20,-20,20.0,100,100,0] to [lava model v]\nadd [-20,20,-20.-20,20,20.20,20,20.0,100,100,0] to [lava model v]\nadd [20,20,-20.-20,20,-20.20,20,20.0,100,100,0] to [lava model v]\nadd [-20,-20,-20.-20,-20,20.20,-20,20.0,100,100,0] to [lava model v]\nadd [20,-20,-20.-20,-20,-20.20,-20,20.0,100,100,0] to [lava model v]\n\ndelete all of [lava model v]\n\ndelete all of [title screen v]\nadd [1.0,-40,0.10,1,15] to [title screen v]\nadd [1.-200,80,-120.2,1,2] to [title screen v]\nadd [1.-200,120,0.2,1,2] to [title screen v]\nadd [1.-200,160,120.2,1,2] to [title screen v]\nadd [3.-40,0,80.1,1,1] to [title screen v]\nadd [2.0,0,160.10,1,1] to [title screen v]\nadd [4.160,0,-120.1,1,2] to [title screen v]\nadd [5.-160,0,-160.1,1,2] to [title screen v]\n\nadd [-20,-20,-20.0,20,0.20,-20,-20.0,0,80,0] to [spike model v]\nadd [20,-20,-20.0,20,0.20,-20,20.0,0,70,0] to [spike model v]\nadd [20,-20,20.0,20,0.-20,-20,20.0,0,80,0] to [spike model v]\nadd [-20,-20,20.0,20,0.-20,-20,-20.0,0,70,0] to [spike model v]\nadd [-20,-20,-20.-20,-20,20.20,-20,20.0,0,80,0] to [spike model v]\nadd [20,-20,-20.-20,-20,-20.20,-20,20.0,0,80,0] to [spike model v]\n\ndelete all of [spike model v]\n\ndefine Add spike object at X: (x) Y: (y) Z: (z) X angle: (x angle) Y angle: (y angle) Z angle: (z angle) X scale: (x scale) Y scale: (y scale) Z scale: (z scale)\nset [at polygon v] to [0]\nrepeat (length of [spike model v])\n    change [at polygon v] by (1)\n    Read polygon data: (item (At polygon) of [spike model v])\n    Transform X: (x) Y: (y) Z: (z) X angle: (x angle) Y angle: (y angle) Z angle: (z angle) X scale: (x scale) Y scale: (y scale) Z scale: (z scale)\n    Join all data to polygon data\n    add (Joined result) to [3d data v]\nend\n\nadd [-20,-20,-20.-20,20,-20.20,-20,-20.0,0,60,0] to [rock model v]\nadd [20,20,-20.-20,20,-20.20,-20,-20.0,0,60,0] to [rock model v]\nadd [-20,-20,20.-20,20,20.20,-20,20.0,0,60,0] to [rock model v]\nadd [20,20,20.-20,20,20.20,-20,20.0,0,60,0] to [rock model v]\nadd [-20,-20,-20.-20,20,-20.-20,-20,20.0,0,60,0] to [rock model v]\nadd [-20,20,20.-20,20,-20.-20,-20,20.0,0,60,0] to [rock model v]\nadd [20,-20,-20.20,20,-20.20,-20,20.0,0,60,0] to [rock model v]\nadd [20,20,20.20,20,-20.20,-20,20.0,0,60,0] to [rock model v]\nadd [-20,20,-20.-20,20,20.20,20,20.0,0,60,0] to [rock model v]\nadd [20,20,-20.-20,20,-20.20,20,20.0,0,60,0] to [rock model v]\nadd [-20,-20,-20.-20,-20,20.20,-20,20.0,0,60,0] to [rock model v]\nadd [20,-20,-20.-20,-20,-20.20,-20,20.0,0,60,0] to [rock model v]\n\ndelete all of [rock model v]\n\ndefine Add rock object at X: (x) Y: (y) Z: (z) X angle: (x angle) Y angle: (y angle) Z angle: (z angle) X scale: (x scale) Y scale: (y scale) Z scale: (z scale)\nset [at polygon v] to [0]\nrepeat (length of [rock model v])\n    change [at polygon v] by (1)\n    Read polygon data: (item (At polygon) of [rock model v])\n    Transform X: (x) Y: (y) Z: (z) X angle: (x angle) Y angle: (y angle) Z angle: (z angle) X scale: (x scale) Y scale: (y scale) Z scale: (z scale)\n    Join all data to polygon data\n    add (Joined result) to [3d data v]\nend\n\ndefine Add bush object at X: (x) Y: (y) Z: (z) X angle: (x angle) Y angle: (y angle) Z angle: (z angle) X scale: (x scale) Y scale: (y scale) Z scale: (z scale)\nset [at polygon v] to [0]\nrepeat (length of [bush model v])\n    change [at polygon v] by (1)\n    Read polygon data: (item (At polygon) of [bush model v])\n    Transform X: (x) Y: (y) Z: (z) X angle: (x angle) Y angle: (y angle) Z angle: (z angle) X scale: (x scale) Y scale: (y scale) Z scale: (z scale)\n    Join all data to polygon data\n    add (Joined result) to [3d data v]\nend\n\nadd [-20,-20,-20.-20,20,-20.20,-20,-20.30,100,55,0] to [bush model v]\nadd [20,20,-20.-20,20,-20.20,-20,-20.30,100,55,0] to [bush model v]\nadd [-20,-20,20.-20,20,20.20,-20,20.30,100,55,0] to [bush model v]\nadd [20,20,20.-20,20,20.20,-20,20.30,100,55,0] to [bush model v]\nadd [-20,-20,-20.-20,20,-20.-20,-20,20.30,100,55,0] to [bush model v]\nadd [-20,20,20.-20,20,-20.-20,-20,20.30,100,55,0] to [bush model v]\nadd [20,-20,-20.20,20,-20.20,-20,20.30,100,55,0] to [bush model v]\nadd [20,20,20.20,20,-20.20,-20,20.30,100,55,0] to [bush model v]\nadd [-20,20,-20.-20,20,20.20,20,20.30,100,55,0] to [bush model v]\nadd [20,20,-20.-20,20,-20.20,20,20.30,100,55,0] to [bush model v]\nadd [-20,-20,-20.-20,-20,20.20,-20,20.30,100,55,0] to [bush model v]\nadd [20,-20,-20.-20,-20,-20.20,-20,20.30,100,55,0] to [bush model v]\n\ndelete all of [bush model v]\n\ndefine Rotate camera to player Y angle: (y angle) Camera Y: (camera y) Camera Z: (camera z)\nset [camera y v] to (((camera z) * ([sin v] of (y angle) )) + ((camera y) * ([cos v] of (y angle) )))\nset [camera z v] to (((camera z) * ([cos v] of (y angle) )) - ((camera y) * ([sin v] of (y angle) )))\n\ndefine Rotate camera to player X angle: (x angle) Camera X: (camera x) Camera Z: (camera z)\nset [camera x v] to (((camera z) * ([sin v] of (x angle) )) + ((camera x) * ([cos v] of (x angle) )))\nset [camera z v] to (((camera z) * ([cos v] of (x angle) )) - ((camera x) * ([sin v] of (x angle) )))\n\ndefine Point camera to player\nset [camera x angle v] to ((Player X angle) * (-1))\nset [camera y angle v] to ((player Y angle) * (-1))\n\nif <(Rotated vertex1 Z) < [100]> then\n    set [rotated vertex1 z v] to [100]\nend\nif <(Rotated vertex2 Z) < [100]> then\n    set [rotated vertex2 z v] to [100]\nend\nif <(Rotated vertex3 Z) < [100]> then\n    set [rotated vertex3 z v] to [100]\nend\n\nwhen I receive [start background v]\nset [player x angle v] to [90]\nset [player y angle v] to [-85]\nset [speed v] to [20]\nrepeat (20)\n    change [player x angle v] by (Speed)\n    change [player y angle v] by (3)\n    change [speed v] by (-1)\nend\n\nwhen I receive [start game v]\nstop [other scripts in sprite v]\nset [level v] to [1]\nbroadcast (Start level v)\n\ndefine Load level (selection)\nLoad player and flag position data (item ((selection) + (1)) of [player starting position and flag data v])\ndelete all of [object data v]\nif <(selection) = [Title screen]> then\n    set [at object v] to [0]\n    repeat (length of [title screen v])\n        change [at object v] by (1)\n        add (item (At object) of [title screen v]) to [object data v]\n    end\nend\nif <(selection) = [1]> then\n    set [at object v] to [0]\n    repeat (length of [level 1 v])\n        change [at object v] by (1)\n        add (item (At object) of [level 1 v]) to [object data v]\n    end\nend\nif <(selection) = [2]> then\n    set [at object v] to [0]\n    repeat (length of [level 2 v])\n        change [at object v] by (1)\n        add (item (At object) of [level 2 v]) to [object data v]\n    end\nend\nif <(selection) = [3]> then\n    set [at object v] to [0]\n    repeat (length of [level 3 v])\n        change [at object v] by (1)\n        add (item (At object) of [level 3 v]) to [object data v]\n    end\nend\nif <(selection) = [4]> then\n    set [at object v] to [0]\n    repeat (length of [level 4 v])\n        change [at object v] by (1)\n        add (item (At object) of [level 4 v]) to [object data v]\n    end\nend\nif <(selection) = [5]> then\n    set [at object v] to [0]\n    repeat (length of [editor level 1 v])\n        change [at object v] by (1)\n        add (item (At object) of [editor level 1 v]) to [object data v]\n    end\nend\nif <(selection) = [6]> then\n    set [at object v] to [0]\n    repeat (length of [editor level 2 v])\n        change [at object v] by (1)\n        add (item (At object) of [editor level 2 v]) to [object data v]\n    end\nend\nif <(selection) = [7]> then\n    set [at object v] to [0]\n    repeat (length of [editor level 3 v])\n        change [at object v] by (1)\n        add (item (At object) of [editor level 3 v]) to [object data v]\n    end\nend\nif <(selection) = [8]> then\n    set [at object v] to [0]\n    repeat (length of [editor level 4 v])\n        change [at object v] by (1)\n        add (item (At object) of [editor level 4 v]) to [object data v]\n    end\nend\n\ndefine Add flag object at X: (x) Y: (y) Z: (z) X angle: (x angle) Y angle: (y angle) Z angle: (z angle) X scale: (x scale) Y scale: (y scale) Z scale: (z scale)\nset [at polygon v] to [0]\nrepeat (length of [flag model v])\n    change [at polygon v] by (1)\n    Read polygon data: (item (At polygon) of [flag model v])\n    Transform X: (x) Y: (y) Z: (z) X angle: (x angle) Y angle: (y angle) Z angle: (z angle) X scale: (x scale) Y scale: (y scale) Z scale: (z scale)\n    Join all data to polygon data\n    add (Joined result) to [3d data v]\nend\n\nadd [-20,-20,0.-20,20,0.-10,20,0.0,0,65,0] to [flag model v]\nadd [-20,20,0.20,10,0.-20,0,0.65,100,100,0] to [flag model v]\n\ndelete all of [flag model v]\n\nwhen I receive [start level v]\nLoad level (Level)\nset [player x angle v] to [0]\nset [player y angle v] to [-45]\nforever\n    if <(Game Paused?) = [0]> then\n        Platformer script\n        Detect collision at X: (Player X) Y: (Player Y) Z: (Player Z)\n        if <<(Player Y) < [-500]> and <(SFX) = [1]>> then\n            start sound [Falling sound effect v]\n        end\n        if <<(Collision?) = [2]> or <(Player Y) < [-500]>> then\n            Load player and flag position data (item ((Level) + (1)) of [player starting position and flag data v])\n        end\n        if <(Collision?) = [3]> then\n            if <(Level) = [4]> then\n                broadcast (Congratulations message v)\n                stop [this script v]\n            else\n                change [level v] by (1)\n                broadcast (Start level v)\n            end\n        end\n    end\n    Camera positioning\n    Add objects\n    The full 3D script\nend\n\ndefine Camera positioning\nset [camera x v] to [0]\nset [camera y v] to [0]\nset [camera z v] to [450]\nRotate camera to player Y angle: (player Y angle) Camera Y: (Camera X) Camera Z: (Camera Z)\nRotate camera to player X angle: (Player X angle) Camera X: (Camera X) Camera Z: (Camera Z)\nPoint camera to player\nset [camera x v] to ((Camera X) - (Player X))\nset [camera y v] to ((Camera Y) - (Player Y))\nset [camera z v] to ((Camera Z) - (Player Z))\n\ndefine Detect collision at X: (x) Y: (y) Z: (z)\nset [collision? v] to [0]\nset [at object v] to [0]\nrepeat (length of [object data v])\n    change [at object v] by (1)\n    Read object data: (item (At object) of [object data v])\n    Detect X: (x) Y: (y) Z: (z)\n    if <(Collision detected?) = [1]> then\n        if <<(Object type) = [2]> or <(Object type) = [3]>> then\n            set [collision? v] to [2]\n        else\n            set [collision? v] to [1]\n        end\n    end\nend\nset [x position v] to (Flag X)\nset [y position v] to (Flag Y)\nset [z position v] to (Flag Z)\nset [x scale v] to [1]\nset [y scale v] to [1]\nset [z scale v] to [1]\nDetect X: (x) Y: (y) Z: (z)\nif <(Collision detected?) = [1]> then\n    set [collision? v] to [3]\nend\n\ndefine Platformer script\nif <key (w v) pressed?> then\n    change [player x v] by ((-10) * ([cos v] of ((Player X angle) + (90)) ))\n    change [player z v] by ((10) * ([sin v] of ((Player X angle) + (90)) ))\n    Detect collision at X: (Player X) Y: (Player Y) Z: (Player Z)\n    if <(Collision?) = [1]> then\n        change [player x v] by ((10) * ([cos v] of ((Player X angle) + (90)) ))\n        change [player z v] by ((-10) * ([sin v] of ((Player X angle) + (90)) ))\n    end\nend\nif <key (s v) pressed?> then\n    change [player x v] by ((10) * ([cos v] of ((Player X angle) + (90)) ))\n    change [player z v] by ((-10) * ([sin v] of ((Player X angle) + (90)) ))\n    Detect collision at X: (Player X) Y: (Player Y) Z: (Player Z)\n    if <(Collision?) = [1]> then\n        change [player x v] by ((-10) * ([cos v] of ((Player X angle) + (90)) ))\n        change [player z v] by ((10) * ([sin v] of ((Player X angle) + (90)) ))\n    end\nend\nif <key (a v) pressed?> then\n    change [player x v] by ((-10) * ([cos v] of (Player X angle) ))\n    change [player z v] by ((10) * ([sin v] of (Player X angle) ))\n    Detect collision at X: (Player X) Y: (Player Y) Z: (Player Z)\n    if <(Collision?) = [1]> then\n        change [player x v] by ((10) * ([cos v] of (Player X angle) ))\n        change [player z v] by ((-10) * ([sin v] of (Player X angle) ))\n    end\nend\nif <key (d v) pressed?> then\n    change [player x v] by ((10) * ([cos v] of (Player X angle) ))\n    change [player z v] by ((-10) * ([sin v] of (Player X angle) ))\n    Detect collision at X: (Player X) Y: (Player Y) Z: (Player Z)\n    if <(Collision?) = [1]> then\n        change [player x v] by ((-10) * ([cos v] of (Player X angle) ))\n        change [player z v] by ((-10) * ([sin v] of (Player X angle) ))\n    end\nend\nif <key (space v) pressed?> then\n    Detect collision at X: (Player X) Y: ((Player Y) - (5)) Z: (Player Z)\n    if <(Collision?) = [1]> then\n        set [going up? v] to [20]\n    end\nend\nif <(Going up?) > [0]> then\n    change [player y v] by (10)\n    change [going up? v] by (-1)\n    Detect collision at X: (Player X) Y: (Player Y) Z: (Player Z)\n    if <(Collision?) = [1]> then\n        set [going up? v] to [0]\n        change [player y v] by (-10)\n    end\nelse\n    change [player y v] by (-10)\n    Detect collision at X: (Player X) Y: (Player Y) Z: (Player Z)\n    if <(Collision?) = [1]> then\n        change [player y v] by (10)\n    end\nend\nif <key (up arrow v) pressed?> then\n    if <(player Y angle) > [-90]> then\n        change [player y angle v] by (-5)\n    end\nend\nif <key (down arrow v) pressed?> then\n    if <(player Y angle) < [0]> then\n        change [player y angle v] by (5)\n    end\nend\nif <key (left arrow v) pressed?> then\n    if <(Player X angle) = [0]> then\n        set [player x angle v] to [360]\n    else\n        change [player x angle v] by (-5)\n    end\nend\nif <key (right arrow v) pressed?> then\n    if <(Player X angle) = [360]> then\n        set [player x angle v] to [0]\n    else\n        change [player x angle v] by (5)\n    end\nend\n\ndefine Load player and flag position data (data)\nset [at letter v] to [0]\nset [player x v] to []\nset [player y v] to []\nset [player z v] to []\nrepeat until <(letter ((At letter) + (1)) of (data)) = [,]>\n    change [at letter v] by (1)\n    set [player x v] to (join (Player X) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nrepeat until <(letter ((At letter) + (1)) of (data)) = [,]>\n    change [at letter v] by (1)\n    set [player y v] to (join (Player Y) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nrepeat until <(letter ((At letter) + (1)) of (data)) = [.]>\n    change [at letter v] by (1)\n    set [player z v] to (join (Player Z) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nset [flag x v] to []\nset [flag y v] to []\nset [flag z v] to []\nrepeat until <(letter ((At letter) + (1)) of (data)) = [,]>\n    change [at letter v] by (1)\n    set [flag x v] to (join (Flag X) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nrepeat until <(letter ((At letter) + (1)) of (data)) = [,]>\n    change [at letter v] by (1)\n    set [flag y v] to (join (Flag Y) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nrepeat until <(At letter) = (length of (data))>\n    change [at letter v] by (1)\n    set [flag z v] to (join (Flag Z) (letter (At letter) of (data)))\nend\n\ndefine Detect X: (x) Y: (y) Z: (z)\nset [collision detected? v] to [0]\nif <<((x) - (19)) < ((X position) + ((20) * (X scale)))> and <((x) - (19)) > ((X position) - ((20) * (X scale)))>> then\n    if <<((y) - (19)) < ((Y position) + ((20) * (Y scale)))> and <((y) - (19)) > ((Y position) - ((20) * (Y scale)))>> then\n        if <<((z) + (19)) < ((Z position) + ((20) * (Z scale)))> and <((z) + (19)) > ((Z position) - ((20) * (Z scale)))>> then\n            set [collision detected? v] to [1]\n        end\n    end\nend\nif <<((x) + (19)) < ((X position) + ((20) * (X scale)))> and <((x) + (19)) > ((X position) - ((20) * (X scale)))>> then\n    if <<((y) - (19)) < ((Y position) + ((20) * (Y scale)))> and <((y) - (19)) > ((Y position) - ((20) * (Y scale)))>> then\n        if <<((z) + (19)) < ((Z position) + ((20) * (Z scale)))> and <((z) + (19)) > ((Z position) - ((20) * (Z scale)))>> then\n            set [collision detected? v] to [1]\n        end\n    end\nend\nif <<((x) - (19)) < ((X position) + ((20) * (X scale)))> and <((x) - (19)) > ((X position) - ((20) * (X scale)))>> then\n    if <<((y) - (19)) < ((Y position) + ((20) * (Y scale)))> and <((y) - (19)) > ((Y position) - ((20) * (Y scale)))>> then\n        if <<((z) - (19)) < ((Z position) + ((20) * (Z scale)))> and <((z) - (19)) > ((Z position) - ((20) * (Z scale)))>> then\n            set [collision detected? v] to [1]\n        end\n    end\nend\nif <<((x) + (19)) < ((X position) + ((20) * (X scale)))> and <((x) + (19)) > ((X position) - ((20) * (X scale)))>> then\n    if <<((y) - (19)) < ((Y position) + ((20) * (Y scale)))> and <((y) - (19)) > ((Y position) - ((20) * (Y scale)))>> then\n        if <<((z) - (19)) < ((Z position) + ((20) * (Z scale)))> and <((z) - (19)) > ((Z position) - ((20) * (Z scale)))>> then\n            set [collision detected? v] to [1]\n        end\n    end\nend\nif <<((x) - (19)) < ((X position) + ((20) * (X scale)))> and <((x) - (19)) > ((X position) - ((20) * (X scale)))>> then\n    if <<((y) + (19)) < ((Y position) + ((20) * (Y scale)))> and <((y) + (19)) > ((Y position) - ((20) * (Y scale)))>> then\n        if <<((z) + (19)) < ((Z position) + ((20) * (Z scale)))> and <((z) + (19)) > ((Z position) - ((20) * (Z scale)))>> then\n            set [collision detected? v] to [1]\n        end\n    end\nend\nif <<((x) + (19)) < ((X position) + ((20) * (X scale)))> and <((x) + (19)) > ((X position) - ((20) * (X scale)))>> then\n    if <<((y) + (19)) < ((Y position) + ((20) * (Y scale)))> and <((y) + (19)) > ((Y position) - ((20) * (Y scale)))>> then\n        if <<((z) + (19)) < ((Z position) + ((20) * (Z scale)))> and <((z) + (19)) > ((Z position) - ((20) * (Z scale)))>> then\n            set [collision detected? v] to [1]\n        end\n    end\nend\nif <<((x) - (19)) < ((X position) + ((20) * (X scale)))> and <((x) - (19)) > ((X position) - ((20) * (X scale)))>> then\n    if <<((y) + (19)) < ((Y position) + ((20) * (Y scale)))> and <((y) + (19)) > ((Y position) - ((20) * (Y scale)))>> then\n        if <<((z) - (19)) < ((Z position) + ((20) * (Z scale)))> and <((z) - (19)) > ((Z position) - ((20) * (Z scale)))>> then\n            set [collision detected? v] to [1]\n        end\n    end\nend\nif <<((x) + (19)) < ((X position) + ((20) * (X scale)))> and <((x) + (19)) > ((X position) - ((20) * (X scale)))>> then\n    if <<((y) + (19)) < ((Y position) + ((20) * (Y scale)))> and <((y) + (19)) > ((Y position) - ((20) * (Y scale)))>> then\n        if <<((z) - (19)) < ((Z position) + ((20) * (Z scale)))> and <((z) - (19)) > ((Z position) - ((20) * (Z scale)))>> then\n            set [collision detected? v] to [1]\n        end\n    end\nend\n\nwhen I receive [start editor level v]\nLoad level ((Level) + (4))\nset [player x angle v] to [0]\nset [player y angle v] to [-45]\nif <(Edit or play mode?) = [1]> then\n    Camera positioning\n    forever\n        Add objects\n        The full 3D script\n    end\nelse\n    forever\n        if <(Game Paused?) = [0]> then\n            Platformer script\n            Detect collision at X: (Player X) Y: (Player Y) Z: (Player Z)\n            if <<(Player Y) < [-500]> and <(SFX) = [1]>> then\n                start sound [Falling sound effect v]\n            end\n            if <<(Collision?) = [2]> or <(Player Y) < [-500]>> then\n                Load player and flag position data (item ((Level) + (5)) of [player starting position and flag data v])\n            end\n            if <(Collision?) = [3]> then\n                broadcast (Fade v) and wait\n                broadcast (To title v)\n            end\n        end\n        Camera positioning\n        Add objects\n        The full 3D script\n    end\nend\n\nwhen I receive [start editor game v]\nstop [other scripts in sprite v]\nbroadcast (Start editor level v)\n\nwhen I receive [to title v]\nstop [other scripts in sprite v]\nwait (1.3) seconds\nbroadcast (Start background v)\n\ndefine Update values to be rotated\nset [vertex1 x v] to (Rotated vertex1 X)\nset [vertex1 y v] to (Rotated vertex1 Y)\nset [vertex1 z v] to (Rotated vertex1 Z)\nset [vertex2 x v] to (Rotated vertex2 X)\nset [vertex2 y v] to (Rotated vertex2 Y)\nset [vertex2 z v] to (Rotated vertex2 Z)\nset [vertex3 x v] to (Rotated vertex3 X)\nset [vertex3 y v] to (Rotated vertex3 Y)\nset [vertex3 z v] to (Rotated vertex3 Z)\n\n@Title screen\n\nwhen flag clicked\ngo to x: (0) y: (100)\nswitch costume to (costume1 v)\nset [enable interact v] to [1]\n\nwhen I start as a clone\nswitch costume to ((Clone number) + (1))\nif <(Clone number) = [1]> then\n    go to x: (0) y: (-25)\nend\nif <(Clone number) = [2]> then\n    go to x: (0) y: (-85)\nend\nif <(Clone number) = [3]> then\n    go to x: (0) y: (-145)\nend\nif <(Clone number) = [4]> then\n    go to x: (0) y: (0)\nend\nif <not <(Clone number) = [4]>> then\n    forever\n        if <<touching (mouse-pointer v)?> and <not <(size) = [120]>>> then\n            change size by (5)\n        end\n        if <<not <touching (mouse-pointer v)?>> and <not <(size) = [100]>>> then\n            change size by (-5)\n        end\n    end\nend\n\nwhen this sprite clicked\nif <(Enable interact) = [1]> then\n    if <(Clone number) = [1]> then\n        broadcast (Fade v) and wait\n        broadcast (Start game v)\n    end\n    if <(Clone number) = [2]> then\n        broadcast (Editor v)\n    end\n    if <(Clone number) = [3]> then\n        broadcast (Settings v)\n    end\nend\n\nwhen I receive [title screen v]\nshow\n\nwhen I receive [start game v]\nif <(Clone number) = [0]> then\n    hide\nelse\n    delete this clone\nend\n\nwhen I receive [editor v]\nif <not <(Clone number) = [4]>> then\n    hide\nend\n\nwhen I receive [settings v]\nif <not <(Clone number) = [4]>> then\n    hide\nend\n\nwhen I receive [to title v]\nshow\nset [clone number v] to [0]\nrepeat (4)\n    change [clone number v] by (1)\n    create clone of (_myself_ v)\nend\nset [clone number v] to [0]\n\nwhen I receive [start editor game v]\nif <(Clone number) = [0]> then\n    hide\nelse\n    delete this clone\nend\n\n@Settings\n\nwhen I start as a clone\nswitch costume to ((Clone number) + (1))\nif <(Clone number) = [1]> then\n    go to x: (-150) y: (25)\nend\nif <(Clone number) = [2]> then\n    go to x: (0) y: (25)\n    forever\n        if <(Resolution) = [10]> then\n            clear graphic effects\n        else\n            set [brightness v] effect to (-20)\n        end\n    end\nend\nif <(Clone number) = [3]> then\n    go to x: (95) y: (25)\n    forever\n        if <(Resolution) = [5]> then\n            clear graphic effects\n        else\n            set [brightness v] effect to (-20)\n        end\n    end\nend\nif <(Clone number) = [4]> then\n    go to x: (190) y: (25)\n    forever\n        if <(Resolution) = [1]> then\n            clear graphic effects\n        else\n            set [brightness v] effect to (-20)\n        end\n    end\nend\nif <(Clone number) = [5]> then\n    go to x: (-165) y: (-50)\nend\nif <(Clone number) = [6]> then\n    go to x: (75) y: (-50)\nend\nif <(Clone number) = [7]> then\n    go to x: (-35) y: (-50)\n    forever\n        if <(Music) = [1]> then\n            switch costume to (costume8 v)\n        else\n            switch costume to (costume9 v)\n        end\n    end\nend\nif <(Clone number) = [8]> then\n    go to x: (185) y: (-50)\n    forever\n        if <(SFX) = [1]> then\n            switch costume to (costume8 v)\n        else\n            switch costume to (costume9 v)\n        end\n    end\nend\nif <(Clone number) = [9]> then\n    go to x: (0) y: (-125)\nend\n\nwhen this sprite clicked\nif <(Enable interact) = [1]> then\n    if <(Clone number) = [2]> then\n        set [resolution v] to [10]\n    end\n    if <(Clone number) = [3]> then\n        set [resolution v] to [5]\n    end\n    if <(Clone number) = [4]> then\n        set [resolution v] to [1]\n    end\n    if <(Clone number) = [7]> then\n        if <(Music) = [1]> then\n            set [music v] to [0]\n        else\n            set [music v] to [1]\n        end\n    end\n    if <(Clone number) = [8]> then\n        if <(SFX) = [1]> then\n            set [sfx v] to [0]\n        else\n            set [sfx v] to [1]\n        end\n    end\n    if <(Clone number) = [9]> then\n        broadcast (Title screen v)\n    end\nend\n\nwhen I start as a clone\nforever\n    if <<<(Clone number) > [1]> and <(Clone number) < [5]>> or <(Clone number) = [9]>> then\n        if <<touching (mouse-pointer v)?> and <not <(size) = [120]>>> then\n            change size by (5)\n        end\n        if <<not <touching (mouse-pointer v)?>> and <not <(size) = [100]>>> then\n            change size by (-5)\n        end\n    end\nend\n\nwhen I receive [settings v]\nshow\n\nwhen I receive [title screen v]\nhide\n\nwhen I receive [to title v]\nhide\nset [clone number v] to [0]\nrepeat (9)\n    change [clone number v] by (1)\n    create clone of (_myself_ v)\nend\nset [clone number v] to [0]\n\nwhen I receive [start game v]\nif <(Clone number) = [0]> then\n    hide\nelse\n    delete this clone\nend\n\nwhen I receive [start editor game v]\nif <(Clone number) = [0]> then\n    hide\nelse\n    delete this clone\nend\n\nwhen flag clicked\ngo to x: (0) y: (100)\nswitch costume to (costume1 v)\n\n@Editor selection\n\nwhen I start as a clone\nswitch costume to ((Clone number) + (1))\nif <(Clone number) = [1]> then\n    go to x: (-100) y: (60)\nend\nif <(Clone number) = [2]> then\n    go to x: (100) y: (60)\nend\nif <(Clone number) = [3]> then\n    go to x: (-100) y: (-60)\nend\nif <(Clone number) = [4]> then\n    go to x: (100) y: (-60)\nend\nif <(Clone number) = [5]> then\n    go to x: (0) y: (-150)\nend\nif <(Clone number) = [6]> then\n    go to x: (180) y: (150)\nend\nforever\n    if <<touching (mouse-pointer v)?> and <not <(size) = [120]>>> then\n        change size by (5)\n    end\n    if <<not <touching (mouse-pointer v)?>> and <not <(size) = [100]>>> then\n        change size by (-5)\n    end\nend\n\nwhen this sprite clicked\nif <(Enable interact) = [1]> then\n    if <<(Clone number) > [0]> and <(Clone number) < [5]>> then\n        broadcast (Fade v) and wait\n        set [level v] to (Clone number)\n        broadcast (Start editor game v)\n    end\n    if <(Clone number) = [5]> then\n        broadcast (Title screen v)\n    end\n    if <(Clone number) = [6]> then\n        if <(Edit or play mode?) = [1]> then\n            set [edit or play mode? v] to [2]\n        else\n            set [edit or play mode? v] to [1]\n        end\n    end\nend\n\nwhen I receive [editor v]\nshow\n\nwhen I receive [title screen v]\nhide\n\nwhen I start as a clone\nif <(Clone number) = [6]> then\n    forever\n        if <(Edit or play mode?) = [1]> then\n            switch costume to (costume7 v)\n        else\n            switch costume to (costume8 v)\n        end\n    end\nend\n\nwhen I receive [to title v]\nhide\nset [clone number v] to [0]\nrepeat (6)\n    change [clone number v] by (1)\n    create clone of (_myself_ v)\nend\nset [clone number v] to [0]\n\nwhen I receive [start game v]\nif <(Clone number) = [0]> then\n    hide\nelse\n    delete this clone\nend\n\nwhen I receive [start editor game v]\nif <(Clone number) = [0]> then\n    hide\nelse\n    delete this clone\nend\n\nwhen flag clicked\ngo to x: (0) y: (150)\nswitch costume to (costume1 v)\n\n@Editor\n\nwhen flag clicked\nhide\ngo to x: (0) y: (150)\nswitch costume to (costume1 v)\n\nwhen I receive [start editor level v]\nif <(Edit or play mode?) = [1]> then\n    set [currently at v] to [1]\n    set [selected object v] to [1]\n    set [move object v] to [2]\n    set [add object bar on? v] to [0]\n    show\n    Clone\n    forever\n        if <(Move object) = [1]> then\n            if <key (w v) pressed?> then\n                change [camera z v] by (-5)\n            end\n            if <key (s v) pressed?> then\n                change [camera z v] by (5)\n            end\n            if <key (a v) pressed?> then\n                change [camera x v] by (5)\n            end\n            if <key (d v) pressed?> then\n                change [camera x v] by (-5)\n            end\n            if <key (r v) pressed?> then\n                change [camera y v] by (-5)\n            end\n            if <key (f v) pressed?> then\n                change [camera y v] by (5)\n            end\n            if <key (up arrow v) pressed?> then\n                change [camera y angle v] by (-5)\n            end\n            if <key (down arrow v) pressed?> then\n                change [camera y angle v] by (5)\n            end\n            if <key (left arrow v) pressed?> then\n                change [camera x angle v] by (5)\n            end\n            if <key (right arrow v) pressed?> then\n                change [camera x angle v] by (-5)\n            end\n        else\n            if <key (any v) pressed?> then\n                if <key (w v) pressed?> then\n                    change [z position \(editor\) v] by (5)\n                end\n                if <key (s v) pressed?> then\n                    change [z position \(editor\) v] by (-5)\n                end\n                if <key (a v) pressed?> then\n                    change [x position \(editor\) v] by (-5)\n                end\n                if <key (d v) pressed?> then\n                    change [x position \(editor\) v] by (5)\n                end\n                if <key (r v) pressed?> then\n                    change [y position \(editor\) v] by (5)\n                end\n                if <key (f v) pressed?> then\n                    change [y position \(editor\) v] by (-5)\n                end\n                if <key (up arrow v) pressed?> then\n                    change [z scale \(editor\) v] by (-1)\n                end\n                if <key (down arrow v) pressed?> then\n                    change [z scale \(editor\) v] by (1)\n                end\n                if <key (left arrow v) pressed?> then\n                    change [x scale \(editor\) v] by (1)\n                end\n                if <key (right arrow v) pressed?> then\n                    change [x scale \(editor\) v] by (-1)\n                end\n                if <key (t v) pressed?> then\n                    change [y scale \(editor\) v] by (1)\n                end\n                if <key (g v) pressed?> then\n                    change [y scale \(editor\) v] by (-1)\n                end\n                if <(Selected object) = [Player]> then\n                    set [player x v] to (X position \(Editor\))\n                    set [player y v] to (Y position \(Editor\))\n                    set [player z v] to (Z position \(Editor\))\n                else\n                    if <(Selected object) = [Flag]> then\n                        set [flag x v] to (X position \(Editor\))\n                        set [flag y v] to (Y position \(Editor\))\n                        set [flag z v] to (Z position \(Editor\))\n                    else\n                        replace item (Selected object) of [object data v] with (join (join (join (join (join (join (join (join (join (join (join (join (Object type \(Editor\)) [.]) (X position \(Editor\))) [,]) (Y position \(Editor\))) [,]) (Z position \(Editor\))) [.]) (X scale \(Editor\))) [,]) (Y scale \(Editor\))) [,]) (Z scale \(Editor\)))\n                    end\n                end\n            end\n        end\n        if <<(Selected object) = [Player]> or <(Selected object) = [Flag]>> then\n            if <(Selected object) = [Player]> then\n                set [x position \(editor\) v] to (Player X)\n                set [y position \(editor\) v] to (Player Y)\n                set [z position \(editor\) v] to (Player Z)\n            end\n            if <(Selected object) = [Flag]> then\n                set [x position \(editor\) v] to (Flag X)\n                set [y position \(editor\) v] to (Flag Y)\n                set [z position \(editor\) v] to (Flag Z)\n            end\n            set [x scale \(editor\) v] to [1]\n            set [y scale \(editor\) v] to [1]\n            set [z scale \(editor\) v] to [1]\n        else\n            if <(length of [object data v]) > [0]> then\n                if <(Selected object) > (length of [object data v])> then\n                    set [selected object v] to (length of [object data v])\n                end\n                Read object data: (item (Selected object) of [object data v])\n            end\n        end\n    end\nend\n\nwhen I start as a clone\nswitch costume to ((Clone number) + (1))\nif <<(Clone number) = [23]> or <(Clone number) = [26]>> then\n    switch costume to (costume25 v)\nend\nif <<(Clone number) = [24]> or <(Clone number) = [27]>> then\n    switch costume to (costume26 v)\nend\nif <<(Clone number) = [25]> or <(Clone number) = [28]>> then\n    switch costume to (costume27 v)\nend\nif <<(Clone number) > [28]> and <(Clone number) < [35]>> then\n    switch costume to (costume28 v)\nend\nif <<(Clone number) > [38]> and <(Clone number) < [59]>> then\n    switch costume to (costume38 v)\nend\nif <<(Clone number) > [58]> and <(Clone number) < [65]>> then\n    switch costume to (costume28 v)\n    set [ghost v] effect to (99)\nend\nif <(Clone number) = [1]> then\n    go to x: (0) y: (0)\nend\nif <(Clone number) = [2]> then\n    go to x: (-195) y: (150)\nend\nif <(Clone number) = [3]> then\n    go to x: (-195) y: (110)\nend\nif <(Clone number) = [4]> then\n    go to x: (-215) y: (75)\n    forever\n        if <(Move object) = [1]> then\n            set [brightness v] effect to (0)\n        else\n            set [brightness v] effect to (-15)\n        end\n    end\nend\nif <(Clone number) = [5]> then\n    go to x: (-175) y: (75)\n    forever\n        if <(Move object) = [1]> then\n            set [brightness v] effect to (-15)\n        else\n            set [brightness v] effect to (0)\n        end\n    end\nend\nif <(Clone number) = [6]> then\n    go to x: (-195) y: (40)\nend\nif <(Clone number) = [7]> then\n    go to x: (-195) y: (-50)\nend\nif <(Clone number) = [8]> then\n    go to x: (-195) y: (-150)\nend\nif <(Clone number) = [9]> then\n    go to x: (195) y: (155)\nend\nif <(Clone number) = [10]> then\n    go to x: (195) y: (125)\nend\nif <(Clone number) = [11]> then\n    go to x: (195) y: (95)\nend\nif <(Clone number) = [12]> then\n    go to x: (195) y: (70)\n    forever\n        if <not <((Currently at) - (1)) = [0]>> then\n            show\n        else\n            hide\n        end\n    end\nend\nif <(Clone number) = [13]> then\n    go to x: (195) y: (-80)\n    forever\n        if <not <((Currently at) + (4)) > (length of [object data v])>> then\n            show\n        else\n            hide\n        end\n    end\nend\nif <(Clone number) = [14]> then\n    go to x: (175) y: (-110)\n    forever\n        if <(Selected object) = [Player]> then\n            set [brightness v] effect to (0)\n        else\n            set [brightness v] effect to (-15)\n        end\n    end\nend\nif <(Clone number) = [15]> then\n    go to x: (215) y: (-110)\n    forever\n        if <(Selected object) = [Flag]> then\n            set [brightness v] effect to (0)\n        else\n            set [brightness v] effect to (-15)\n        end\n    end\nend\nif <(Clone number) = [16]> then\n    go to x: (28) y: (-140)\nend\nif <(Clone number) = [17]> then\n    go to x: (-60) y: (-140)\nend\nif <(Clone number) = [18]> then\n    go to x: (-15) y: (-140)\nend\nif <(Clone number) = [19]> then\n    go to x: (30) y: (-140)\nend\nif <(Clone number) = [20]> then\n    go to x: (75) y: (-140)\nend\nif <(Clone number) = [21]> then\n    go to x: (120) y: (-140)\nend\nif <(Clone number) = [22]> then\n    go to x: (195) y: (-150)\n    forever\n        if <(Add object bar on?) = [1]> then\n            switch costume to (costume24 v)\n        else\n            switch costume to (costume23 v)\n        end\n    end\nend\nif <(Clone number) = [23]> then\n    go to x: (-222) y: (20)\nend\nif <(Clone number) = [24]> then\n    go to x: (-222) y: (-5)\nend\nif <(Clone number) = [25]> then\n    go to x: (-222) y: (-30)\nend\nif <(Clone number) = [26]> then\n    go to x: (-222) y: (-70)\nend\nif <(Clone number) = [27]> then\n    go to x: (-222) y: (-95)\nend\nif <(Clone number) = [28]> then\n    go to x: (-222) y: (-120)\nend\nif <(Clone number) = [29]> then\n    go to x: (-185) y: (20)\nend\nif <(Clone number) = [30]> then\n    go to x: (-185) y: (-5)\nend\nif <(Clone number) = [31]> then\n    go to x: (-185) y: (-30)\nend\nif <(Clone number) = [32]> then\n    go to x: (-185) y: (-70)\nend\nif <(Clone number) = [33]> then\n    go to x: (-185) y: (-95)\nend\nif <(Clone number) = [34]> then\n    go to x: (-185) y: (-120)\nend\nif <(Clone number) = [35]> then\n    go to x: (-200) y: (20)\nend\nif <(Clone number) = [36]> then\n    go to x: (-190) y: (20)\nend\nif <(Clone number) = [37]> then\n    go to x: (-180) y: (20)\nend\nif <(Clone number) = [38]> then\n    go to x: (-170) y: (20)\nend\nif <(Clone number) = [39]> then\n    go to x: (-200) y: (-5)\nend\nif <(Clone number) = [40]> then\n    go to x: (-190) y: (-5)\nend\nif <(Clone number) = [41]> then\n    go to x: (-180) y: (-5)\nend\nif <(Clone number) = [42]> then\n    go to x: (-170) y: (-5)\nend\nif <(Clone number) = [43]> then\n    go to x: (-200) y: (-30)\nend\nif <(Clone number) = [44]> then\n    go to x: (-190) y: (-30)\nend\nif <(Clone number) = [45]> then\n    go to x: (-180) y: (-30)\nend\nif <(Clone number) = [46]> then\n    go to x: (-170) y: (-30)\nend\nif <(Clone number) = [47]> then\n    go to x: (-200) y: (-70)\nend\nif <(Clone number) = [48]> then\n    go to x: (-190) y: (-70)\nend\nif <(Clone number) = [49]> then\n    go to x: (-180) y: (-70)\nend\nif <(Clone number) = [50]> then\n    go to x: (-170) y: (-70)\nend\nif <(Clone number) = [51]> then\n    go to x: (-200) y: (-95)\nend\nif <(Clone number) = [52]> then\n    go to x: (-190) y: (-95)\nend\nif <(Clone number) = [53]> then\n    go to x: (-180) y: (-95)\nend\nif <(Clone number) = [54]> then\n    go to x: (-170) y: (-95)\nend\nif <(Clone number) = [55]> then\n    go to x: (-200) y: (-120)\nend\nif <(Clone number) = [56]> then\n    go to x: (-190) y: (-120)\nend\nif <(Clone number) = [57]> then\n    go to x: (-180) y: (-120)\nend\nif <(Clone number) = [58]> then\n    go to x: (-170) y: (-120)\nend\nif <(Clone number) = [59]> then\n    go to x: (-185) y: (20)\nend\nif <(Clone number) = [60]> then\n    go to x: (-185) y: (-5)\nend\nif <(Clone number) = [61]> then\n    go to x: (-185) y: (-30)\nend\nif <(Clone number) = [62]> then\n    go to x: (-185) y: (-70)\nend\nif <(Clone number) = [63]> then\n    go to x: (-185) y: (-95)\nend\nif <(Clone number) = [64]> then\n    go to x: (-185) y: (-120)\nend\nif <(Clone number) = [65]> then\n    go to x: (195) y: (45)\nend\nif <(Clone number) = [66]> then\n    go to x: (195) y: (12)\nend\nif <(Clone number) = [67]> then\n    go to x: (195) y: (-21)\nend\nif <(Clone number) = [68]> then\n    go to x: (195) y: (-54)\nend\n\nwhen this sprite clicked\nif <(Enable interact) = [1]> then\n    if <(Clone number) = [2]> then\n        Save editor level (Level)\n        broadcast (Fade v) and wait\n        broadcast (To title v)\n    end\n    if <(Clone number) = [4]> then\n        set [move object v] to [1]\n    end\n    if <(Clone number) = [5]> then\n        set [move object v] to [2]\n    end\n    if <(Clone number) = [8]> then\n        if <not <<(Selected object) = [Player]> or <(Selected object) = [Flag]>>> then\n            delete (Selected object) of [object data v]\n        end\n    end\n    if <(Clone number) = [12]> then\n        if <not <((Currently at) - (1)) = [0]>> then\n            change [currently at v] by (-1)\n        end\n    end\n    if <(Clone number) = [13]> then\n        if <not <((Currently at) + (4)) > (length of [object data v])>> then\n            change [currently at v] by (1)\n        end\n    end\n    if <(Clone number) = [14]> then\n        set [selected object v] to [Player]\n    end\n    if <(Clone number) = [15]> then\n        set [selected object v] to [Flag]\n    end\n    if <<(Clone number) > [16]> and <(Clone number) < [22]>> then\n        add (join ((Clone number) - (16)) [.0,0,0.1,1,1]) to [object data v]\n        set [selected object v] to (length of [object data v])\n    end\n    if <(Clone number) = [22]> then\n        if <(Add object bar on?) = [1]> then\n            set [add object bar on? v] to [0]\n        else\n            set [add object bar on? v] to [1]\n        end\n    end\n    if <<(Clone number) > [58]> and <(Clone number) < [65]>> then\n        set [enable interact v] to [0]\n        hide\n        if <(Clone number) = [59]> then\n            ask [Set X position to:] and wait\n            if <(Selected object) = [Player]> then\n                set [player x v] to (round (answer))\n            else\n                if <(Selected object) = [Flag]> then\n                    set [flag x v] to (round (answer))\n                else\n                    set [x position \(editor\) v] to (round (answer))\n                end\n            end\n        end\n        if <(Clone number) = [60]> then\n            ask [Set Y position to:] and wait\n            if <(Selected object) = [Player]> then\n                set [player y v] to (round (answer))\n            else\n                if <(Selected object) = [Flag]> then\n                    set [flag y v] to (round (answer))\n                else\n                    set [y position \(editor\) v] to (round (answer))\n                end\n            end\n        end\n        if <(Clone number) = [61]> then\n            ask [Set Z position to:] and wait\n            if <(Selected object) = [Player]> then\n                set [player z v] to (round (answer))\n            else\n                if <(Selected object) = [Flag]> then\n                    set [flag z v] to (round (answer))\n                else\n                    set [z position \(editor\) v] to (round (answer))\n                end\n            end\n        end\n        if <not <<(Selected object) = [Player]> or <(Selected object) = [Flag]>>> then\n            if <(Clone number) = [62]> then\n                ask [Set X scale to:] and wait\n                set [x scale \(editor\) v] to (round (answer))\n            end\n            if <(Clone number) = [63]> then\n                ask [Set Y scale to:] and wait\n                set [y scale \(editor\) v] to (round (answer))\n            end\n            if <(Clone number) = [64]> then\n                ask [Set Z scale to:] and wait\n                set [z scale \(editor\) v] to (round (answer))\n            end\n        end\n        replace item (Selected object) of [object data v] with (join (join (join (join (join (join (join (join (join (join (join (join (Object type \(Editor\)) [.]) (X position \(Editor\))) [,]) (Y position \(Editor\))) [,]) (Z position \(Editor\))) [.]) (X scale \(Editor\))) [,]) (Y scale \(Editor\))) [,]) (Z scale \(Editor\)))\n        show\n        set [enable interact v] to [1]\n    end\n    if <<(Clone number) > [64]> and <(Clone number) < [69]>> then\n        set [selected object v] to (((Clone number) - (65)) + (Currently at))\n    end\nend\n\nwhen I start as a clone\nif <<(Clone number) = [9]> or <(Clone number) = [10]>> then\n    forever\n        if <touching (mouse-pointer v)?> then\n            say [Coming soon!]\n        else\n            say []\n        end\n    end\nend\nif <<(Clone number) > [15]> and <(Clone number) < [22]>> then\n    forever\n        if <(Add object bar on?) = [1]> then\n            show\n        else\n            hide\n        end\n    end\nend\nif <<<(Clone number) > [31]> and <(Clone number) < [35]>> or <(Clone number) = [8]>> then\n    forever\n        if <<(Selected object) = [Player]> or <(Selected object) = [Flag]>> then\n            set [brightness v] effect to (-15)\n        else\n            set [brightness v] effect to (0)\n        end\n    end\nend\nif <<(Clone number) > [34]> and <(Clone number) < [39]>> then\n    forever\n        if <((Clone number) - (34)) > (length of (X position \(Editor\)))> then\n            hide\n        else\n            show\n            if <(letter ((Clone number) - (34)) of (X position \(Editor\))) = [-]> then\n                switch costume to (costume39 v)\n            else\n                switch costume to ((letter ((Clone number) - (34)) of (X position \(Editor\))) + (29))\n            end\n        end\n    end\nend\nif <<(Clone number) > [38]> and <(Clone number) < [43]>> then\n    forever\n        if <((Clone number) - (38)) > (length of (Y position \(Editor\)))> then\n            hide\n        else\n            show\n            if <(letter ((Clone number) - (38)) of (Y position \(Editor\))) = [-]> then\n                switch costume to (costume39 v)\n            else\n                switch costume to ((letter ((Clone number) - (38)) of (Y position \(Editor\))) + (29))\n            end\n        end\n    end\nend\nif <<(Clone number) > [42]> and <(Clone number) < [47]>> then\n    forever\n        if <((Clone number) - (42)) > (length of (Z position \(Editor\)))> then\n            hide\n        else\n            show\n            if <(letter ((Clone number) - (42)) of (Z position \(Editor\))) = [-]> then\n                switch costume to (costume39 v)\n            else\n                switch costume to ((letter ((Clone number) - (42)) of (Z position \(Editor\))) + (29))\n            end\n        end\n    end\nend\nif <<(Clone number) > [46]> and <(Clone number) < [51]>> then\n    forever\n        if <((Clone number) - (46)) > (length of (X scale \(Editor\)))> then\n            hide\n        else\n            show\n            if <(letter ((Clone number) - (46)) of (X scale \(Editor\))) = [-]> then\n                switch costume to (costume39 v)\n            else\n                switch costume to ((letter ((Clone number) - (46)) of (X scale \(Editor\))) + (29))\n            end\n        end\n    end\nend\nif <<(Clone number) > [50]> and <(Clone number) < [55]>> then\n    forever\n        if <((Clone number) - (50)) > (length of (Y scale \(Editor\)))> then\n            hide\n        else\n            show\n            if <(letter ((Clone number) - (50)) of (Y scale \(Editor\))) = [-]> then\n                switch costume to (costume39 v)\n            else\n                switch costume to ((letter ((Clone number) - (50)) of (Y scale \(Editor\))) + (29))\n            end\n        end\n    end\nend\nif <<(Clone number) > [54]> and <(Clone number) < [59]>> then\n    forever\n        if <((Clone number) - (54)) > (length of (Z scale \(Editor\)))> then\n            hide\n        else\n            show\n            if <(letter ((Clone number) - (54)) of (Z scale \(Editor\))) = [-]> then\n                switch costume to (costume39 v)\n            else\n                switch costume to ((letter ((Clone number) - (54)) of (Z scale \(Editor\))) + (29))\n            end\n        end\n    end\nend\nif <<(Clone number) > [64]> and <(Clone number) < [69]>> then\n    forever\n        if <(((Clone number) - (65)) + (Currently at)) > (length of [object data v])> then\n            hide\n        else\n            show\n            if <(((Clone number) - (65)) + (Currently at)) = (Selected object)> then\n                set [brightness v] effect to (0)\n            else\n                set [brightness v] effect to (-15)\n            end\n            switch costume to ((letter (1) of (item (((Clone number) - (65)) + (Currently at)) of [object data v])) + (39))\n        end\n    end\nend\n\ndefine Read object data: (data)\nset [at letter v] to [0]\nset [object type \(editor\) v] to []\nrepeat until <(letter ((At letter) + (1)) of (data)) = [.]>\n    change [at letter v] by (1)\n    set [object type \(editor\) v] to (join (Object type \(Editor\)) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nset [x position \(editor\) v] to []\nset [y position \(editor\) v] to []\nset [z position \(editor\) v] to []\nrepeat until <(letter ((At letter) + (1)) of (data)) = [,]>\n    change [at letter v] by (1)\n    set [x position \(editor\) v] to (join (X position \(Editor\)) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nrepeat until <(letter ((At letter) + (1)) of (data)) = [,]>\n    change [at letter v] by (1)\n    set [y position \(editor\) v] to (join (Y position \(Editor\)) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nrepeat until <(letter ((At letter) + (1)) of (data)) = [.]>\n    change [at letter v] by (1)\n    set [z position \(editor\) v] to (join (Z position \(Editor\)) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nset [x scale \(editor\) v] to []\nset [y scale \(editor\) v] to []\nset [z scale \(editor\) v] to []\nrepeat until <(letter ((At letter) + (1)) of (data)) = [,]>\n    change [at letter v] by (1)\n    set [x scale \(editor\) v] to (join (X scale \(Editor\)) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nrepeat until <(letter ((At letter) + (1)) of (data)) = [,]>\n    change [at letter v] by (1)\n    set [y scale \(editor\) v] to (join (Y scale \(Editor\)) (letter (At letter) of (data)))\nend\nchange [at letter v] by (1)\nrepeat until <(At letter) = (length of (data))>\n    change [at letter v] by (1)\n    set [z scale \(editor\) v] to (join (Z scale \(Editor\)) (letter (At letter) of (data)))\nend\n\ndefine Save editor level (selection)\nreplace item ((selection) + (5)) of [player starting position and flag data v] with (join (join (join (join (join (join (join (join (join (join (Player X) [,]) (Player Y)) [,]) (Player Z)) [.]) (Flag X)) [,]) (Flag Y)) [,]) (Flag Z))\nif <(selection) = [1]> then\n    delete all of [editor level 1 v]\n    set [at object v] to [0]\n    repeat (length of [object data v])\n        change [at object v] by (1)\n        add (item (At object) of [object data v]) to [editor level 1 v]\n    end\nend\nif <(selection) = [2]> then\n    delete all of [editor level 2 v]\n    set [at object v] to [0]\n    repeat (length of [object data v])\n        change [at object v] by (1)\n        add (item (At object) of [object data v]) to [editor level 2 v]\n    end\nend\nif <(selection) = [3]> then\n    delete all of [editor level 3 v]\n    set [at object v] to [0]\n    repeat (length of [object data v])\n        change [at object v] by (1)\n        add (item (At object) of [object data v]) to [editor level 3 v]\n    end\nend\nif <(selection) = [4]> then\n    delete all of [editor level 4 v]\n    set [at object v] to [0]\n    repeat (length of [object data v])\n        change [at object v] by (1)\n        add (item (At object) of [object data v]) to [editor level 4 v]\n    end\nend\n\nwhen I receive [to title v]\nif <(Clone number) = [0]> then\n    hide\nelse\n    delete this clone\nend\n\ndefine Clone\nset [clone number v] to [0]\nrepeat (68)\n    change [clone number v] by (1)\n    create clone of (_myself_ v)\nend\nset [clone number v] to [0]\n\n@Level interactives\n\nwhen flag clicked\nhide\ngo to x: (0) y: (100)\nswitch costume to (costume1 v)\n\nwhen I receive [congratulations message v]\nif <(Clone number) = [12]> then\n    show\n    wait until <mouse down?>\n    wait until <not <mouse down?>>\n    broadcast (Fade v) and wait\n    broadcast (To title v)\n    hide\nend\nif <(Clone number) = [13]> then\n    hide\nend\n\nwhen I receive [start game v]\nSetup level interactives\n\nwhen I start as a clone\nswitch costume to ((Clone number) + (1))\nif <(Clone number) = [1]> then\n    show\n    go to x: (-200) y: (140)\nend\nif <(Clone number) = [2]> then\n    go to x: (-100) y: (25)\nend\nif <(Clone number) = [3]> then\n    go to x: (100) y: (25)\nend\nif <(Clone number) = [4]> then\n    go to x: (-150) y: (-50)\nend\nif <(Clone number) = [5]> then\n    go to x: (0) y: (-50)\n    forever\n        if <(Resolution) = [10]> then\n            clear graphic effects\n        else\n            set [brightness v] effect to (-20)\n        end\n    end\nend\nif <(Clone number) = [6]> then\n    go to x: (95) y: (-50)\n    forever\n        if <(Resolution) = [5]> then\n            clear graphic effects\n        else\n            set [brightness v] effect to (-20)\n        end\n    end\nend\nif <(Clone number) = [7]> then\n    go to x: (190) y: (-50)\n    forever\n        if <(Resolution) = [1]> then\n            clear graphic effects\n        else\n            set [brightness v] effect to (-20)\n        end\n    end\nend\nif <(Clone number) = [8]> then\n    go to x: (-165) y: (-125)\nend\nif <(Clone number) = [9]> then\n    go to x: (75) y: (-125)\nend\nif <(Clone number) = [10]> then\n    go to x: (-35) y: (-125)\n    forever\n        if <(Music) = [1]> then\n            switch costume to (costume11 v)\n        else\n            switch costume to (costume12 v)\n        end\n    end\nend\nif <(Clone number) = [11]> then\n    go to x: (185) y: (-125)\n    forever\n        if <(SFX) = [1]> then\n            switch costume to (costume11 v)\n        else\n            switch costume to (costume12 v)\n        end\n    end\nend\nif <(Clone number) = [12]> then\n    hide\n    go to x: (0) y: (0)\nend\nif <(Clone number) = [13]> then\n    show\n    go to x: (0) y: (150)\n    forever\n        switch costume to ((Level) + (13))\n    end\nend\n\nwhen I start as a clone\nif <not <<<(Clone number) = [1]> or <(Clone number) = [12]>> or <(Clone number) = [13]>>> then\n    forever\n        if <(Game Paused?) = [1]> then\n            show\n        else\n            hide\n        end\n    end\nend\n\nwhen this sprite clicked\nif <(Enable interact) = [1]> then\n    if <<(Clone number) = [1]> or <(Clone number) = [2]>> then\n        if <(Game Paused?) = [1]> then\n            set [game paused? v] to [0]\n        else\n            set [game paused? v] to [1]\n        end\n    end\n    if <(Clone number) = [3]> then\n        broadcast (Fade v) and wait\n        broadcast (To title v)\n    end\n    if <(Clone number) = [5]> then\n        set [resolution v] to [10]\n    end\n    if <(Clone number) = [6]> then\n        set [resolution v] to [5]\n    end\n    if <(Clone number) = [7]> then\n        set [resolution v] to [1]\n    end\n    if <(Clone number) = [10]> then\n        if <(Music) = [1]> then\n            set [music v] to [0]\n        else\n            set [music v] to [1]\n        end\n    end\n    if <(Clone number) = [11]> then\n        if <(SFX) = [1]> then\n            set [sfx v] to [0]\n        else\n            set [sfx v] to [1]\n        end\n    end\nend\n\nwhen I receive [to title v]\nif <(Clone number) = [0]> then\n    stop [other scripts in sprite v]\n    hide\nelse\n    delete this clone\nend\n\nwhen I receive [start editor game v]\nif <(Edit or play mode?) = [2]> then\n    Setup level interactives\nend\n\ndefine Setup level interactives\nset [game paused? v] to [0]\nset [clone number v] to [0]\nrepeat (13)\n    change [clone number v] by (1)\n    create clone of (_myself_ v)\nend\nset [clone number v] to [0]\nforever\n    if <(Game Paused?) = [1]> then\n        show\n    else\n        hide\n    end\nend\n\n@Intro\n\nwhen flag clicked\ngo to [front v] layer\nclear graphic effects\nshow\nif <<is compiled?> = [0]> then\n    switch costume to (costume2 v)\n    hide list [copy this link and paste to your web browser to go to the turbowarp version v]\n    wait until <mouse down?>\n    wait until <not <mouse down?>>\n    repeat (10)\n        change [brightness v] effect by (-10)\n    end\n    switch costume to (costume1 v)\n    show list [copy this link and paste to your web browser to go to the turbowarp version v]\n    repeat (10)\n        change [brightness v] effect by (10)\n    end\nend\nshow list [copy this link and paste to your web browser to go to the turbowarp version v]\nswitch costume to (costume1 v)\nbroadcast (To title v)\nwait (1) seconds\nrepeat (10)\n    change [brightness v] effect by (-10)\nend\nbroadcast (Intro ended v)\nhide\n\n@Fade\n\nwhen flag clicked\nhide\n\nwhen I receive [fade v]\nset [enable interact v] to [0]\ngo to [front v] layer\nset [ghost v] effect to (100)\nshow\nrepeat (50)\n    change [ghost v] effect by (-2)\nend\nbroadcast (Fade back v)\n\nwhen I receive [fade back v]\nwait (2) seconds\nrepeat (50)\n    change [ghost v] effect by (2)\nend\nhide\nset [enable interact v] to [1]\n\n