Super Robot 64 [v1.1.3] 3D Platformer Prototype


@Stage\n\n@Blank\n\n@MainRenderer\n\ndefine int draw line (x1) (y1) (x2) (y2) (start size) (end size) (x normal) (y normal) (size diff) (x diff) (y diff)\nset [aox v] to (x1)\nset [aoy v] to (y1)\nif <(start size) > [1]> then\n    set [pivot v] to (start size)\nelse\n    set [pivot v] to [1]\nend\nif <(pivot) < (end size)> then\n    repeat until <((pivot) * (2)) > (end size)>\n        set [l v] to ((((2) * (pivot)) - (start size)) / (size diff))\n        set [box v] to ((x1) + ((x diff) * (L)))\n        set [boy v] to ((y1) + ((y diff) * (L)))\n        set pen size to (1)\n        go to x: ((Box) - ((pivot) * (x normal))) y: ((Boy) - ((pivot) * (y normal)))\n        pen down\n        set pen size to (pivot)\n        go to x: (Aox) y: (Aoy)\n        go to x: ((Box) + ((pivot) * (x normal))) y: ((Boy) + ((pivot) * (y normal)))\n        pen up\n        set [aox v] to (Box)\n        set [aoy v] to (Boy)\n        set [pivot v] to ((pivot) * (2))\n    end\n    go to x: ((x2) - (((end size) - (pivot)) * (x normal))) y: ((y2) - (((end size) - (pivot)) * (y normal)))\n    set pen size to (1)\n    pen down\n    set pen size to (pivot)\n    go to x: (Aox) y: (Aoy)\n    go to x: ((x2) + (((end size) - (pivot)) * (x normal))) y: ((y2) + (((end size) - (pivot)) * (y normal)))\n    pen up\n    go to x: (x2) y: (y2)\n    set pen size to (end size)\n    pen down\n    pen up\nend\n\ndefine draw line from x (x1) y (y1) to x (x2) y (y2) start width (start size) end width (end size)\nif <(start size) = (end size)> then\ngo to x: (x1) y: (y1)\nset pen size to (1)\npen down\nset pen size to ((start size) + (<(start size) > (end size)> * ((end size) - (start size))))\ngo to x: (x2) y: (y2)\npen up\n\ngo to x: (x1) y: (y1)\nset pen size to (1)\npen down\nset pen size to (start size)\ngo to x: (x2) y: (y2)\npen up\n\ndefine QuickSort\ndelete (all) of [sort.l v]\ndelete (all) of [sort.r v]\nadd [1] to [sort.l v]\nadd (length of [objdis v]) to [sort.r v]\nrepeat until <(length of [sort.r v]) = [0]>\n    set [left v] to (item (1) of [sort.l v])\n    set [right v] to (item (1) of [sort.r v])\n    set [pivot v] to [L]\n    repeat until <(left) = (right)>\n        if <(pivot) = [L]> then\n            if <(item (left) of [objdis v]) > (item (right) of [objdis v])> then\n                set [td v] to (item (left) of [objdis v])\n                replace item (left) of [objdis v] with (item (right) of [objdis v])\n                replace item (right) of [objdis v] with (td)\n                set [td v] to (item (left) of [sorteditemids v])\n                replace item (left) of [sorteditemids v] with (item (right) of [sorteditemids v])\n                replace item (right) of [sorteditemids v] with (td)\n                set [pivot v] to [R]\n            else\n                change [right v] by (-1)\n            end\n        else\n            if <(item (left) of [objdis v]) > (item (right) of [objdis v])> then\n                set [td v] to (item (left) of [objdis v])\n                replace item (left) of [objdis v] with (item (right) of [objdis v])\n                replace item (right) of [objdis v] with (td)\n                set [td v] to (item (left) of [sorteditemids v])\n                replace item (left) of [sorteditemids v] with (item (right) of [sorteditemids v])\n                replace item (right) of [sorteditemids v] with (td)\n                set [pivot v] to [L]\n            else\n                change [left v] by (1)\n            end\n        end\n    end\n    set [l v] to (item (1) of [sort.l v])\n    set [r v] to (item (1) of [sort.r v])\n    delete (1) of [sort.l v]\n    delete (1) of [sort.r v]\n    if <not <(left) = (L)>> then\n        add (L) to [sort.l v]\n        add ((left) - (1)) to [sort.r v]\n    end\n    if <not <(left) = (R)>> then\n        add ((left) + (1)) to [sort.l v]\n        add (R) to [sort.r v]\n    end\nend\n\ndefine 3D || x (x) y (y) z (z)\nif <(z) > [1]> then\n    set [scrnx v] to ((x) * ((disToScrn) / (z)))\n    set [scrny v] to ((y) * ((disToScrn) / (z)))\nelse\n    set [scrnx v] to ((x) * ((disToScrn) / (1)))\n    set [scrny v] to ((y) * ((disToScrn) / (1)))\nend\n\ndefine ROTATION MATRIX || x (x) z (z) || DIRECTION (dir)\nset [rotatedx v] to (((z) * ([sin v] of (dir) )) + ((x) * ([cos v] of (dir) )))\nset [rotatedz v] to (((z) * ([cos v] of (dir) )) - ((x) * ([sin v] of (dir) )))\n\ndefine SORT || DISTANCE (dis)\n\ndefine ROTATION MATRIX || y (y) z (z) || DIRECTION (dir)\nset [rotatedy v] to (((z) * ([sin v] of (dir) )) + ((y) * ([cos v] of (dir) )))\nset [rotatedz v] to (((z) * ([cos v] of (dir) )) - ((y) * ([sin v] of (dir) )))\n\ndefine ADD HITBOX || x: (x1) (x2) || y: (y1) (y2) || z: (z1) (z2)\nif <(x2) > (x1)> then\n    add (x1) to [hitbox meshes v]\n    add (x2) to [hitbox meshes v]\nelse\n    add (x2) to [hitbox meshes v]\n    add (x1) to [hitbox meshes v]\nend\nif <(y2) > (y1)> then\n    add (y1) to [hitbox meshes v]\n    add (y2) to [hitbox meshes v]\nelse\n    add (y2) to [hitbox meshes v]\n    add (y1) to [hitbox meshes v]\nend\nif <(z2) > (z1)> then\n    add (z1) to [hitbox meshes v]\n    add (z2) to [hitbox meshes v]\nelse\n    add (z2) to [hitbox meshes v]\n    add (z1) to [hitbox meshes v]\nend\n\ndefine ADD CUBOID || x: (x1) (x2) y: (y1) (y2) z: (z1) (z2)\nAdd OBJ || x (x1) y (y2) z (z1)\nAdd OBJ || x (x2) y (y2) z (z1)\nAdd OBJ || x (x1) y (y1) z (z1)\nAdd OBJ || x (x1) y (y2) z (z2)\nAdd OBJ || x (x2) y (y2) z (z2)\nAdd OBJ || x (x2) y (y1) z (z1)\nAdd OBJ || x (x2) y (y1) z (z2)\nAdd OBJ || x (x1) y (y1) z (z2)\nADD HITBOX || x: (x1) (x2) || y: (y1) (y2) || z: (z1) (z2)\n\nset [distoscrn v] to [300]\nAdd OBJ || x [50] y [50] z [50]\nAdd OBJ || x [-50] y [50] z [50]\nAdd OBJ || x [50] y [0] z [50]\nAdd OBJ || x [50] y [50] z [-50]\nAdd OBJ || x [-50] y [50] z [-50]\nAdd OBJ || x [-50] y [0] z [50]\nAdd OBJ || x [-50] y [0] z [-50]\nAdd OBJ || x [50] y [0] z [-50]\nADD HITBOX || x: [50] [-50] || y: [0] [50] || z: [50] [-50]\n\nset [c1 v] to [1]\nrepeat until <not <(dis) < (item (C1) of [objdis v])>>\n    change [c1 v] by (1)\nend\ninsert (dis) at (C1) of [objdis v] \ngo [forward v] ((C1) - (1)) layers\n\ndefine READ FROM || GameObjects\nset [readval v] to (item (readNum) of [gameobjects v])\nchange [readnum v] by (1)\n\ndefine READ || ITEM (item)\nset [readval v] to []\nset [c2 v] to (letter (readNum) of (item))\nchange [readnum v] by (1)\nrepeat until <<(C2) = [/]> or <<(C2) = [;]> or <<(C2) = [|]> or <(C2) = []>>>>\n    set [readval v] to (join (readVal) (C2))\n    set [c2 v] to (letter (readNum) of (item))\n    change [readnum v] by (1)\nend\n\nif <(t) = [F]> then\n    repeat until <<(C2) = [|]> or <<(C2) = [null]> or <(C2) = []>>>\n        set [readval v] to (join (readVal) (C2))\n        set [c2 v] to (letter (readNum) of (item))\n        change [readnum v] by (1)\n    end\nend\n\ndefine TO 2D || x: (x) y: (y) z: (z)\nROTATION MATRIX || x ((x) - (camX)) z ((z) - (camZ)) || DIRECTION ((0) - (camDir\(y\)))\nROTATION MATRIX || y ((y) - (camY)) z (rotatedZ) || DIRECTION ((0) - (camDir\(x\)))\n3D || x (rotatedX) y (rotatedY) z (rotatedZ)\n\ndefine RENDERSCENE\nswitch costume to (tiny v)\nset size to (9999999999) %\nswitch costume to (11 v)\nset [c2 v] to (length of [sorteditemids v])\nrepeat (length of [sorteditemids v])\n    set [readnum v] to (item (C2) of [sorteditemids v])\n    set [c1 v] to (C2)\n    delete all of [b v]\n    repeat until <[] = (item (readNum) of [renderbuffer v])>\n        add (item (readNum) of [renderbuffer v]) to [b v]\n        change [readnum v] by (1)\n    end\n    if < (item (1) of [b v]) contains [T]?> then\n        delete (1) of [b v]\n        set pen color to (((item (10) of [b v]) * (65536)) + (((item (11) of [b v]) * (256)) + (item (12) of [b v])))\n        set [td v] to (((item (C1) of [objdis v]) - (renderDistance)) / (2))\n        if <[0] > (td)> then\n            set [td v] to [0]\n        end\n        set pen (transparency v) to ((item (13) of [b v]) + (td))\n        if <[100] > (((item (C1) of [objdis v]) - (renderDistance)) / (2))> then\n            DRAW 3D TRI || (item (1) of [b v]) (item (2) of [b v]) (item (3) of [b v]) (item (4) of [b v]) (item (5) of [b v]) (item (6) of [b v]) (item (7) of [b v]) (item (8) of [b v]) (item (9) of [b v]) z-cull [10]\n        end\n    else\n        if  then\n            if <[I] = (letter (2) of (item (1) of [b v]))> then\n                delete (1) of [b v]\n                TO 2D || x: (item (1) of [b v]) y: (item (2) of [b v]) z: (item (3) of [b v])\n                replace item (1) of [b v] with (scrnX)\n                replace item (2) of [b v] with (scrnY)\n                if <<(renderDistance) > (rotatedZ)> and <(rotatedZ) > [0]>> then\n                    go to x: (item (1) of [b v]) y: (item (2) of [b v])\n                    set size to ((item (4) of [b v]) * ((disToScrn) / (rotatedZ))) %\n                    switch costume to (item (6) of [b v])\n                    set [ghost v] effect to (item (5) of [b v])\n                    stamp\n                    clear graphic effects\n                    switch costume to (tiny v)\n                    set size to (9999999999) %\n                    switch costume to (11 v)\n                end\n            else\n                set pen (transparency v) to (((item (C1) of [objdis v]) - (renderDistance)) / (2))\n                delete (1) of [b v]\n                TO 2D || x: (item (1) of [b v]) y: (item (2) of [b v]) z: (item (3) of [b v])\n                replace item (1) of [b v] with (scrnX)\n                replace item (2) of [b v] with (scrnY)\n                if <(rotatedZ) > [0]> then\n                    go to x: (item (1) of [b v]) y: (item (2) of [b v])\n                    set pen color to (((item (7) of [b v]) * (65536)) + (((item (8) of [b v]) * (256)) + (item (9) of [b v])))\n                    set pen (transparency v) to (item (10) of [b v])\n                    set pen size to ((item (11) of [b v]) * ((disToScrn) / (rotatedZ)))\n                    if <(renderDistance) > (item (C1) of [objdis v])> then\n                        pen down\n                        change x by (0)\n                        pen up\n                    end\n                end\n            end\n        else\n            if < (item (1) of [b v]) contains [S]?> then\n                delete (1) of [b v]\n                TO 2D || x: (item (1) of [b v]) y: (item (2) of [b v]) z: (item (3) of [b v])\n                replace item (1) of [b v] with (scrnX)\n                replace item (2) of [b v] with (scrnY)\n                TO 2D || x: (item (4) of [b v]) y: (item (5) of [b v]) z: (item (6) of [b v])\n                replace item (4) of [b v] with (scrnX)\n                replace item (5) of [b v] with (scrnY)\n                TO 2D || x: (item (7) of [b v]) y: (item (8) of [b v]) z: (item (9) of [b v])\n                replace item (7) of [b v] with (scrnX)\n                replace item (8) of [b v] with (scrnY)\n                set pen color to (#000000)\n                fill (item (1) of [b v]) (item (2) of [b v]) (item (4) of [b v]) (item (5) of [b v]) (item (7) of [b v]) (item (8) of [b v]) resolution: (renderResolution) \n            else\n                delete (1) of [b v]\n                delete all of [sort.r v]\n                delete all of [sort.l v]\n                TO 2D || x: (item (1) of [b v]) y: (item (2) of [b v]) z: (item (3) of [b v])\n                add (scrnX) to [sort.l v]\n                add (scrnY) to [sort.l v]\n                add (rotatedX) to [sort.r v]\n                add (rotatedY) to [sort.r v]\n                add (rotatedZ) to [sort.r v]\n                set [incx v] to (rotatedZ)\n                TO 2D || x: (item (4) of [b v]) y: (item (5) of [b v]) z: (item (6) of [b v])\n                add (scrnX) to [sort.l v]\n                add (scrnY) to [sort.l v]\n                add (rotatedX) to [sort.r v]\n                add (rotatedY) to [sort.r v]\n                add (rotatedZ) to [sort.r v]\n                set [incy v] to (rotatedZ)\n                if <<[0] < (incx)> or <[0] < (incy)>> then\n                    if (item (10) of [b v]) then\n                        set [cox v] to ((item (10) of [b v]) * ((disToScrn) / (incx)))\n                        set [coy v] to ((item (10) of [b v]) * ((disToScrn) / (incy)))\n                    else\n                        set [cox v] to [3]\n                        set [coy v] to [3]\n                    end\n                    if <(incy) < [0]> then\n                        cull line || (item (1) of [sort.r v]) (item (2) of [sort.r v]) (item (3) of [sort.r v]) (item (4) of [sort.r v]) (item (5) of [sort.r v]) (item (6) of [sort.r v]) z-cull [10]\n                        replace item (3) of [sort.l v] with (((cross x) * (disToScrn)) / (10))\n                        replace item (4) of [sort.l v] with (((cross y) * (disToScrn)) / (10))\n                        set [coy v] to (((item (10) of [b v]) * (disToScrn)) / (10))\n                    else\n                        if <(incx) < [0]> then\n                            cull line || (item (1) of [sort.r v]) (item (2) of [sort.r v]) (item (3) of [sort.r v]) (item (4) of [sort.r v]) (item (5) of [sort.r v]) (item (6) of [sort.r v]) z-cull [10]\n                            replace item (1) of [sort.l v] with (((cross x) * (disToScrn)) / (10))\n                            replace item (2) of [sort.l v] with (((cross y) * (disToScrn)) / (10))\n                            set [cox v] to (((item (10) of [b v]) * (disToScrn)) / (10))\n                        end\n                    end\n                    set pen color to (((item (7) of [b v]) * (65536)) + (((item (8) of [b v]) * (256)) + (item (9) of [b v])))\n                    set pen (transparency v) to (((item (C1) of [objdis v]) - (renderDistance)) / (2))\n                    draw line from x (item (1) of [sort.l v]) y (item (2) of [sort.l v]) to x (item (3) of [sort.l v]) y (item (4) of [sort.l v]) start width (Cox) end width (Coy)\n                end\n            end\n        end\n    end\n    change [c2 v] by (-1)\nend\nswitch costume to (symbolpen v)\n\nreplace item (1) of [b v] with [thing]\nreplace item (2) of [b v] with [thing]\n\nreplace item (4) of [b v] with [thing]\nreplace item (5) of [b v] with [thing]\n\nset [incy v] to (rotatedZ)\nif (item (10) of [b v]) then\n    set [cox v] to ((item (10) of [b v]) * ((disToScrn) / ([abs v] of (incx) )))\n    set [coy v] to ((item (10) of [b v]) * ((disToScrn) / ([abs v] of (incy) )))\nelse\n    set [cox v] to [3]\n    set [coy v] to [3]\nend\nset [aox v] to (item (1) of [sort.r v])\nset [aoy v] to (item (2) of [sort.r v])\nset [box v] to (item (3) of [sort.r v])\nset [boy v] to (item (4) of [sort.r v])\nif <(incy) < [0]> then\n    cull line || (Aox) (Aoy) (item (3) of [b v]) (Box) (Boy) (item (6) of [b v]) z-cull [1]\n    set [coy v] to ((Coy) + (((Cox) - (Coy)) * (((0) - (incy)) / ((incx) - (incy)))))\n    TO 2D || x: (cross x) y: (cross y) z: [1]\n    replace item (4) of [b v] with (scrnX)\n    replace item (5) of [b v] with (scrnY)\nelse\n    if <(incx) < [0]> then\n        cull line || (Box) (Boy) (item (6) of [b v]) (Aox) (Aoy) (item (3) of [b v]) z-cull [1]\n        set [cox v] to ((Cox) + (((Coy) - (Cox)) * (((0) - (incx)) / ((incy) - (incx)))))\n        TO 2D || x: (cross x) y: (cross y) z: [1]\n        replace item (1) of [b v] with (scrnX)\n        replace item (2) of [b v] with (scrnY)\n    end\nend\nset pen color to (((item (7) of [b v]) * (65536)) + (((item (8) of [b v]) * (256)) + (item (9) of [b v])))\nset pen (transparency v) to (((item (C1) of [objdis v]) - (renderDistance)) / (2))\ndraw line from x (item (1) of [b v]) y (item (2) of [b v]) to x (item (4) of [b v]) y (item (5) of [b v]) start width (Cox) end width (Coy)\n\ngo to x: (scrnX) y: (scrnY)\npoint in direction ((90) + ([atan v] of (((0) - (scrnX)) / (((disToScrn) / ([tan v] of (camDir\(x\)) )) - (scrnY))) ))\nif <<(x position) = (scrnX)> and <(y position) = (scrnY)>> then\n    set size to ((100) * ((disToScrn) / (z))) %\n    show\nelse\n    hide\nend\nhide\nbroadcast (Render v)\nSORT || DISTANCE ((((OBJX) - (camX)) * ((OBJX) - (camX))) + ((((OBJY) - (camY)) * ((OBJY) - (camY))) + (((OBJZ) - (camZ)) * ((OBJZ) - (camZ)))))\n\ndefine PROCESS DATA\nset [c1 v] to [0]\ndelete all of [sorteditemids v]\ndelete all of [objdis v]\ndelete all of [renderbuffer v]\nset [readnum v] to [1]\nrepeat until <(readNum) > (length of [gameobjects v])>\n    delete all of [b v]\n    set [readval v] to [null]\n    repeat until <[] = (readVal)>\n        READ FROM || GameObjects\n        add (readVal) to [b v]\n    end\n    if < (item (1) of [b v]) contains [T]?> then\n        if < (item (1) of [b v]) contains [E]?> then\n            delete (1) of [b v]\n            set [pivot v] to [-1]\n        else\n            delete (1) of [b v]\n            INTERNAL: cross ((item (4) of [b v]) - (item (1) of [b v])) ((item (5) of [b v]) - (item (2) of [b v])) ((item (6) of [b v]) - (item (3) of [b v])) ((item (7) of [b v]) - (item (1) of [b v])) ((item (8) of [b v]) - (item (2) of [b v])) ((item (9) of [b v]) - (item (3) of [b v]))\n            set [pivot v] to ([sqrt v] of (((cross x) * (cross x)) + (((cross y) * (cross y)) + ((cross z) * (cross z)))) )\n            set [cross x v] to ((cross x) / (pivot))\n            set [cross y v] to ((cross y) / (pivot))\n            set [cross z v] to ((cross z) / (pivot))\n            set [rotatedx v] to ((item (1) of [b v]) - (camX))\n            set [rotatedy v] to ((item (2) of [b v]) - (camY))\n            set [rotatedz v] to ((item (3) of [b v]) - (camZ))\n            set [pivot v] to ([sqrt v] of (((rotatedX) * (rotatedX)) + (((rotatedY) * (rotatedY)) + ((rotatedZ) * (rotatedZ)))) )\n            set [rotatedx v] to ((rotatedX) / (pivot))\n            set [rotatedy v] to ((rotatedY) / (pivot))\n            set [rotatedz v] to ((rotatedZ) / (pivot))\n            set [pivot v] to (((rotatedX) * (cross x)) + (((rotatedY) * (cross y)) + ((rotatedZ) * (cross z))))\n        end\n        if <<(BackFaceCulling?) = [0]> or <[0] > (pivot)>> then\n            INSERT TRI FOR SORT (item (1) of [b v]) (item (2) of [b v]) (item (3) of [b v]) (item (4) of [b v]) (item (5) of [b v]) (item (6) of [b v]) (item (7) of [b v]) (item (8) of [b v]) (item (9) of [b v]) (item (10) of [b v]) (item (11) of [b v]) (item (12) of [b v]) [0] []\n        end\n    else\n        if < (item (1) of [b v]) contains [E]?> then\n            if < (item (1) of [b v]) contains [EE]?> then\n                WRITE ENEMY || ID (letter (3) of (item (1) of [b v])) YROT (item (8) of [b v])\n            else\n                if <(letter (2) of (item (1) of [b v])) = [P]> then\n                    INSERT LINE FOR SORT (item (2) of [b v]) (item (3) of [b v]) (item (4) of [b v]) (item (2) of [b v]) (item (3) of [b v]) (item (4) of [b v]) (item (8) of [b v]) (item (9) of [b v]) (item (10) of [b v]) (item (11) of [b v]) (item (12) of [b v]) [] \n                else\n                    if <(letter (2) of (item (1) of [b v])) = [C]> then\n                        if <(letter (3) of (item (1) of [b v])) = [P]> then\n                            INSERT LINE FOR SORT (item (2) of [b v]) ((item (3) of [b v]) - (50)) (item (4) of [b v]) (item (2) of [b v]) ((item (3) of [b v]) + (150)) (item (4) of [b v]) [150] [150] [150] [10] [10] [0] <>\n                            if (item (5) of [b v]) then\n                                INSERT TRI FOR SORT (item (2) of [b v]) (item (6) of [b v]) (item (4) of [b v]) (item (2) of [b v]) ((item (6) of [b v]) - (50)) (item (4) of [b v]) (item (2) of [b v]) ((item (6) of [b v]) - (25)) ((item (4) of [b v]) + (50)) [150] [150] [255] [0] [50]\n                            else\n                                INSERT TRI FOR SORT (item (2) of [b v]) (item (6) of [b v]) (item (4) of [b v]) (item (2) of [b v]) ((item (6) of [b v]) - (50)) (item (4) of [b v]) (item (2) of [b v]) ((item (6) of [b v]) - (25)) ((item (4) of [b v]) + (50)) [100] [100] [100] [0] [250]\n                            end\n                        else\n                            \n                                INSERT LINE FOR SORT (item (2) of [b v]) (item (3) of [b v]) (item (4) of [b v]) (item (2) of [b v]) (item (3) of [b v]) (item (4) of [b v]) (item (8) of [b v]) (item (9) of [b v]) (item (10) of [b v]) [0] (item (12) of [b v]) [] \n                            end\n                            INSERT IMAGE FOR SORT (item (2) of [b v]) (item (3) of [b v]) (item (4) of [b v]) , [100] [0] (join [Asset_Coin] (item (11) of [b v]))\n                        end\n                    else\n                        if <(letter (2) of (item (1) of [b v])) = [B]> then\n                            INSERT LINE FOR SORT (item (2) of [b v]) (item (3) of [b v]) (item (4) of [b v]) ((item (2) of [b v]) + (item (5) of [b v])) ((item (3) of [b v]) + (item (6) of [b v])) ((item (4) of [b v]) + (item (7) of [b v])) (item (8) of [b v]) (item (9) of [b v]) (item (10) of [b v]) [0] [5] [] <>\n                        else\n                            if <(item (1) of [b v]) = [END]> then\n                                INSERT IMAGE FOR SORT (item (2) of [b v]) (item (3) of [b v]) (item (4) of [b v]) , [100] [0] [Asset_Star]\n                            else\n                                INSERT IMAGE FOR SORT (item (2) of [b v]) (item (3) of [b v]) (item (4) of [b v]) , (item (5) of [b v]) (item (6) of [b v]) (item (7) of [b v])\n                            end\n                        end\n                    end\n                end\n            end\n        else\n            if < (item (1) of [b v]) contains [S]?> then\n                delete (1) of [b v]\n                delete all of [sort.r v]\n                ROTATION MATRIX || x (() - (item (4) of [b v])) z (() - (item (4) of [b v])) || DIRECTION (TweenedplayerYDir)\n                add ((item (1) of [b v]) + (rotatedX)) to [sort.r v]\n                add ((item (3) of [b v]) + (rotatedZ)) to [sort.r v]\n                ROTATION MATRIX || x (() - (item (4) of [b v])) z (item (4) of [b v]) || DIRECTION (TweenedplayerYDir)\n                add ((item (1) of [b v]) + (rotatedX)) to [sort.r v]\n                add ((item (3) of [b v]) + (rotatedZ)) to [sort.r v]\n                ROTATION MATRIX || x (item (4) of [b v]) z (() - (item (4) of [b v])) || DIRECTION (TweenedplayerYDir)\n                add ((item (1) of [b v]) + (rotatedX)) to [sort.r v]\n                add ((item (3) of [b v]) + (rotatedZ)) to [sort.r v]\n                ROTATION MATRIX || x (item (4) of [b v]) z (item (4) of [b v]) || DIRECTION (TweenedplayerYDir)\n                add ((item (1) of [b v]) + (rotatedX)) to [sort.r v]\n                add ((item (3) of [b v]) + (rotatedZ)) to [sort.r v]\n                INSERT TRI FOR SORT (item (7) of [sort.r v]) (item (2) of [b v]) (item (8) of [sort.r v]) (item (5) of [sort.r v]) (item (2) of [b v]) (item (6) of [sort.r v]) (item (3) of [sort.r v]) (item (2) of [b v]) (item (4) of [sort.r v]) [0] [0] [0] [0] [150]\n                INSERT TRI FOR SORT (item (1) of [sort.r v]) (item (2) of [b v]) (item (2) of [sort.r v]) (item (5) of [sort.r v]) (item (2) of [b v]) (item (6) of [sort.r v]) (item (3) of [sort.r v]) (item (2) of [b v]) (item (4) of [sort.r v]) [0] [0] [0] [0] [150]\n            else\n                delete (1) of [b v]\n                INSERT LINE FOR SORT (item (1) of [b v]) (item (2) of [b v]) (item (3) of [b v]) (item (4) of [b v]) (item (5) of [b v]) (item (6) of [b v]) (item (7) of [b v]) (item (8) of [b v]) (item (9) of [b v]) (item (10) of [b v]) (item (10) of [b v]) [] <>\n            end\n        end\n    end\nend\nPLAYER RENDER\nQuickSort\n\ndefine Add OBJ || x (x) y (y) z (z)\nshow\nset [objx v] to (x)\nset [objy v] to (y)\nset [objz v] to (z)\ncreate clone of (_myself_ v)\nhide\n\ndefine PLAYER RENDER\ndelete all of [sort.l v]\nset [readnum v] to [1]\nGET CURRENT ANIM\nset [readval v] to [null]\nrepeat until <(readVal) = []>\n    READ || ITEM (ind)\n    if <not <[] = (readVal)>> then\n        if <not <((0) + (readVal)) = (readVal)>> then\n            add [] to [sort.l v]\n        end\n        add (readVal) to [sort.l v]\n    end\nend\ndelete (1) of [sort.l v]\ninternal PLAYER WRITE\n\ndefine INSERT TRI FOR SORT (x1) (y1) (z1) (x2) (y2) (z2) (x3) (y3) (z3) (r) (g) (b) (a) (priority?)\nset [aox v] to ((((x1) + ((x2) + (x3))) / (3)) - (camX))\nset [box v] to ((((y1) + ((y2) + (y3))) / (3)) - (camY))\nset [cox v] to ((((z1) + ((z2) + (z3))) / (3)) - (camZ))\nif <([sqrt v] of (((Aox) * (Aox)) + (((Box) * (Box)) + ((Cox) * (Cox)))) ) < ((renderDistance) + (200))> then\n    add (([sqrt v] of (((Aox) * (Aox)) + (((Box) * (Box)) + ((Cox) * (Cox)))) ) - (priority?)) to [objdis v]\n    add [T] to [renderbuffer v]\n    add (length of [renderbuffer v]) to [sorteditemids v]\n    add (x1) to [renderbuffer v]\n    add (y1) to [renderbuffer v]\n    add (z1) to [renderbuffer v]\n    add (x2) to [renderbuffer v]\n    add (y2) to [renderbuffer v]\n    add (z2) to [renderbuffer v]\n    add (x3) to [renderbuffer v]\n    add (y3) to [renderbuffer v]\n    add (z3) to [renderbuffer v]\n    add (r) to [renderbuffer v]\n    add (g) to [renderbuffer v]\n    add (b) to [renderbuffer v]\n    add (a) to [renderbuffer v]\n    add [] to [renderbuffer v]\nend\n\ndefine INSERT LINE FOR SORT (x1) (y1) (z1) (x2) (y2) (z2) (r) (g) (b) (a) (s) (priority) <ispoint?>\nset [aox v] to ((((x1) + (x2)) / (2)) - (camX))\nset [box v] to ((((y1) + (y2)) / (2)) - (camY))\nset [cox v] to ((((z1) + (z2)) / (2)) - (camZ))\nadd ((([sqrt v] of (((Aox) * (Aox)) + (((Box) * (Box)) + ((Cox) * (Cox)))) ) - ((100) + ())) - (priority)) to [objdis v]\nif <ispoint?> then\n    add [EP] to [renderbuffer v]\nelse\n    add [L] to [renderbuffer v]\nend\nadd (length of [renderbuffer v]) to [sorteditemids v]\nadd (x1) to [renderbuffer v]\nadd (y1) to [renderbuffer v]\nadd (z1) to [renderbuffer v]\nadd (x2) to [renderbuffer v]\nadd (y2) to [renderbuffer v]\nadd (z2) to [renderbuffer v]\nadd (r) to [renderbuffer v]\nadd (g) to [renderbuffer v]\nadd (b) to [renderbuffer v]\nadd (a) to [renderbuffer v]\nadd (s) to [renderbuffer v]\nadd [] to [renderbuffer v]\n\ndefine internal PLAYER WRITE\nset [readnum v] to [1]\nrepeat until <(readNum) > (length of [sort.l v])>\n    READ FROM  || SORT.L\n    set [ind v] to (readVal)\n    set [td v] to [0]\n    set [peri v] to []\n    delete all of [b v]\n    repeat ((2) + < (ind) contains [T]?>)\n        change [td v] by (1)\n        READ FROM  || SORT.L\n        add (readVal) to [b v]\n        READ FROM  || SORT.L\n        add (readVal) to [b v]\n        READ FROM  || SORT.L\n        add (readVal) to [b v]\n        replace item (((td) * (3)) - (1)) of [b v] with ((item (((td) * (3)) - (1)) of [b v]) * ((1) + ((<<(playerAnimCos) = [6]> or <(playerAnimCos) = [7]>> * ([playeryspd v] of [event/physics handler v])) / (200))))\n        ROTATION MATRIX || y (item (((td) * (3)) - (1)) of [b v]) z (item ((td) * (3)) of [b v]) || DIRECTION (playerXDir)\n        replace item (((td) * (3)) - (1)) of [b v] with (rotatedY)\n        replace item ((td) * (3)) of [b v] with (rotatedZ)\n        ROTATION MATRIX || x (item (((td) * (3)) - (2)) of [b v]) z (item ((td) * (3)) of [b v]) || DIRECTION (TweenedplayerYDir)\n        replace item (((td) * (3)) - (2)) of [b v] with ((rotatedX) + (playerX))\n        replace item (((td) * (3)) - (1)) of [b v] with ((item (((td) * (3)) - (1)) of [b v]) + (playerY))\n        replace item ((td) * (3)) of [b v] with ((rotatedZ) + (playerZ))\n    end\n    READ FROM  || SORT.L\n    set [aox v] to (readVal)\n    READ FROM  || SORT.L\n    set [box v] to (readVal)\n    READ FROM  || SORT.L\n    set [cox v] to (readVal)\n    READ FROM  || SORT.L\n    set [aoy v] to (readVal)\n    repeat until <(readVal) = []>\n        READ FROM  || SORT.L\n    end\n    if < (ind) contains [T]?> then\n        INTERNAL: cross ((item (4) of [b v]) - (item (1) of [b v])) ((item (5) of [b v]) - (item (2) of [b v])) ((item (6) of [b v]) - (item (3) of [b v])) ((item (7) of [b v]) - (item (1) of [b v])) ((item (8) of [b v]) - (item (2) of [b v])) ((item (9) of [b v]) - (item (3) of [b v]))\n        set [pivot v] to ([sqrt v] of (((cross x) * (cross x)) + (((cross y) * (cross y)) + ((cross z) * (cross z)))) )\n        set [cross x v] to ((cross x) / (pivot))\n        set [cross y v] to ((cross y) / (pivot))\n        set [cross z v] to ((cross z) / (pivot))\n        set [rotatedx v] to ((item (1) of [b v]) - (camX))\n        set [rotatedy v] to ((item (2) of [b v]) - (camY))\n        set [rotatedz v] to ((item (3) of [b v]) - (camZ))\n        set [pivot v] to ([sqrt v] of (((rotatedX) * (rotatedX)) + (((rotatedY) * (rotatedY)) + ((rotatedZ) * (rotatedZ)))) )\n        set [rotatedx v] to ((rotatedX) / (pivot))\n        set [rotatedy v] to ((rotatedY) / (pivot))\n        set [rotatedz v] to ((rotatedZ) / (pivot))\n        set [pivot v] to (((rotatedX) * (cross x)) + (((rotatedY) * (cross y)) + ((rotatedZ) * (cross z))))\n        if <<(BackFaceCulling?) = [0]> or <[0] > (pivot)>> then\n            set [peri v] to (join [T;] (peri))\n            INSERT TRI FOR SORT (item (1) of [b v]) (item (2) of [b v]) (item (3) of [b v]) (item (4) of [b v]) (item (5) of [b v]) (item (6) of [b v]) (item (7) of [b v]) (item (8) of [b v]) (item (9) of [b v]) (Aox) (Box) (Cox) [0] [250]\n        end\n    else\n        set [peri v] to (join [L;] (peri))\n        INSERT LINE FOR SORT (item (1) of [b v]) (item (2) of [b v]) (item (3) of [b v]) (item (4) of [b v]) (item (5) of [b v]) (item (6) of [b v]) (Aox) (Box) (Cox) (Aoy) (Aoy) [160] <>\n    end\nend\n\nset [aox v] to (join (Aox) (join (data) [|]))\n\ndefine GET CURRENT ANIM\nset [ind v] to (item (playerAnimCos) of [playeranims v])\n\ninsert [thing] at (1) of [playeranims v] \n\nadd (item (7) of [playeranims v]) to [playeranims v]\n\ndefine INTERNAL: cross (x1) (y1) (z1) (x2) (y2) (z2)\nset [cross x v] to (((y1) * (z2)) - ((y2) * (z1)))\nset [cross y v] to (((x2) * (z1)) - ((x1) * (z2)))\nset [cross z v] to (((x1) * (y2)) - ((x2) * (y1)))\n\ndefine fill (ax) (ay) (bx) (by) (cx) (cy) resolution: (res) <outline?>\npen up\nif <<(ay) > [180]> and <<(by) > [180]> and <(cy) > [180]>>> then\n    stop [this script v]\nend\nif <<[-180] > (ay)> and <<[-180] > (by)> and <[-180] > (cy)>>> then\n    stop [this script v]\nend\nif <<(ax) > [240]> and <<(bx) > [240]> and <(cx) > [240]>>> then\n    stop [this script v]\nend\nif <<[-240] > (ax)> and <<[-240] > (bx)> and <[-240] > (cx)>>> then\n    stop [this script v]\nend\nchange [right v] by (1)\nset [lena v] to ([sqrt v] of ((((bx) - (cx)) * ((bx) - (cx))) + (((by) - (cy)) * ((by) - (cy)))) )\nset [lenb v] to ([sqrt v] of ((((ax) - (cx)) * ((ax) - (cx))) + (((ay) - (cy)) * ((ay) - (cy)))) )\nset [lenc v] to ([sqrt v] of ((((ax) - (bx)) * ((ax) - (bx))) + (((ay) - (by)) * ((ay) - (by)))) )\nset [peri v] to ((1) / (((lena) + (lenb)) + (lenc)))\nset [incx v] to (((((lena) * (ax)) + ((lenb) * (bx))) + ((lenc) * (cx))) * (peri))\nset [incy v] to (((((lena) * (ay)) + ((lenb) * (by))) + ((lenc) * (cy))) * (peri))\nset [ind v] to ([sqrt v] of ((((((lenb) + (lenc)) - (lena)) * (((lenc) + (lena)) - (lenb))) * (((lena) + (lenb)) - (lenc))) * (peri)) )\nset [aox v] to ((incx) - (ax))\nset [aoy v] to ((incy) - (ay))\nset [box v] to ((incx) - (bx))\nset [boy v] to ((incy) - (by))\nset [cox v] to ((incx) - (cx))\nset [coy v] to ((incy) - (cy))\nif <<(lena) < (lenb)> and <(lena) < (lenc)>> then\n    set [td v] to ([sqrt v] of (((Aox) * (Aox)) + ((Aoy) * (Aoy))) )\nelse\n    if <<(lenb) > (lena)> or <(lenb) > (lenc)>> then\n        set [td v] to ([sqrt v] of (((Cox) * (Cox)) + ((Coy) * (Coy))) )\n    else\n        set [td v] to ([sqrt v] of (((Box) * (Box)) + ((Boy) * (Boy))) )\n    end\nend\nset [rate v] to ((((td) * (2)) - (ind)) / ((td) * (4)))\nset [td v] to ((1) + (0))\ngo to x: (round (incx)) y: (round (incy))\nset pen size to (ind)\npen down\nchange x by (0)\npen up\nset [peri v] to ([ceiling v] of (([log v] of ((res) / (ind)) ) / ([log v] of (rate) )) )\nrepeat (peri)\n    set [td v] to ((td) * (rate))\n    set pen size to ((ind) * (td))\n    go to x: (((Aox) * (td)) + (ax)) y: (((Aoy) * (td)) + (ay))\n    pen down\n    go to x: (((Box) * (td)) + (bx)) y: (((Boy) * (td)) + (by))\n    go to x: (((Cox) * (td)) + (cx)) y: (((Coy) * (td)) + (cy))\n    go to x: (((Aox) * (td)) + (ax)) y: (((Aoy) * (td)) + (ay))\n    pen up\n    change pen (brightness v) by ((-10) / (peri))\n    change pen (saturation v) by ((10) / (peri))\nend\nif <outline?> then\n    set pen size to (res)\n    pen down\n    go to x: (ax) y: (ay)\n    go to x: (bx) y: (by)\n    go to x: (cx) y: (cy)\n    go to x: (ax) y: (ay)\n    pen up\nend\nchange pen (brightness v) by (10)\nchange pen (saturation v) by (-10)\n\nchange pen (brightness v) by (-20)\n\ndefine DRAW 3D TRI || (x1) (y1) (z1) (x2) (y2) (z2) (x3) (y3) (z3) z-cull (zc)\nGET LIGHTING OF TRI ||  (x1) (y1) (z1) (x2) (y2) (z2) (x3) (y3) (z3)\ndelete all of [sort.l v]\ndelete all of [b v]\nTO 2D || x: (x1) y: (y1) z: (z1)\nadd (rotatedX) to [b v]\nadd (rotatedY) to [b v]\nadd (rotatedZ) to [b v]\nadd (rotatedX) to [sort.l v]\nadd (rotatedY) to [sort.l v]\nadd (rotatedZ) to [sort.l v]\nTO 2D || x: (x2) y: (y2) z: (z2)\nadd (rotatedX) to [b v]\nadd (rotatedY) to [b v]\nadd (rotatedZ) to [b v]\nadd (rotatedX) to [sort.l v]\nadd (rotatedY) to [sort.l v]\nadd (rotatedZ) to [sort.l v]\nTO 2D || x: (x3) y: (y3) z: (z3)\nadd (rotatedX) to [b v]\nadd (rotatedY) to [b v]\nadd (rotatedZ) to [b v]\nadd (rotatedX) to [sort.l v]\nadd (rotatedY) to [sort.l v]\nadd (rotatedZ) to [sort.l v]\nadd (rotatedX) to [sort.l v]\nadd (rotatedY) to [sort.l v]\nadd (rotatedZ) to [sort.l v]\nadd [] to [b v]\nadd [] to [b v]\nadd [] to [b v]\nset [ind v] to (<(item (3) of [b v]) < (zc)> + (<(item (6) of [b v]) < (zc)> + <(item (9) of [b v]) < (zc)>))\nset [r v] to [0]\nif <[3] > (ind)> then\n    if <(ind) > [0]> then\n        if <(ind) = [1]> then\n            set [r v] to [1]\n            if <(item (3) of [b v]) < (zc)> then\n                cull line || (item (1) of [sort.l v]) (item (2) of [sort.l v]) (item (3) of [sort.l v]) (item (7) of [sort.l v]) (item (8) of [sort.l v]) (item (9) of [sort.l v]) z-cull (zc)\n                replace item (10) of [sort.l v] with (cross x)\n                replace item (11) of [sort.l v] with (cross y)\n                replace item (12) of [sort.l v] with (zc)\n                cull line || (item (1) of [sort.l v]) (item (2) of [sort.l v]) (item (3) of [sort.l v]) (item (4) of [sort.l v]) (item (5) of [sort.l v]) (item (6) of [sort.l v]) z-cull (zc)\n                replace item (1) of [sort.l v] with (cross x)\n                replace item (2) of [sort.l v] with (cross y)\n                replace item (3) of [sort.l v] with (zc)\n            end\n            if <(item (6) of [b v]) < (zc)> then\n                cull line || (item (4) of [sort.l v]) (item (5) of [sort.l v]) (item (6) of [sort.l v]) (item (7) of [sort.l v]) (item (8) of [sort.l v]) (item (9) of [sort.l v]) z-cull (zc)\n                replace item (10) of [sort.l v] with (item (7) of [sort.l v])\n                replace item (11) of [sort.l v] with (item (8) of [sort.l v])\n                replace item (12) of [sort.l v] with (item (9) of [sort.l v])\n                replace item (7) of [sort.l v] with (cross x)\n                replace item (8) of [sort.l v] with (cross y)\n                replace item (9) of [sort.l v] with (zc)\n                cull line || (item (4) of [sort.l v]) (item (5) of [sort.l v]) (item (6) of [sort.l v]) (item (1) of [sort.l v]) (item (2) of [sort.l v]) (item (3) of [sort.l v]) z-cull (zc)\n                replace item (4) of [sort.l v] with (cross x)\n                replace item (5) of [sort.l v] with (cross y)\n                replace item (6) of [sort.l v] with (zc)\n            end\n            if <(item (9) of [b v]) < (zc)> then\n                cull line || (item (7) of [sort.l v]) (item (8) of [sort.l v]) (item (9) of [sort.l v]) (item (1) of [sort.l v]) (item (2) of [sort.l v]) (item (3) of [sort.l v]) z-cull (zc)\n                replace item (10) of [sort.l v] with (cross x)\n                replace item (11) of [sort.l v] with (cross y)\n                replace item (12) of [sort.l v] with (zc)\n                cull line || (item (7) of [sort.l v]) (item (8) of [sort.l v]) (item (9) of [sort.l v]) (item (4) of [sort.l v]) (item (5) of [sort.l v]) (item (6) of [sort.l v]) z-cull (zc)\n                replace item (7) of [sort.l v] with (cross x)\n                replace item (8) of [sort.l v] with (cross y)\n                replace item (9) of [sort.l v] with (zc)\n            end\n        else\n            if <(item (3) of [b v]) > (zc)> then\n                cull line || (item (1) of [sort.l v]) (item (2) of [sort.l v]) (item (3) of [sort.l v]) (item (4) of [sort.l v]) (item (5) of [sort.l v]) (item (6) of [sort.l v]) z-cull (zc)\n                replace item (4) of [sort.l v] with (cross x)\n                replace item (5) of [sort.l v] with (cross y)\n                replace item (6) of [sort.l v] with (zc)\n                cull line || (item (1) of [sort.l v]) (item (2) of [sort.l v]) (item (3) of [sort.l v]) (item (7) of [sort.l v]) (item (8) of [sort.l v]) (item (9) of [sort.l v]) z-cull (zc)\n                replace item (7) of [sort.l v] with (cross x)\n                replace item (8) of [sort.l v] with (cross y)\n                replace item (9) of [sort.l v] with (zc)\n            end\n            if <(item (6) of [b v]) > (zc)> then\n                cull line || (item (4) of [sort.l v]) (item (5) of [sort.l v]) (item (6) of [sort.l v]) (item (1) of [sort.l v]) (item (2) of [sort.l v]) (item (3) of [sort.l v]) z-cull (zc)\n                replace item (1) of [sort.l v] with (cross x)\n                replace item (2) of [sort.l v] with (cross y)\n                replace item (3) of [sort.l v] with (zc)\n                cull line || (item (4) of [sort.l v]) (item (5) of [sort.l v]) (item (6) of [sort.l v]) (item (7) of [sort.l v]) (item (8) of [sort.l v]) (item (9) of [sort.l v]) z-cull (zc)\n                replace item (7) of [sort.l v] with (cross x)\n                replace item (8) of [sort.l v] with (cross y)\n                replace item (9) of [sort.l v] with (zc)\n            end\n            if <(item (9) of [b v]) > [1]> then\n                cull line || (item (7) of [sort.l v]) (item (8) of [sort.l v]) (item (9) of [sort.l v]) (item (4) of [sort.l v]) (item (5) of [sort.l v]) (item (6) of [sort.l v]) z-cull (zc)\n                replace item (4) of [sort.l v] with (cross x)\n                replace item (5) of [sort.l v] with (cross y)\n                replace item (6) of [sort.l v] with (zc)\n                cull line || (item (7) of [sort.l v]) (item (8) of [sort.l v]) (item (9) of [sort.l v]) (item (1) of [sort.l v]) (item (2) of [sort.l v]) (item (3) of [sort.l v]) z-cull (zc)\n                replace item (1) of [sort.l v] with (cross x)\n                replace item (2) of [sort.l v] with (cross y)\n                replace item (3) of [sort.l v] with (zc)\n            end\n        end\n    end\n    delete all of [b v]\n    add ((disToScrn) * ((item (1) of [sort.l v]) / (item (3) of [sort.l v]))) to [b v]\n    add ((disToScrn) * ((item (2) of [sort.l v]) / (item (3) of [sort.l v]))) to [b v]\n    add ((disToScrn) * ((item (4) of [sort.l v]) / (item (6) of [sort.l v]))) to [b v]\n    add ((disToScrn) * ((item (5) of [sort.l v]) / (item (6) of [sort.l v]))) to [b v]\n    add ((disToScrn) * ((item (7) of [sort.l v]) / (item (9) of [sort.l v]))) to [b v]\n    add ((disToScrn) * ((item (8) of [sort.l v]) / (item (9) of [sort.l v]))) to [b v]\n    add ((disToScrn) * ((item (10) of [sort.l v]) / (item (12) of [sort.l v]))) to [b v]\n    add ((disToScrn) * ((item (11) of [sort.l v]) / (item (12) of [sort.l v]))) to [b v]\n    if <[1] = (R)> then\n        fill (item (1) of [b v]) (item (2) of [b v]) (item (3) of [b v]) (item (4) of [b v]) (item (5) of [b v]) (item (6) of [b v]) resolution: (renderResolution) <>\n        fill (item (1) of [b v]) (item (2) of [b v]) (item (7) of [b v]) (item (8) of [b v]) (item (5) of [b v]) (item (6) of [b v]) resolution: (renderResolution) <>\n    else\n        fill (item (1) of [b v]) (item (2) of [b v]) (item (3) of [b v]) (item (4) of [b v]) (item (5) of [b v]) (item (6) of [b v]) resolution: (renderResolution) \n    end\nend\n\npen down\ngo to x: (item (1) of [b v]) y: (item (2) of [b v])\ngo to x: (item (3) of [b v]) y: (item (4) of [b v])\ngo to x: (item (5) of [b v]) y: (item (6) of [b v])\ngo to x: (item (7) of [b v]) y: (item (8) of [b v])\ngo to x: (item (1) of [b v]) y: (item (2) of [b v])\npen up\n\ndefine RENDER\nerase all\nRENDERBG [1]\ninsert time (days since 2000) label [ignore]\nPROCESS DATA\ninsert time (days since 2000) label [Rendering: Data: ]\nRENDERSCENE\ninsert time (days since 2000) label [Rendering: Draw: ]\nbroadcast (FPS v)\n\ndefine reset debug\nset [otime v] to (days since 2000)\ndelete all of [debug v]\n\ndefine insert time (time) label (label)\nadd (join (label) (join (round (((time) - (oTime)) * (86400000))) [ms])) to [debug v]\nset [otime v] to (days since 2000)\n\nstop [all v]\n\ndefine Repackage\nset [c3 v] to [0]\nset [returnval1 v] to []\nrepeat ((length of [b v]) - (1))\n    change [c3 v] by (1)\n    set [returnval1 v] to (join (returnVal1) (join (item (C3) of [b v]) [/]))\nend\n\ndefine READ FROM  || SORT.L\nset [readval v] to (item (readNum) of [sort.l v])\nchange [readnum v] by (1)\n\ndefine WRITE ENEMY || ID (id) YROT (yr)\nset [rate v] to (readNum)\ndelete all of [sort.l v]\nset [readnum v] to [1]\nset [ind v] to (item (id) of [entityanims v])\nset [readval v] to [null]\nrepeat until <(readVal) = []>\n    READ || ITEM (ind)\n    if <not <[] = (readVal)>> then\n        if <not <((0) + (readVal)) = (readVal)>> then\n            add [] to [sort.l v]\n        end\n        add (readVal) to [sort.l v]\n    end\nend\ndelete (1) of [sort.l v]\nset [readnum v] to [1]\nrepeat until <(readNum) > (length of [sort.l v])>\n    READ FROM  || SORT.L\n    set [ind v] to (readVal)\n    set [td v] to [0]\n    set [peri v] to []\n    delete all of [sort.r v]\n    repeat ((2) + < (ind) contains [T]?>)\n        change [td v] by (3)\n        READ FROM  || SORT.L\n        add (readVal) to [sort.r v]\n        READ FROM  || SORT.L\n        add (readVal) to [sort.r v]\n        READ FROM  || SORT.L\n        add (readVal) to [sort.r v]\n        ROTATION MATRIX || x (item ((td) - (2)) of [sort.r v]) z (item (td) of [sort.r v]) || DIRECTION (yr)\n        replace item ((td) - (2)) of [sort.r v] with ((rotatedX) + (item (2) of [b v]))\n        if <(item (9) of [b v]) > [0]> then\n            replace item ((td) - (1)) of [sort.r v] with (((item ((td) - (1)) of [sort.r v]) * (.2)) + (item (3) of [b v]))\n        else\n            replace item ((td) - (1)) of [sort.r v] with ((item ((td) - (1)) of [sort.r v]) + (item (3) of [b v]))\n        end\n        replace item (td) of [sort.r v] with ((rotatedZ) + (item (4) of [b v]))\n        set [peri v] to (join (join (join (join (join (peri) (item ((td) - (2)) of [sort.r v])) [/]) (item ((td) - (1)) of [sort.r v])) (join [/] (item (td) of [sort.r v]))) [/])\n    end\n    READ FROM  || SORT.L\n    set [aox v] to (readVal)\n    READ FROM  || SORT.L\n    set [box v] to (readVal)\n    READ FROM  || SORT.L\n    set [cox v] to (readVal)\n    repeat until <(readVal) = []>\n        READ FROM  || SORT.L\n        if <not <(readVal) = []>> then\n            set [peri v] to (join (peri) (join (readVal) [/]))\n        end\n    end\n    if < (ind) contains [T]?> then\n        INTERNAL: cross ((item (4) of [sort.r v]) - (item (1) of [sort.r v])) ((item (5) of [sort.r v]) - (item (2) of [sort.r v])) ((item (6) of [sort.r v]) - (item (3) of [sort.r v])) ((item (7) of [sort.r v]) - (item (1) of [sort.r v])) ((item (8) of [sort.r v]) - (item (2) of [sort.r v])) ((item (9) of [sort.r v]) - (item (3) of [sort.r v]))\n        set [pivot v] to ([sqrt v] of (((cross x) * (cross x)) + (((cross y) * (cross y)) + ((cross z) * (cross z)))) )\n        set [cross x v] to ((cross x) / (pivot))\n        set [cross y v] to ((cross y) / (pivot))\n        set [cross z v] to ((cross z) / (pivot))\n        set [rotatedx v] to ((item (1) of [sort.r v]) - (camX))\n        set [rotatedy v] to ((item (2) of [sort.r v]) - (camY))\n        set [rotatedz v] to ((item (3) of [sort.r v]) - (camZ))\n        set [pivot v] to ([sqrt v] of (((rotatedX) * (rotatedX)) + (((rotatedY) * (rotatedY)) + ((rotatedZ) * (rotatedZ)))) )\n        set [rotatedx v] to ((rotatedX) / (pivot))\n        set [rotatedy v] to ((rotatedY) / (pivot))\n        set [rotatedz v] to ((rotatedZ) / (pivot))\n        set [pivot v] to (((rotatedX) * (cross x)) + (((rotatedY) * (cross y)) + ((rotatedZ) * (cross z))))\n        if <<(BackFaceCulling?) = [0]> or <[0] > (pivot)>> then\n            set [peri v] to (join [T;] (peri))\n            INSERT TRI FOR SORT (item (1) of [sort.r v]) (item (2) of [sort.r v]) (item (3) of [sort.r v]) (item (4) of [sort.r v]) (item (5) of [sort.r v]) (item (6) of [sort.r v]) (item (7) of [sort.r v]) (item (8) of [sort.r v]) (item (9) of [sort.r v]) (Aox) (Box) (Cox) [50] [250]\n        end\n    else\n        set [peri v] to (join [L;] (peri))\n        INSERT LINE FOR SORT (item (1) of [sort.r v]) (item (2) of [sort.r v]) (item (3) of [sort.r v]) (item (4) of [sort.r v]) (item (5) of [sort.r v]) (item (6) of [sort.r v]) [unused, fix in free time] [] [] [] [] [55] <>\n    end\nend\nset [readnum v] to (rate)\n\nif <[] = (priority?)> then\n    add ([sqrt v] of (((Aox) * (Aox)) + (((Box) * (Box)) + ((Cox) * (Cox)))) ) to [objdis v]\nend\n\ndefine RENDERBG (type)\nshow\nclear graphic effects\nswitch costume to (tiny v)\nset size to (99999999) %\nswitch costume to (type)\ngo to x: ((((((16) / (-3)) * (camDir\(y\))) + (0)) mod (960)) - (480)) y: ((((-4) * (camDir\(x\))) - ((camY) / (100))) + (10))\nswitch costume to (tiny v)\nset size to (200) %\nswitch costume to (type)\nstamp\nswitch costume to (tiny v)\nset size to (99999999) %\nswitch costume to ((type) + ((1) * <<(((camDir\(y\)) + (180)) mod (360)) > [90]> and <(((camDir\(y\)) + (180)) mod (360)) < [270]>>))\ngo to x: ((((((16) / (-3)) * (camDir\(y\))) + (480)) mod (960)) - (480)) y: ((((-4) * (camDir\(x\))) - ((camY) / (100))) + (10))\nswitch costume to (tiny v)\nset size to (200) %\nswitch costume to ((type) + ((1) * <<(((camDir\(y\)) + (180)) mod (360)) > [90]> and <(((camDir\(y\)) + (180)) mod (360)) < [270]>>))\nstamp\nswitch costume to (symbolpen v)\nhide\n\ngo to [back v] layer\n\nwhen I receive [render v]\nRENDER\n\nstop [all v]\n\nforever\n\ndefine INSERT IMAGE FOR SORT (x) (y) (z) , (s) (g) (t)\nset [aox v] to ((x) - (camX))\nset [box v] to ((y) - (camY))\nset [cox v] to ((z) - (camZ))\nadd (([sqrt v] of (((Aox) * (Aox)) + (((Box) * (Box)) + ((Cox) * (Cox)))) ) - (250)) to [objdis v]\nadd [EIBF] to [renderbuffer v]\nadd (length of [renderbuffer v]) to [sorteditemids v]\nadd (x) to [renderbuffer v]\nadd (y) to [renderbuffer v]\nadd (z) to [renderbuffer v]\nadd (s) to [renderbuffer v]\nadd (g) to [renderbuffer v]\nadd (t) to [renderbuffer v]\nadd [] to [renderbuffer v]\n\ndefine cull line || (x1) (y1) (z1) (x2) (y2) (z2) z-cull (zc)\nset [cross x v] to ((x1) + (((x2) - (x1)) * (((zc) - (z1)) / ((z2) - (z1)))))\nset [cross y v] to ((y1) + (((y2) - (y1)) * (((zc) - (z1)) / ((z2) - (z1)))))\n\nchange pen (saturation v) by (10)\n\nchange pen (brightness v) by (-20)\n\ndefine GET LIGHTING OF TRI ||  (x1) (y1) (z1) (x2) (y2) (z2) (x3) (y3) (z3)\nINTERNAL: cross ((x2) - (x1)) ((y2) - (y1)) ((z2) - (z1)) ((x3) - (x1)) ((y3) - (y1)) ((z3) - (z1))\nset [ind v] to ([sqrt v] of (((cross x) * (cross x)) + (((cross y) * (cross y)) + ((cross z) * (cross z)))) )\nset [cross x v] to ((cross x) / (ind))\nset [cross y v] to ((cross y) / (ind))\nset [cross z v] to ((cross z) / (ind))\nset [ind v] to (() - (((lightdx) * (cross x)) + (((lightdy) * (cross y)) + ((lightdz) * (cross z)))))\nchange pen (brightness v) by (((ind) - (.5)) * (20))\nset [ind v] to ((ind) * ((ind) * (ind)))\n\nwhen I receive [setuplevel v]\n\n@Event/Physics Handler\n\ndefine RAY INTERSECT TRI? ||  (o0) (o1) (o2) , (d0) (d1) (d2) , (a0) (a1) (a2) , (b0) (b1) (b2) , (c0) (c1) (c2)\nset [cross x v] to ((b0) - (a0))\nset [cross y v] to ((b1) - (a1))\nset [cross z v] to ((b2) - (a2))\nset [returnval1 v] to ((c0) - (a0))\nset [returnval2 v] to ((c1) - (a1))\nset [returnval3 v] to ((c2) - (a2))\nset [nx v] to (((d1) * (returnVal3)) - ((d2) * (returnVal2)))\nset [ny v] to (((d2) * (returnVal1)) - ((d0) * (returnVal3)))\nset [nz v] to (((d0) * (returnVal2)) - ((d1) * (returnVal1)))\nset [#determiner v] to (((cross x) * (nx)) + (((cross y) * (ny)) + ((cross z) * (nz))))\nset [px v] to ((o0) - (a0))\nset [py v] to ((o1) - (a1))\nset [pz v] to ((o2) - (a2))\nset [dist y v] to ((((nx) * (px)) + (((ny) * (py)) + ((nz) * (pz)))) * ((1) / (#Determiner)))\nif <<(dist y) < [0]> or <(dist y) > [1]>> then\n    set [iscollide? v] to [0]\nelse\n    set [ox v] to (((py) * (cross z)) - ((pz) * (cross y)))\n    set [oy v] to (((pz) * (cross x)) - ((px) * (cross z)))\n    set [oz v] to (((px) * (cross y)) - ((py) * (cross x)))\n    set [dist z v] to ((((d0) * (ox)) + (((d1) * (oy)) + ((d2) * (oz)))) * ((1) / (#Determiner)))\n    if <<(dist z) < [0]> or <((dist y) + (dist z)) > [1]>> then\n        set [iscollide? v] to [0]\n    else\n        set [dist x v] to ((((returnVal1) * (ox)) + (((returnVal2) * (oy)) + ((returnVal3) * (oz)))) * ((1) / (#Determiner)))\n        set [iscollide? v] to [1]\n    end\nend\n\ndefine PHYSICS || SPD (spd) FRICTION (friction) GRAVITY (gravity) JUMP POWER (jump power)\nif <(gameControls) = [MOBILE]> then\n    change [camdir\(y\) v] by ((((((180) * <not <([y v] of [mobilecontrols v]) > [0]>>) + ([atan v] of (([x v] of [mobilecontrols v]) / ([y v] of [mobilecontrols v])) )) + (180)) mod (360)) - (180))\nend\nif <[1] < (((playerXSpd) * (playerXSpd)) + ((playerZSpd) * (playerZSpd)))> then\n    if <[0] = (playerZSpd)> then\n        set [playerydir v] to (((((0) + ([atan v] of ((playerXSpd) / (0.1)) )) + (180)) mod (360)) - (180))\n    else\n        set [playerydir v] to ((((((180) * <not <(playerZSpd) > [0]>>) + ([atan v] of ((playerXSpd) / (playerZSpd)) )) + (180)) mod (360)) - (180))\n    end\nend\nif <([abs v] of ((playerYDir) - (TweenedplayerYDir)) ) > ([abs v] of ((playerYDir) - ((TweenedplayerYDir) + (360))) )> then\n    change [tweenedplayerydir v] by (360)\nend\nif <([abs v] of ((playerYDir) - (TweenedplayerYDir)) ) > ([abs v] of ((playerYDir) - ((TweenedplayerYDir) - (360))) )> then\n    change [tweenedplayerydir v] by (-360)\nend\nchange [tweenedplayerydir v] by ((_deltaT) * (((playerYDir) - (TweenedplayerYDir)) / (5)))\nif <(GPAnimTick) < [0]> then\n    change [playeryspd v] by ((gravity) * (_deltaT))\n    set [c1 v] to ([sqrt v] of (((playerXSpd) * (playerXSpd)) + (((playerYSpd) * (playerYSpd)) + ((playerZSpd) * (playerZSpd)))) )\n    IS COLLIDE || HITBOX (playerX) (playerY) (playerZ) ((playerSize) + ((_deltaT) * (C1))) & gameObjs (TYPE [] ) getData? <>\n    set [c1 v] to (isCollide?)\n    change [playerx v] by ((playerXSpd) * (_deltaT))\n    set [c4 v] to [0]\n    if <(C1) = [1]> then\n        IS COLLIDE || HITBOX (playerX) (playerY) (playerZ) (playerSize) & gameObjs (TYPE [] ) getData? <>\n    else\n        set [iscollide? v] to [0]\n    end\n    repeat until <<(isCollide?) = [0]> or <(C4) = [10]>>\n        change [c4 v] by (2)\n        IS COLLIDE || HITBOX (playerX) ((playerY) + (C4)) (playerZ) (playerSize) & gameObjs (TYPE [] ) getData? <>\n        if <(isCollide?) = [0]> then\n            change [playery v] by (C4)\n        end\n    end\n    set [c4 v] to [0]\n    if <(isCollide?) = [1]> then\n        repeat until <<(isCollide?) = [0]> or <([abs v] of (C4) ) > ([abs v] of (playerXSpd) )>>\n            change [c4 v] by (1)\n            change [playerx v] by ((() - (_deltaT)) * ((playerXSpd) / ([abs v] of (playerXSpd) )))\n            IS COLLIDE || HITBOX (playerX) (playerY) (playerZ) (playerSize) & gameObjs (TYPE [] ) getData? <>\n        end\n        set [playerxspd v] to [0]\n    end\n    if <<(item (5) of [keyframes v]) = [1]> and <(playerAirtimeStatus) = [1]>> then\n        PLAYER HORI INSTANT ((spd) * (1.2)) (friction) (camDir\(y\))\n        set [playeryspd v] to (jump power)\n        set [playerairtimestatus v] to [-1]\n        set [𝛾 v] to [0]\n        repeat (40)\n            change [𝛾 v] by (9)\n            set [𝛽 v] to (pick random (2.0) to (5.0))\n            CREATE PARTICLE || ID [EP1] DATA (playerX) (playerY) (playerZ) , ((𝛽) * ([sin v] of (𝛾) )) (pick random (0.00) to (2.00)) ((𝛽) * ([cos v] of (𝛾) )) , [255] [255] [255] [25] , [20]\n        end\n        start sound [High Whoosh2 v]\n    end\n    change [playery v] by ((_deltaT) * (playerYSpd))\n    if <(C1) = [1]> then\n        IS COLLIDE || HITBOX (playerX) (playerY) (playerZ) (playerSize) & gameObjs (TYPE [] ) getData? <>\n    else\n        set [iscollide? v] to [0]\n    end\n    set [c4 v] to [0]\n    if <(isCollide?) = [1]> then\n        repeat until <<(isCollide?) = [0]> or <([abs v] of (C4) ) > ([abs v] of (playerYSpd) )>>\n            change [c4 v] by (1)\n            change [playery v] by ((_deltaT) * (() - ((playerYSpd) / ([abs v] of (playerYSpd) ))))\n            IS COLLIDE || HITBOX (playerX) (playerY) (playerZ) (playerSize) & gameObjs (TYPE [] ) getData? <>\n        end\n        if <(item (5) of [keyframes v]) and <(playerYSpd) < [0]>> then\n            set [playeryspd v] to (jump power)\n            set [playerairtimestatus v] to [1]\n            set [𝛾 v] to [0]\n            repeat (40)\n                change [𝛾 v] by (9)\n                set [𝛽 v] to (pick random (2.0) to (5.0))\n                CREATE PARTICLE || ID [EP1] DATA (playerX) (playerY) (playerZ) , ((𝛽) * ([sin v] of (𝛾) )) (pick random (0.00) to (2.00)) ((𝛽) * ([cos v] of (𝛾) )) , [255] [255] [255] [25] , [20]\n            end\n            start sound [High Whoosh v]\n        else\n            if <[g] = (playerAirtimeStatus)> then\n                set [𝛾 v] to [0]\n                repeat (40)\n                    change [𝛾 v] by (9)\n                    set [𝛽 v] to (pick random (2.0) to (7.0))\n                    CREATE PARTICLE || ID [EP1] DATA (playerX) ((playerY) - (playerSize)) (playerZ) , ((𝛽) * ([sin v] of (𝛾) )) [0] ((𝛽) * ([cos v] of (𝛾) )) , [255] [255] [255] [0] , [20]\n                end\n                start sound [loud impact v]\n            else\n                if <[-5] > ((playerYSpd) / (_deltaT))> then\n                    start sound [impact v]\n                end\n            end\n            set [playeryspd v] to [0]\n            set [playerairtimestatus v] to [0]\n            PLAYER HORI MOVEMENT (spd) (friction) ((_deltaT) / (2))\n        end\n        set [inair? v] to [0]\n    else\n        if <(playerAirtimeStatus) = [l]> then\n            PLAYER HORI MOVEMENT ((2) * (spd)) [1] ((_deltaT) / (100))\n        else\n            if <not <(playerAirtimeStatus) = [h]>> then\n                PLAYER HORI MOVEMENT (spd) [.97] ((_deltaT) / (20))\n            end\n        end\n        IS COLLIDE || HITBOX (playerX) ((playerY) - (20)) (playerZ) (playerSize) & gameObjs (TYPE [] ) getData? <>\n        if <(isCollide?) = [0]> then\n            IS COLLIDE || HITBOX (playerX) ((playerY) + (10)) (playerZ) (playerSize) & gameObjs (TYPE [] ) getData? <>\n            if <(isCollide?) = [0]> then\n                if <(inAir?) = [0]> then\n                    if <not <(playerAirtimeStatus) = [l]>> then\n                        set [playerairtimestatus v] to [1]\n                    end\n                end\n            end\n            set [inair? v] to [1]\n        else\n            if <(playerAirtimeStatus) = [0]> then\n                set [c4 v] to [0]\n                set [iscollide? v] to [0]\n                repeat until <<(isCollide?) = [1]> or <(C4) = [-20]>>\n                    change [c4 v] by (-1)\n                    IS COLLIDE || HITBOX (playerX) ((playerY) + (C4)) (playerZ) (playerSize) & gameObjs (TYPE [] ) getData? <>\n                    if <(isCollide?) = [1]> then\n                        change [playery v] by ((C4) + (1))\n                        if <(item (5) of [keyframes v]) and <(playerYSpd) < [0]>> then\n                            set [playeryspd v] to (jump power)\n                            set [playerairtimestatus v] to [1]\n                            set [𝛾 v] to [0]\n                            repeat (40)\n                                change [𝛾 v] by (9)\n                                set [𝛽 v] to (pick random (2.0) to (5.0))\n                                CREATE PARTICLE || ID [EP1] DATA (playerX) (playerY) (playerZ) , ((𝛽) * ([sin v] of (𝛾) )) (pick random (0.00) to (2.00)) ((𝛽) * ([cos v] of (𝛾) )) , [255] [255] [255] [25] , [20]\n                            end\n                            start sound [High Whoosh v]\n                        else\n                            if <[g] = (playerAirtimeStatus)> then\n                                set [𝛾 v] to [0]\n                                repeat (40)\n                                    change [𝛾 v] by (9)\n                                    set [𝛽 v] to (pick random (2.0) to (7.0))\n                                    CREATE PARTICLE || ID [EP1] DATA (playerX) ((playerY) - (playerSize)) (playerZ) , ((𝛽) * ([sin v] of (𝛾) )) [0] ((𝛽) * ([cos v] of (𝛾) )) , [255] [255] [255] [0] , [20]\n                                end\n                                start sound [loud impact v]\n                            else\n                                if <[-5] > (playerYSpd)> then\n                                    start sound [impact v]\n                                end\n                            end\n                            set [playeryspd v] to [0]\n                            set [playerairtimestatus v] to [0]\n                            PLAYER HORI MOVEMENT (spd) (friction) ((_deltaT) / (2))\n                        end\n                        set [inair? v] to [0]\n                    end\n                end\n            end\n        end\n    end\n    change [playerz v] by ((_deltaT) * (playerZSpd))\n    set [c4 v] to [0]\n    if <(C1) = [1]> then\n        IS COLLIDE || HITBOX (playerX) (playerY) (playerZ) (playerSize) & gameObjs (TYPE [] ) getData? <>\n    else\n        set [iscollide? v] to [0]\n    end\n    repeat until <<(isCollide?) = [0]> or <(C4) = [10]>>\n        change [c4 v] by (2)\n        IS COLLIDE || HITBOX (playerX) ((playerY) - (C4)) (playerZ) (playerSize) & gameObjs (TYPE [] ) getData? <>\n        if <(isCollide?) = [0]> then\n            change [playery v] by (() - (C4))\n        else\n            IS COLLIDE || HITBOX (playerX) ((playerY) + (C4)) (playerZ) (playerSize) & gameObjs (TYPE [] ) getData? <>\n            if <(isCollide?) = [0]> then\n                change [playery v] by (C4)\n            end\n        end\n    end\n    set [c4 v] to [0]\n    if <(isCollide?) = [1]> then\n        repeat until <<(isCollide?) = [0]> or <([abs v] of (C4) ) > ([abs v] of (playerZSpd) )>>\n            change [c4 v] by (1)\n            change [playerz v] by ((_deltaT) * (() - (([abs v] of (playerZSpd) ) / (playerZSpd))))\n            IS COLLIDE || HITBOX (playerX) (playerY) (playerZ) (playerSize) & gameObjs (TYPE [] ) getData? <>\n        end\n        set [playerzspd v] to [0]\n    end\n    if <<[1] = (item (7) of [keyframes v])> and <<not <(playerAirtimeStatus) = [0]>> and <not <(playerAirtimeStatus) = [g]>>>> then\n        set [playerxspd v] to [0]\n        set [playerzspd v] to [0]\n        set [playeryspd v] to [-40]\n        set [playerairtimestatus v] to [g]\n        set [gpanimtick v] to [9]\n    end\n    if <<(item (6) of [keyframes v]) = [1]> and <<(playerAirtimeStatus) = [0]> or <([abs v] of (playerAirtimeStatus) ) = [1]>>> then\n        if <not <((item (1) of [keyframes v]) - (item (2) of [keyframes v])) = [0]>> then\n            PLAYER HORI INSTANT ((playerSpeed) * (2)) [1] (camDir\(y\))\n        else\n            if <not <((item (3) of [keyframes v]) - (item (4) of [keyframes v])) = [0]>> then\n                PLAYER HORI INSTANT ((playerSpeed) * (2)) [1] (camDir\(y\))\n            else\n                replace item (1) of [keyframes v] with [1]\n                PLAYER HORI INSTANT ((playerSpeed) * (2)) [1] (playerYDir)\n            end\n        end\n        set [playeryspd v] to (jump power)\n        set [playerairtimestatus v] to [l]\n        set [𝛾 v] to [0]\n        repeat (40)\n            change [𝛾 v] by (9)\n            set [𝛽 v] to (pick random (2.0) to (5.0))\n            CREATE PARTICLE || ID [EP1] DATA (playerX) (playerY) (playerZ) , ((𝛽) * ([sin v] of (𝛾) )) (pick random (0.00) to (2.00)) ((𝛽) * ([cos v] of (𝛾) )) , [255] [255] [255] [25] , [20]\n        end\n        start sound [mixkit-quick-jump-arcade-game-2 v]\n    end\n    if <<(playerYSpd) > [0]> and <(playerAirtimeStatus) = [g]>> then\n        set [playerairtimestatus v] to [1]\n    end\nelse\n    change [gpanimtick v] by (() - (_deltaT))\nend\nGET ANIMS\n\ndefine SOLID DETECTION || x (x) y (y) z (z) || PLAYER HEIGHT (height)\nif <((y) - (height)) < [0]> then\n    set [returnval1 v] to [1]\n    stop [this script v]\nend\nset [c1 v] to [0]\nrepeat ((length of [hitbox meshes v]) / (6))\n    if <<(x) > (item ((C1) + (1)) of [hitbox meshes v])> and <(x) < (item ((C1) + (2)) of [hitbox meshes v])>> then\n        if <<(y) > (item ((C1) + (3)) of [hitbox meshes v])> and <((y) - (height)) < (item ((C1) + (4)) of [hitbox meshes v])>> then\n            if <<(z) > (item ((C1) + (5)) of [hitbox meshes v])> and <(z) < (item ((C1) + (6)) of [hitbox meshes v])>> then\n                set [returnval1 v] to [1]\n                stop [this script v]\n            end\n        end\n    end\n    change [c1 v] by (6)\nend\nset [returnval1 v] to [0]\n\ndefine GODMODE || ACCEL (acel) FRICTION (friction)\nchange [playeryspd v] by ((<key (z v) pressed?> - <key (x v) pressed?>) * (acel))\nif <key (w v) pressed?> then\n    change [playerxspd v] by ((acel) * ([sin v] of (camDir\(y\)) ))\n    change [playerzspd v] by ((acel) * ([cos v] of (camDir\(y\)) ))\nend\nif <key (s v) pressed?> then\n    change [playerxspd v] by ((() - (acel)) * ([sin v] of (camDir\(y\)) ))\n    change [playerzspd v] by ((() - (acel)) * ([cos v] of (camDir\(y\)) ))\nend\nif <key (d v) pressed?> then\n    change [playerxspd v] by ((acel) * ([sin v] of ((camDir\(y\)) + (90)) ))\n    change [playerzspd v] by ((acel) * ([cos v] of ((camDir\(y\)) + (90)) ))\nend\nif <key (a v) pressed?> then\n    change [playerxspd v] by ((acel) * ([sin v] of ((camDir\(y\)) - (90)) ))\n    change [playerzspd v] by ((acel) * ([cos v] of ((camDir\(y\)) - (90)) ))\nend\nset [playerxspd v] to ((playerXSpd) * (friction))\nset [playerzspd v] to ((playerZSpd) * (friction))\nset [playeryspd v] to ((playerYSpd) * (friction))\nchange [playerx v] by ((_deltaT) * (playerXSpd))\nchange [playery v] by ((_deltaT) * (playerYSpd))\nchange [playerz v] by ((_deltaT) * (playerZSpd))\n\ndefine PLAYER MOVEMENT\nif <(editorStatus) = [0]> then\n    if <(gameControls) = [MOBILE]> then\n        PHYSICS || SPD ((12) * ((([x v] of [mobilecontrols v]) * ([x v] of [mobilecontrols v])) + (([y v] of [mobilecontrols v]) * ([y v] of [mobilecontrols v])))) FRICTION [.8] GRAVITY [-1.5] JUMP POWER [22]\n    else\n        PHYSICS || SPD [12] FRICTION [.8] GRAVITY [-1.5] JUMP POWER [22]\n    end\nelse\n    GODMODE || ACCEL [7] FRICTION [0.9]\nend\n\ndefine CAMERA MOVEMENT (fx) (fy) (fz) <cammove?>\nif <cammove?> then\n    change [camxaxis v] by (((item (8) of [keyframes v]) - (item (9) of [keyframes v])) * ((-5) * (_deltaT)))\n    change [camyaxis v] by (((item (10) of [keyframes v]) - (item (11) of [keyframes v])) * ((5) * (_deltaT)))\n    set [camx v] to ((fx) + (([sin v] of (camYAxis) ) * ((camPlayerDis) * ([cos v] of (camXAxis) ))))\n    set [camy v] to ((fy) + ((camPlayerDis) * ([sin v] of (camXAxis) )))\n    set [camz v] to ((fz) + (([cos v] of (camYAxis) ) * ((camPlayerDis) * ([cos v] of (camXAxis) ))))\nend\nset [camdir\(y\) v] to ((< ((fx) - (camX)) contains [-]?> * (180)) + ((90) - ([atan v] of (((fz) - (camZ)) / ((fx) - (camX))) )))\nset [camdir\(x\) v] to ([atan v] of (((fy) - (camY)) / ((camPlayerDis) * ([cos v] of (camXAxis) ))) )\nif <cammove?> then\n    change [camplayerdis v] by ((<key (i v) pressed?> - <key (o v) pressed?>) * ((10) * (_deltaT)))\n    if <(camXAxis) > [-100]> then\n        set [camxaxis v] to [-100]\n    end\n    if <[-180] > (camXAxis)> then\n        set [camxaxis v] to [-180]\n    end\nelse\n    set [camplayerdis v] to (((fx) - (camX)) * ((fx) - (camX)))\n    change [camplayerdis v] by (((fy) - (camY)) * ((fy) - (camY)))\n    set [camplayerdis v] to (() - ([sqrt v] of ((camPlayerDis) + (((fz) - (camZ)) * ((fz) - (camZ)))) ))\nend\nif <<(KEYFRAMES) = [0]> and <(gameControls) = [MOBILE]>> then\n    GET SHORTEST ROTATION || (camYAxis) ((playerYDir) + (180))\n    change [camyaxis v] by ((returnVal1) / (50))\nend\n\ndefine IS COLLIDE || HITBOX (hx) (hy) (hz) (hr) & gameObjs (TYPE (t) ) getData? <getdata?>\nset [iscollide? v] to [0]\nset [readnum v] to [1]\nset [c3 v] to [0]\nif <getdata?> then\n    delete all of [collisiondata v]\nend\nrepeat (length of [physicscache v])\n    delete all of [b v]\n    change [c3 v] by (1)\n    set [readnum v] to (item (C3) of [physicscache v])\n    set [readval v] to [null]\n    repeat until <[] = (readVal)>\n        READ FROM || GameObjects\n        add (readVal) to [b v]\n    end\n    if <[] = (t)> then\n        if <<(item (1) of [b v]) = [EMT]> or <<(item (1) of [b v]) = [PT]> or <(item (1) of [b v]) = [EST]>>> then\n            delete (1) of [b v]\n            set [cross x v] to ((playerX) - (item (1) of [b v]))\n            set [cross y v] to ((playerY) - (item (2) of [b v]))\n            set [cross z v] to ((playerZ) - (item (3) of [b v]))\n            set [c2 v] to ([sqrt v] of (((cross x) * (cross x)) + (((cross y) * (cross y)) + ((cross z) * (cross z)))) )\n            if <[750] > (C2)> then\n                INTERNAL: cross ((item (4) of [b v]) - (item (1) of [b v])) ((item (5) of [b v]) - (item (2) of [b v])) ((item (6) of [b v]) - (item (3) of [b v])) ((item (7) of [b v]) - (item (1) of [b v])) ((item (8) of [b v]) - (item (2) of [b v])) ((item (9) of [b v]) - (item (3) of [b v]))\n                set [c2 v] to ([sqrt v] of (((cross x) * (cross x)) + (((cross y) * (cross y)) + ((cross z) * (cross z)))) )\n                set [cross x v] to ((cross x) / (C2))\n                set [cross y v] to ((cross y) / (C2))\n                set [cross z v] to ((cross z) / (C2))\n                triangle sphere | (hx) (hy) (hz) radius (hr) triangle (item (1) of [b v]) (item (2) of [b v]) (item (3) of [b v]) , (item (4) of [b v]) (item (5) of [b v]) (item (6) of [b v]) , (item (7) of [b v]) (item (8) of [b v]) (item (9) of [b v]) normals (cross x) (cross y) (cross z)\n                if <(intersects?) = [1]> then\n                    set [iscollide? v] to [1]\n                    add (C3) to [collisiondata v]\n                    add (item (C3) of [gameobjects v]) to [collisiondata v]\n                    if <not <getdata?>> then\n                        stop [this script v]\n                    end\n                end\n            end\n        else\n            if <(item (1) of [b v]) = [PL]> then\n                delete (1) of [b v]\n                line sphere | (hx) (hy) (hz) r (hr) line (item (1) of [b v]) (item (2) of [b v]) (item (3) of [b v]) (item (4) of [b v]) (item (5) of [b v]) (item (6) of [b v]) r (item (10) of [b v])\n                if <(intersects?) = [1]> then\n                    set [iscollide? v] to [1]\n                    add (item (C3) of [physicscache v]) to [collisiondata v]\n                    add (item (item (C3) of [physicscache v]) of [gameobjects v]) to [collisiondata v]\n                    if <not <getdata?>> then\n                        stop [this script v]\n                    end\n                end\n            end\n        end\n    else\n        if < (item (1) of [b v]) contains (t)?> then\n            delete (1) of [b v]\n            INTERNAL: cross ((item (4) of [b v]) - (item (1) of [b v])) ((item (5) of [b v]) - (item (2) of [b v])) ((item (6) of [b v]) - (item (3) of [b v])) ((item (7) of [b v]) - (item (1) of [b v])) ((item (8) of [b v]) - (item (2) of [b v])) ((item (9) of [b v]) - (item (3) of [b v]))\n            set [c2 v] to ([sqrt v] of (((cross x) * (cross x)) + (((cross y) * (cross y)) + ((cross z) * (cross z)))) )\n            set [cross x v] to ((cross x) / (C2))\n            set [cross y v] to ((cross y) / (C2))\n            set [cross z v] to ((cross z) / (C2))\n            triangle sphere | (hx) (hy) (hz) radius (hr) triangle (item (1) of [b v]) (item (2) of [b v]) (item (3) of [b v]) , (item (4) of [b v]) (item (5) of [b v]) (item (6) of [b v]) , (item (7) of [b v]) (item (8) of [b v]) (item (9) of [b v]) normals (cross x) (cross y) (cross z)\n            if <(intersects?) = [1]> then\n                set [iscollide? v] to [1]\n                add (item (C3) of [physicscache v]) to [collisiondata v]\n                add (item (item (C3) of [physicscache v]) of [gameobjects v]) to [collisiondata v]\n                if <not <getdata?>> then\n                    stop [this script v]\n                end\n            end\n        end\n    end\nend\n\ndefine READ FROM || GameObjects\nset [readval v] to (item (readNum) of [gameobjects v])\nchange [readnum v] by (1)\n\nwhen [0 v] key pressed\nset [editorstatus v] to (((editorStatus) + (1)) mod (2))\n\ndefine triangle sphere | (px) (py) (pz) radius (rad) triangle (x1) (y1) (z1) , (x2) (y2) (z2) , (x3) (y3) (z3) normals (nx) (ny) (nz)\nset [ox v] to ((px) - (x1))\nset [oy v] to ((py) - (y1))\nset [oz v] to ((pz) - (z1))\nset [dot v] to ((((nx) * (ox)) + ((ny) * (oy))) + ((nz) * (oz)))\nset [px v] to ((x1) + ((ox) - ((dot) * (nx))))\nset [py v] to ((y1) + ((oy) - ((dot) * (ny))))\nset [pz v] to ((z1) + ((oz) - ((dot) * (nz))))\nset [ux v] to ((x2) - (x1))\nset [uy v] to ((y2) - (y1))\nset [uz v] to ((z2) - (z1))\nset [vx v] to ((x3) - (x1))\nset [vy v] to ((y3) - (y1))\nset [vz v] to ((z3) - (z1))\nINTERNAL: cross (ux) (uy) (uz) (vx) (vy) (vz)\nset [nx v] to (cross x)\nset [ny v] to (cross y)\nset [nz v] to (cross z)\nset [wx v] to ((px) - (x1))\nset [wy v] to ((py) - (y1))\nset [wz v] to ((pz) - (z1))\nINTERNAL: cross (ux) (uy) (uz) (wx) (wy) (wz)\nset [𝛾 v] to (((((cross x) * (nx)) + ((cross y) * (ny))) + ((cross z) * (nz))) / ((((nx) * (nx)) + ((ny) * (ny))) + ((nz) * (nz))))\nINTERNAL: cross (wx) (wy) (wz) (vx) (vy) (vz)\nset [𝛽 v] to (((((cross x) * (nx)) + ((cross y) * (ny))) + ((cross z) * (nz))) / ((((nx) * (nx)) + ((ny) * (ny))) + ((nz) * (nz))))\nset [𝛼 v] to (((1) - (𝛾)) - (𝛽))\nset [inside tri v] to <<<((round (((𝛼) + ((𝛽) + (𝛾))) * (10000))) / (10000)) = [1]> and <<not <(𝛼) < [0]>> and <not <(𝛼) > [1]>>>> and <<<not <(𝛽) < [0]>> and <not <(𝛽) > [1]>>> and <<not <(𝛾) < [0]>> and <not <(𝛾) > [1]>>>>>\nif <(inside tri) = [false]> then\n    delete all of [cycle v]\n    INTERNAL: closest to point (px) (py) (pz) to line segment (x1) (y1) (z1) , (x2) (y2) (z2)\n    INTERNAL: closest to point (px) (py) (pz) to line segment (x2) (y2) (z2) , (x3) (y3) (z3)\n    INTERNAL: closest to point (px) (py) (pz) to line segment (x3) (y3) (z3) , (x1) (y1) (z1)\n    set [𝛼 v] to ([sqrt v] of ((((item (1) of [cycle v]) - (px)) * ((item (1) of [cycle v]) - (px))) + ((((item (2) of [cycle v]) - (py)) * ((item (2) of [cycle v]) - (py))) + (((item (3) of [cycle v]) - (pz)) * ((item (3) of [cycle v]) - (pz))))) )\n    set [𝛽 v] to ([sqrt v] of ((((item (4) of [cycle v]) - (px)) * ((item (4) of [cycle v]) - (px))) + ((((item (5) of [cycle v]) - (py)) * ((item (5) of [cycle v]) - (py))) + (((item (6) of [cycle v]) - (pz)) * ((item (6) of [cycle v]) - (pz))))) )\n    set [𝛾 v] to ([sqrt v] of ((((item (7) of [cycle v]) - (px)) * ((item (7) of [cycle v]) - (px))) + ((((item (8) of [cycle v]) - (py)) * ((item (8) of [cycle v]) - (py))) + (((item (9) of [cycle v]) - (pz)) * ((item (9) of [cycle v]) - (pz))))) )\n    if <<(𝛼) < (𝛽)> and <(𝛼) < (𝛾)>> then\n        set [px v] to (item (1) of [cycle v])\n        set [py v] to (item (2) of [cycle v])\n        set [pz v] to (item (3) of [cycle v])\n    else\n        if <(𝛽) < (𝛾)> then\n            set [px v] to (item (4) of [cycle v])\n            set [py v] to (item (5) of [cycle v])\n            set [pz v] to (item (6) of [cycle v])\n        else\n            set [px v] to (item (7) of [cycle v])\n            set [py v] to (item (8) of [cycle v])\n            set [pz v] to (item (9) of [cycle v])\n        end\n    end\nend\nset [dist x v] to ((px) - (px))\nset [dist y v] to ((py) - (py))\nset [dist z v] to ((pz) - (pz))\nset [dist v] to ([sqrt v] of (((dist x) * (dist x)) + (((dist y) * (dist y)) + ((dist z) * (dist z)))) )\nif <not <(rad) < (dist)>> then\n    set [intersects? v] to [1]\nelse\n    set [intersects? v] to [0]\nend\n\ndefine INTERNAL: closest to point (px) (py) (pz) to line segment (x1) (y1) (z1) , (x2) (y2) (z2)\nset [ux v] to ((x2) - (x1))\nset [uy v] to ((y2) - (y1))\nset [uz v] to ((z2) - (z1))\nset [𝛾 v] to ((((((px) - (x1)) * (ux)) + (((py) - (y1)) * (uy))) + (((pz) - (z1)) * (uz))) / (((ux) * (ux)) + (((uy) * (uy)) + ((uz) * (uz)))))\nif <not <(𝛾) > [0]>> then\n    add (x1) to [cycle v]\n    add (y1) to [cycle v]\n    add (z1) to [cycle v]\nelse\n    if <not <(𝛾) < [1]>> then\n        add (x2) to [cycle v]\n        add (y2) to [cycle v]\n        add (z2) to [cycle v]\n    else\n        add ((x1) + ((𝛾) * (ux))) to [cycle v]\n        add ((y1) + ((𝛾) * (uy))) to [cycle v]\n        add ((z1) + ((𝛾) * (uz))) to [cycle v]\n    end\nend\n\ndefine INTERNAL: cross (x1) (y1) (z1) (x2) (y2) (z2)\nset [cross x v] to (((y1) * (z2)) - ((y2) * (z1)))\nset [cross y v] to (((x2) * (z1)) - ((x1) * (z2)))\nset [cross z v] to (((x1) * (y2)) - ((x2) * (y1)))\n\ndefine GET KEYFRAMES\nif <(gameControls) = [PC]> then\n    if <key (w v) pressed?> then\n        replace item (1) of [keyframes v] with ((item (1) of [keyframes v]) + (1))\n    else\n        replace item (1) of [keyframes v] with [0]\n    end\n    if <key (s v) pressed?> then\n        replace item (2) of [keyframes v] with ((item (2) of [keyframes v]) + (1))\n    else\n        replace item (2) of [keyframes v] with [0]\n    end\n    if <key (d v) pressed?> then\n        replace item (3) of [keyframes v] with ((item (3) of [keyframes v]) + (1))\n    else\n        replace item (3) of [keyframes v] with [0]\n    end\n    if <key (a v) pressed?> then\n        replace item (4) of [keyframes v] with ((item (4) of [keyframes v]) + (1))\n    else\n        replace item (4) of [keyframes v] with [0]\n    end\n    if <key (space v) pressed?> then\n        replace item (5) of [keyframes v] with ((item (5) of [keyframes v]) + (1))\n    else\n        replace item (5) of [keyframes v] with [0]\n    end\n    if <key (e v) pressed?> then\n        replace item (6) of [keyframes v] with ((item (6) of [keyframes v]) + (1))\n    else\n        replace item (6) of [keyframes v] with [0]\n    end\n    if <key (q v) pressed?> then\n        replace item (7) of [keyframes v] with ((item (7) of [keyframes v]) + (1))\n    else\n        replace item (7) of [keyframes v] with [0]\n    end\n    if <key (up arrow v) pressed?> then\n        replace item (8) of [keyframes v] with [1]\n    else\n        replace item (8) of [keyframes v] with [0]\n    end\n    if <key (down arrow v) pressed?> then\n        replace item (9) of [keyframes v] with [1]\n    else\n        replace item (9) of [keyframes v] with [0]\n    end\n    if <key (right arrow v) pressed?> then\n        replace item (10) of [keyframes v] with [1]\n    else\n        replace item (10) of [keyframes v] with [0]\n    end\n    if <key (left arrow v) pressed?> then\n        replace item (11) of [keyframes v] with [1]\n    else\n        replace item (11) of [keyframes v] with [0]\n    end\nend\n\ndefine INIT KEYFRAMES\ndelete all of [keyframes v]\nrepeat (11)\n    add [0] to [keyframes v]\nend\n\ndefine PLAYER HORI MOVEMENT (spd) (friction) (accel)\nif (item (1) of [keyframes v]) then\n    change [playerxspd v] by ((accel) * (((spd) * ([sin v] of (camDir\(y\)) )) - (playerXSpd)))\n    change [playerzspd v] by ((accel) * (((spd) * ([cos v] of (camDir\(y\)) )) - (playerZSpd)))\nend\nif (item (2) of [keyframes v]) then\n    change [playerxspd v] by ((accel) * (((() - (spd)) * ([sin v] of (camDir\(y\)) )) - (playerXSpd)))\n    change [playerzspd v] by ((accel) * (((() - (spd)) * ([cos v] of (camDir\(y\)) )) - (playerZSpd)))\nend\nif (item (3) of [keyframes v]) then\n    change [playerxspd v] by ((accel) * (((spd) * ([sin v] of ((camDir\(y\)) + (90)) )) - (playerXSpd)))\n    change [playerzspd v] by ((accel) * (((spd) * ([cos v] of ((camDir\(y\)) + (90)) )) - (playerZSpd)))\nend\nif (item (4) of [keyframes v]) then\n    change [playerxspd v] by ((accel) * (((spd) * ([sin v] of ((camDir\(y\)) - (90)) )) - (playerXSpd)))\n    change [playerzspd v] by ((accel) * (((spd) * ([cos v] of ((camDir\(y\)) - (90)) )) - (playerZSpd)))\nend\nif <not <<(item (1) of [keyframes v]) or (item (2) of [keyframes v])> or <(item (3) of [keyframes v]) or (item (4) of [keyframes v])>>> then\n    set [playerxspd v] to ((playerXSpd) * ([e ^ v] of ((_deltaT) * ([ln v] of (friction) )) ))\n    set [playerzspd v] to ((playerZSpd) * ([e ^ v] of ((_deltaT) * ([ln v] of (friction) )) ))\nend\n\ndefine HANDLE PHYSICS/EVENTS\nIS COLLIDE || HITBOX (playerX) (playerY) (playerZ) ((playerSize) + (5)) & gameObjs (TYPE [T] ) getData? \nif <[collisiondata v] contains [EMT]?> then\n    MOVING PLATFORMS PHYSICS\nend\nif <[collisiondata v] contains [EST]?> then\n    SPINNINGPLATFORMPHYSICS\nend\nif <[collisiondata v] contains [KT]?> then\n    set [playeryspd v] to [20]\n    change [playery v] by (10)\nend\nif <[collisiondata v] contains [BT]?> then\n    delete all of [b v]\n    set [readval v] to [null]\n    set [readnum v] to (item ((item # of [BT] in [collisiondata v]) - (1)) of [collisiondata v])\n    repeat until <[] = (readVal)>\n        READ FROM || GameObjects\n        add (readVal) to [b v]\n    end\n    delete (1) of [b v]\n    set [ox v] to ((item (7) of [b v]) - (item (1) of [b v]))\n    set [oy v] to ((item (8) of [b v]) - (item (2) of [b v]))\n    set [oz v] to ((item (9) of [b v]) - (item (3) of [b v]))\n    set [wx v] to ((item (4) of [b v]) - (item (1) of [b v]))\n    set [wy v] to ((item (5) of [b v]) - (item (2) of [b v]))\n    set [wz v] to ((item (6) of [b v]) - (item (3) of [b v]))\n    INTERNAL: cross (wx) (wy) (wz) (ox) (oy) (oz)\n    set [𝛼 v] to ([sqrt v] of (((cross x) * (cross x)) + (((cross y) * (cross y)) + ((cross z) * (cross z)))) )\n    set [cross x v] to ((50) * ((cross x) / (𝛼)))\n    set [cross y v] to ((50) * ((cross y) / (𝛼)))\n    set [cross z v] to ((50) * ((cross z) / (𝛼)))\n    set [playerxspd v] to (cross x)\n    set [playeryspd v] to (cross y)\n    set [playerzspd v] to (cross z)\n    set [playerairtimestatus v] to [1]\n    PLAYER HORI INSTANT ((3) * (5)) [1] (camDir\(y\))\n    start sound [Clang v]\nend\nif <[-2500] > (playerY)> then\n    set [playerdead? v] to [1]\nend\nset [c1 v] to (item # of [S] in [gameobjects v])\nif <(C1) > [0]> then\n    repeat (6)\n        delete ((C1) - (1)) of [gameobjects v]\n    end\nend\nRAY-OBJ COLLIDE? || (playerX) (playerY) (playerZ) (playerX) ((playerY) - (1)) (playerZ) below? \nif <(isCollide?) = [1]> then\n    add [] to [gameobjects v]\n    add [S] to [gameobjects v]\n    add (round (playerX)) to [gameobjects v]\n    add (round ((playerY) - (dist x))) to [gameobjects v]\n    add (round (playerZ)) to [gameobjects v]\n    add ((playerSize) / (2)) to [gameobjects v]\nend\n\ndefine PLAYER HORI INSTANT (spd) (friction) (axis)\nif (item (1) of [keyframes v]) then\n    set [playerxspd v] to ((spd) * ([sin v] of (axis) ))\n    set [playerzspd v] to ((spd) * ([cos v] of (axis) ))\nend\nif (item (2) of [keyframes v]) then\n    set [playerxspd v] to ((() - (spd)) * ([sin v] of (axis) ))\n    set [playerzspd v] to ((() - (spd)) * ([cos v] of (axis) ))\nend\nif (item (3) of [keyframes v]) then\n    set [playerxspd v] to ((spd) * ([sin v] of ((axis) + (90)) ))\n    set [playerzspd v] to ((spd) * ([cos v] of ((axis) + (90)) ))\nend\nif (item (4) of [keyframes v]) then\n    set [playerxspd v] to ((spd) * ([sin v] of ((axis) - (90)) ))\n    set [playerzspd v] to ((spd) * ([cos v] of ((axis) - (90)) ))\nend\nset [playerxspd v] to ((playerXSpd) * ([e ^ v] of ((_deltaT) * ([ln v] of (friction) )) ))\nset [playerzspd v] to ((playerZSpd) * ([e ^ v] of ((_deltaT) * ([ln v] of (friction) )) ))\n\ndefine GET ANIMS\nif <(playerAirtimeStatus) = [g]> then\n    set [playeranimcos v] to [9]\n    if <((GPAnimTick) - (3)) > [0]> then\n        set [playerxdir v] to ((60) * ((GPAnimTick) - (3)))\n    else\n        set [playerxdir v] to [0]\n    end\nelse\n    if <(playerAirtimeStatus) = [l]> then\n        set [playeranimcos v] to [8]\n        set [playerxdir v] to ([atan v] of ((playerYSpd) / ([sqrt v] of (((playerXSpd) * (playerXSpd)) + ((playerZSpd) * (playerZSpd))) )) )\n    else\n        if <[0] = (inAir?)> then\n            if <[2] > (((playerXSpd) * (playerXSpd)) + ((playerZSpd) * (playerZSpd)))> then\n                set [playeranimcos v] to ((4) + (((timer) * (2)) mod (2)))\n            else\n                set [𝛼 v] to (playerAnimCos)\n                set [playeranimcos v] to ((1) + (((timer) * (10)) mod (4)))\n                if <not <([floor v] of (𝛼) ) = ([floor v] of (playerAnimCos) )>> then\n                    if <([floor v] of (playerAnimCos) ) = [1]> then\n                        CREATE PARTICLE || ID [EP1] DATA ((playerX) + ((15) * ([cos v] of (TweenedplayerYDir) ))) ((playerY) - (playerSize)) ((playerZ) + ((15) * ([sin v] of (TweenedplayerYDir) ))) , ((-0.5) * (playerXSpd)) [1] ((-0.5) * (playerZSpd)) , [255] [255] [255] [0] , (pick random (10) to (15))\n                    else\n                        if <([floor v] of (playerAnimCos) ) = [3]> then\n                            CREATE PARTICLE || ID [EP1] DATA ((playerX) + ((-15) * ([cos v] of (TweenedplayerYDir) ))) ((playerY) - (playerSize)) ((playerZ) + ((-15) * ([sin v] of (TweenedplayerYDir) ))) , ((-0.5) * (playerXSpd)) [1] ((-0.5) * (playerZSpd)) , [255] [255] [255] [0] , (pick random (10) to (15))\n                        end\n                    end\n                end\n            end\n            set [playerxdir v] to [0]\n        else\n            if <(playerAirtimeStatus) = [-1]> then\n                set [playeranimcos v] to [7]\n            else\n                set [playeranimcos v] to [6]\n            end\n            set [playerxdir v] to ([atan v] of ((playerYSpd) / (50)) )\n        end\n    end\nend\n\ndefine CREATE PARTICLE || ID (id) DATA (x) (y) (z) , (xv) (yv) (zv) , (r) (g) (b) (a) , (s)\nadd [] to [gameobjects v]\nadd (id) to [gameobjects v]\nadd (x) to [gameobjects v]\nadd (y) to [gameobjects v]\nadd (z) to [gameobjects v]\nadd (xv) to [gameobjects v]\nadd (yv) to [gameobjects v]\nadd (zv) to [gameobjects v]\nadd (r) to [gameobjects v]\nadd (g) to [gameobjects v]\nadd (b) to [gameobjects v]\nadd (a) to [gameobjects v]\nadd (s) to [gameobjects v]\n\ndefine PLAYERRESPAWN\nset [camplayerdis v] to [-500]\nset [camdir\(y\) v] to [0]\nset [camdir\(x\) v] to [0]\nset [playerx v] to (respawnX)\nset [playery v] to (respawnY)\nset [playerz v] to (respawnZ)\nset [playersize v] to [40]\nset [playerxspd v] to [0]\nset [playeryspd v] to [0]\nset [playerzspd v] to [0]\nset [playerdead? v] to [0]\nbroadcast (LoadState v)\n\ndefine line sphere | (sx) (sy) (sz) r (r) line (x1) (y1) (z1) (x2) (y2) (z2) r (lr)\nset [ux v] to ((sx) - (x1))\nset [uy v] to ((sy) - (y1))\nset [uz v] to ((sz) - (z1))\nset [dist x v] to ((x2) - (x1))\nset [dist y v] to ((y2) - (y1))\nset [dist z v] to ((z2) - (z1))\nset [𝛼 v] to ([sqrt v] of (((dist z) * (dist z)) + (((dist y) * (dist y)) + ((dist x) * (dist x)))) )\nset [dist x v] to (((x2) - (x1)) / (𝛼))\nset [dist y v] to (((y2) - (y1)) / (𝛼))\nset [dist z v] to (((z2) - (z1)) / (𝛼))\nset [dist v] to (((dist x) * (ux)) + (((dist y) * (uy)) + ((dist z) * (uz))))\nif <<(dist) > (() - (r))> and <((𝛼) + (r)) > (dist)>> then\n    set [nx v] to (((dist y) * (uz)) - ((dist z) * (uy)))\n    set [ny v] to (((dist z) * (ux)) - ((dist x) * (uz)))\n    set [nz v] to (((dist x) * (uy)) - ((dist y) * (ux)))\n    set [𝛼 v] to ([sqrt v] of (((nx) * (nx)) + (((ny) * (ny)) + ((nz) * (nz)))) )\n    set [intersects? v] to (<(𝛼) < (((lr) + (r)) / (1.414))> + ())\nelse\n    set [intersects? v] to [0]\nend\n\ndefine MOVING PLATFORMS PHYSICS\ndelete all of [b v]\nset [readval v] to [null]\nset [readnum v] to (item ((item # of [EMT] in [collisiondata v]) - (1)) of [collisiondata v])\nrepeat until <[] = (readVal)>\n    READ FROM || GameObjects\n    add (readVal) to [b v]\nend\nchange [playerx v] by ((item (2) of [b v]) - (item (20) of [b v]))\nchange [playery v] by ((item (3) of [b v]) - (item (21) of [b v]))\nchange [playerz v] by ((item (4) of [b v]) - (item (22) of [b v]))\n\nwhen I receive [startgame v]\nbroadcast (SetupLevel v) and wait\nbroadcast (SaveState v) and wait\nset [respawnx v] to (item (11) of [introstats v])\nset [respawny v] to (item (12) of [introstats v])\nset [respawnz v] to (item (13) of [introstats v])\nset [lightdx v] to (item (14) of [introstats v])\nset [lightdy v] to (item (15) of [introstats v])\nset [lightdz v] to (item (16) of [introstats v])\nPLAYERRESPAWN\nINIT KEYFRAMES\nreset timer\nset [oldgamestate v] to [NiL]\nset [gamestate v] to [I]\nset [_timer v] to [0]\nset volume to (((masterVolume) * (SFXVolume)) / (100)) %\nforever\n    if <not <(gameState) = (oldGameState)>> then\n        if <(gameState) = [I]> then\n            set [camx v] to (item (1) of [introstats v])\n            set [camy v] to (item (2) of [introstats v])\n            set [camz v] to (item (3) of [introstats v])\n            set [camxaxis v] to (item (4) of [introstats v])\n            set [camyaxis v] to (item (5) of [introstats v])\n            set [renderdistance v] to [10000]\n        else\n            if <(gameState) = [N]> then\n                if <not < (oldGameState) contains [M]?>> then\n                    broadcast (BlackScreen v) and wait\n                    PLAYERRESPAWN\n                    set [camxaxis v] to [-150]\n                    set [camyaxis v] to [180]\n                    set [renderdistance v] to [5000]\n                end\n            else\n                if < (gameState) contains [M]?> then\n            end\n        end\n    end\n    set [oldgamestate v] to (gameState)\n    if <(_deltaT) > [0]> then\n        change [_timer v] by ((_deltaT) / (30))\n    end\n    if <(gameState) = [I]> then\n        broadcast (ManageEntities v)\n        HANDLE PHYSICS/EVENTS\n        CAMERA MOVEMENT [0] [200] [3400] <>\n        broadcast (Render v)\n        if <(_timer) > (item (8) of [introstats v])> then\n            set [gamestate v] to [N]\n        end\n    else\n        if <(gameState) = [N]> then\n            if <(playerDead?) = [1]> then\n                broadcast (BlackScreen v) and wait\n                PLAYERRESPAWN\n            else\n                TICK\n            end\n            broadcast (Render v)\n        else\n            change [_timer v] by (() - ((_deltaT) / (30)))\n            if < (gameState) contains [M]?> then\n                set volume to (((masterVolume) * (SFXVolume)) / (100)) %\n            else\n                if <(gameState) = [W]> then\n                    stop all sounds\n                    start sound [victoryJingle v]\n                    set [_timer v] to [2]\n                    repeat until <[0] > (_timer)>\n                        change [_timer v] by (() - ((_deltaT) / (30)))\n                        broadcast (Render v)\n                        GET KEYFRAMES\n                        CAMERA MOVEMENT (playerX) (playerY) (playerZ) <not <[-500] > (playerY)>>\n                    end\n                    broadcast (BlackScreen v) and wait\n                    stop [all v]\n                end\n            end\n        end\n    end\nend\n\nset [camx v] to [2500]\nset [camy v] to [1200]\nset [camz v] to [800]\nset [camxaxis v] to [-135]\nset [camyaxis v] to [180]\nset [renderdistance v] to [10000]\nstart sound [Robot64Intro v]\nrepeat until <(timer) > [9]>\n    broadcast (ManageEntities v)\n    HANDLE PHYSICS/EVENTS\n    CAMERA MOVEMENT [0] [200] [3400] <>\n    broadcast (Render v)\nend\nbroadcast (BlackScreen v) and wait\nPLAYERRESPAWN\nset [camxaxis v] to [-150]\nset [camyaxis v] to [180]\nset [renderdistance v] to [5000]\nforever\n    if <(playerDead?) = [1]> then\n        broadcast (BlackScreen v) and wait\n        PLAYERRESPAWN\n    else\n        TICK\n    end\n    broadcast (Render v)\nend\n\ndefine TICK\nSET PHYSICS CACHE\nbroadcast (ManageEntities v)\nreset debug\nGET KEYFRAMES\ninsert time (days since 2000) label [keyframes: ]\nif <(playerY) > [-500]> then\n    PLAYER MOVEMENT\n    if <[-500] > (playerY)> then\n        start sound [fallHole v]\n    end\nelse\n    change [playerx v] by ((_deltaT) * (playerXSpd))\n    change [playery v] by ((_deltaT) * (playerYSpd))\n    change [playerz v] by ((_deltaT) * (playerZSpd))\nend\ninsert time (days since 2000) label [Player: ]\nHANDLE PHYSICS/EVENTS\ninsert time (days since 2000) label [Physics: ]\nCAMERA MOVEMENT (playerX) (playerY) (playerZ) <not <[-500] > (playerY)>>\ninsert time (days since 2000) label [Camera: ]\n\ndefine insert time (time) label (label)\nadd (join (label) (join (((time) - (oTime)) * (86400000)) [ms])) to [debug v]\nset [otime v] to (days since 2000)\n\ndefine reset debug\nset [otime v] to (days since 2000)\ndelete all of [debug v]\n\ndefine RAY-OBJ COLLIDE? || (x1) (y1) (z1) (x2) (y2) (z2) below? <b>\nset [readnum v] to [1]\nset [𝛼 v] to [Infinity]\nrepeat until <(readNum) > (length of [gameobjects v])>\n    delete all of [b v]\n    set [readval v] to [null]\n    repeat until <[] = (readVal)>\n        READ FROM || GameObjects\n        add (readVal) to [b v]\n    end\n    if < (item (1) of [b v]) contains [T]?> then\n        delete (1) of [b v]\n        RAY INTERSECT TRI? ||  (x1) (y1) (z1) , ((x2) - (x1)) ((y2) - (y1)) ((z2) - (z1)) , (item (1) of [b v]) (item (2) of [b v]) (item (3) of [b v]) , (item (4) of [b v]) (item (5) of [b v]) (item (6) of [b v]) , (item (7) of [b v]) (item (8) of [b v]) (item (9) of [b v])\n        if <[1] = (isCollide?)> then\n            if <(dist x) < (𝛼)> then\n                if <<not <b>> or <[0] < (dist x)>> then\n                    set [𝛼 v] to (dist x)\n                end\n            end\n        end\n    else\n        if < (item (1) of [b v]) contains [L]?> then\n            delete all of [cycle v]\n            delete (1) of [b v]\n            INTERNAL: closest to point (x1) [0] (z1) to line segment (item (1) of [b v]) [0] (item (3) of [b v]) , (item (4) of [b v]) [0] (item (6) of [b v])\n            set [wx v] to ((item (3) of [cycle v]) - (z1))\n            set [wz v] to ((item (1) of [cycle v]) - (x1))\n            if <(item (10) of [b v]) > ([sqrt v] of (((wx) * (wx)) + ((wz) * (wz))) )> then\n                set [𝛾 v] to (((item (1) of [cycle v]) - (item (1) of [b v])) / ((item (4) of [b v]) - (item (1) of [b v])))\n                set [dist x v] to (((y1) - ((item (2) of [b v]) + ((𝛾) * ((item (5) of [b v]) - (item (2) of [b v]))))) - ((item (10) of [b v]) / (2)))\n                if <(dist x) < (𝛼)> then\n                    if <<not <b>> or <[0] < (dist x)>> then\n                        set [𝛼 v] to (dist x)\n                    end\n                end\n            end\n        end\n    end\nend\nif <(𝛼) = [Infinity]> then\n    set [iscollide? v] to [0]\nelse\n    set [iscollide? v] to [1]\nend\nset [dist x v] to (𝛼)\n\ndefine SPINNINGPLATFORMPHYSICS\ndelete all of [b v]\nset [readval v] to [null]\nset [readnum v] to (item ((item # of [EST] in [collisiondata v]) - (1)) of [collisiondata v])\nrepeat until <[] = (readVal)>\n    READ FROM || GameObjects\n    add (readVal) to [b v]\nend\nchange [playerx v] by ((item (17) of [b v]) - (item (20) of [b v]))\nchange [playery v] by ((item (18) of [b v]) - (item (21) of [b v]))\nchange [playerz v] by ((item (19) of [b v]) - (item (22) of [b v]))\n\nbroadcast (Render v)\nerase all\ninsert time (days since 2000) label [Rendering:]\n\ndefine SET PHYSICS CACHE\nset [cross x v] to ((playerX) - (anchorX))\nset [cross y v] to ((playerY) - (anchorY))\nset [cross z v] to ((playerZ) - (anchorZ))\nset [c2 v] to ([sqrt v] of (((cross x) * (cross x)) + (((cross y) * (cross y)) + ((cross z) * (cross z)))) )\nif <(C2) > [100]> then\n    set [anchorx v] to (playerX)\n    set [anchory v] to (playerY)\n    set [anchorz v] to (playerZ)\n    delete all of [physicscache v]\n    set [readnum v] to [1]\n    repeat until <(readNum) > (length of [gameobjects v])>\n        delete all of [b v]\n        set [readval v] to [null]\n        set [𝛼 v] to (readNum)\n        repeat until <[] = (readVal)>\n            READ FROM || GameObjects\n            add (readVal) to [b v]\n        end\n        if <<(item (1) of [b v]) = [EMT]> or <(item (1) of [b v]) = [EST]>> then\n            add (𝛼) to [physicscache v]\n        end\n        if << (item (1) of [b v]) contains [T]?> or < (item (1) of [b v]) contains [P]?>> then\n            if <not <<(item (1) of [b v]) = [EMT]> or <(item (1) of [b v]) = [EST]>>> then\n                set [cross x v] to ((playerX) - (item (2) of [b v]))\n                set [cross y v] to ((playerY) - (item (3) of [b v]))\n                set [cross z v] to ((playerZ) - (item (4) of [b v]))\n                set [c2 v] to ([sqrt v] of (((cross x) * (cross x)) + (((cross y) * (cross y)) + ((cross z) * (cross z)))) )\n                if <[1000] > (C2)> then\n                    add (𝛼) to [physicscache v]\n                end\n            end\n        end\n    end\nend\n\nset [gamestate v] to [N]\n\ndefine GET SHORTEST ROTATION || (a) (b)\nif <((b) - (a)) < [180]> then\n    set [returnval1 v] to ((b) - (a))\nelse\n    set [returnval1 v] to (((b) - (a)) - (360))\nend\n\nGET SHORTEST ROTATION || [] (camYAxis)\n\n@LevelCreator\n\nwhen I receive [setuplevel v]\nset [cashmoneytest v] to [0]\nLOAD (item (level) of [levels v])\n\ndefine LOAD (data)\ndelete all of [gameobjects v]\nset [readnum v] to [1]\ndelete all of [introstats v]\nrepeat (16)\n    READ || ITEM (data)\n    add (readVal) to [introstats v]\nend\nset [c2 v] to [0]\nrepeat until <(C2) = []>\n    READ || ITEM (data)\n    if <not <(readVal) = []>> then\n        if <not <((readVal) + (0)) = (readVal)>> then\n            if <not < (readVal) contains [_]?>> then\n                add [] to [gameobjects v]\n                if < (readVal) contains [ ]?> then\n                    set [c1 v] to [1]\n                    set [c3 v] to []\n                    repeat ((length of (readVal)) - (1))\n                        change [c1 v] by (1)\n                        set [c3 v] to (join (C3) (letter (C1) of (readVal)))\n                    end\n                    set [readval v] to (C3)\n                end\n            end\n        end\n        add (readVal) to [gameobjects v]\n    end\nend\ndelete (1) of [gameobjects v]\n\ndefine READ || LETTER (letter)\nset [c2 v] to (letter (readNum) of (letter))\nchange [readnum v] by (1)\n\ndefine READ || ITEM (item)\nset [readval v] to []\nREAD || LETTER (item)\nrepeat until <<(C2) = [|]> or <<(C2) = [;]> or <<(C2) = [/]> or <(C2) = []>>>>\n    set [readval v] to (join (readVal) (C2))\n    READ || LETTER (item)\nend\n\nset [cashmoneytest v] to [0]\nset [camx v] to []\nrepeat (length of [gameobjects v])\n    change [cashmoneytest v] by (1)\n    set [camx v] to (join (camX) (join (item (cashMoneyTest) of [gameobjects v]) [|]))\nend\n\nadd [thing] to [levels v]\n\ndelete all of [gameobjects v]\nadd [PT;-300/0/300;-300/200/300;300/0/300;100/75/50] to [gameobjects v]\nadd [PT;-300/200/300;300/200/300;300/0/300;100/75/50] to [gameobjects v]\nadd [PT;100/100/100;0/0/0;0/100/100;100/75/50] to [gameobjects v]\nadd [PT;0/0/0;100/100/100;100/0/0;100/75/50] to [gameobjects v]\nadd [PT;0/0/100;100/100/100;0/100/100;100/75/50] to [gameobjects v]\nadd [PT;100/100/100;0/0/100;100/0/100;100/75/50] to [gameobjects v]\nadd [PT;-500/100/-300;-300/200/300;-300/0/300;100/75/50] to [gameobjects v]\nadd [PT;-300/0/-300;-500/100/-300;-300/0/300;100/75/50] to [gameobjects v]\nadd [PL;0/0/0;0/500/0;50/75/50;7] to [gameobjects v]\nadd [PL;-500/100/-300;0/500/0;50/75/50;7] to [gameobjects v]\nadd [PL;500/200/300;0/500/0;50/75/50;7] to [gameobjects v]\nadd [KT;-300/0/-300;300/0/-300;300/0/-400;255/0/0] to [gameobjects v]\nadd [KT;-300/0/-400;-300/0/-300;300/0/-400;255/0/0] to [gameobjects v]\nadd [BT;300/0/0;0/0/0;300/0/300;255/255/0] to [gameobjects v]\nadd [BT;0/0/0;300/0/0;300/0/-300;255/255/0] to [gameobjects v]\nadd [PT;0/0/0;0/0/300;300/0/300;100/75/50] to [gameobjects v]\nadd [PT;0/0/0;-300/0/300;0/0/300;100/75/50] to [gameobjects v]\nadd [PT;0/0/0;-300/0/0;-300/0/300;100/75/50] to [gameobjects v]\nadd [PT;0/0/0;-300/0/-300;-300/0/0;100/75/50] to [gameobjects v]\nadd [PT;0/0/0;0/0/-300;-300/0/-300;100/75/50] to [gameobjects v]\nadd [PT;0/0/0;300/0/-300;0/0/-300;100/75/50] to [gameobjects v]\nadd [PT;300/0/-400;300/0/300;300/200/300;100/75/50] to [gameobjects v]\nadd [PT;300/0/-400;300/200/300;300/200/-400;100/75/50] to [gameobjects v]\nadd [PT;-300/0/-300;-300/0/-400;-500/100/-300;100/75/50] to [gameobjects v]\nadd [PT;-300/0/-400;-300/100/-500;-500/100/-300;100/75/50] to [gameobjects v]\nadd [PT;-300/100/-500;-300/0/-400;300/0/-400;100/75/50] to [gameobjects v]\nadd [PT;300/200/-400;-300/100/-500;300/0/-400;100/75/50] to [gameobjects v]\nadd [PT;300/200/300;600/200/-400;300/200/-400;100/75/50] to [gameobjects v]\nadd [PT;600/200/-400;300/200/300;600/200/300;100/75/50] to [gameobjects v]\nadd [EMT;900/200/300;600/200/-400;600/200/300;100/75/50;900/200/300;1500/200/300;0/0/0;] to [gameobjects v]\nadd [EMT;900/200/300;900/200/-400;600/200/-400;100/75/50;900/200/300;1500/200/300;0/0/0;] to [gameobjects v]\nadd [PT;1500/200/300;1800/200/-400;1500/200/-400;100/75/50] to [gameobjects v]\nadd [PT;1800/200/-400;1500/200/300;1800/200/300;100/75/50] to [gameobjects v]\nadd [EC;800/0/-0;0/250/0;255/255/50/0/30] to [gameobjects v]\nadd [EC;1000/0/-0;0/250/0;255/255/50/0/30] to [gameobjects v]\nadd [EC;1200/0/-0;0/250/0;255/255/50/0/30] to [gameobjects v]\nadd [EC;1400/0/-0;0/250/0;255/255/50/0/30] to [gameobjects v]\n\nadd (join (item (6) of [levels v]) (item (1) of [buffer v])) to [levels v]\n\ndefine save\nset [c2 v] to [0]\nset [readval v] to []\nrepeat (length of [introstats v])\n    change [c2 v] by (1)\n    set [readval v] to (join (readVal) (join (item (C2) of [introstats v]) [/]))\nend\nset [c2 v] to [0]\nrepeat (length of [gameobjects v])\n    change [c2 v] by (1)\n    if <[] = (item (C2) of [gameobjects v])> then\n        set [readval v] to (join (readVal) [|])\n    else\n        if <<(C2) = (length of [gameobjects v])> or <[] = (item ((C2) + (1)) of [gameobjects v])>> then\n            set [readval v] to (join (readVal) (item (C2) of [gameobjects v]))\n        else\n            set [readval v] to (join (readVal) (join (item (C2) of [gameobjects v]) [/]))\n        end\n    end\nend\nset [savestate v] to (readVal)\n\nset [_deltat v] to []\n\nset [_deltat v] to (join (_deltaT) (join [|] (data)))\n\nadd (_deltaT) to [buffer v]\n\nwhen I receive [savestate v]\nsave\n\nwhen I receive [loadstate v]\nLOAD (SaveState)\n\n@EntityManagement\n\ndefine READ || ITEM (item)\nset [readval v] to (item (readNum) of [gameobjects v])\nchange [readnum v] by (1)\n\ndefine READ || LETTER (letter)\nset [c2 v] to (letter (readNum) of (letter))\n\nwhen I receive [manageentities v]\nPhysics\n\ndefine Physics\nset [readnum v] to [1]\nrepeat until <(readNum) > (length of [gameobjects v])>\n    delete all of [b v]\n    set [readval v] to [null]\n    set [c3 v] to (readNum)\n    repeat until <[] = (readVal)>\n        READ || ITEM []\n        add (readVal) to [b v]\n    end\n    delete (last) of [b v]\n    if <(letter (1) of (item (1) of [b v])) = [E]> then\n        if <(letter (2) of (item (1) of [b v])) = [P]> then\n            replace item (2) of [b v] with ((item (2) of [b v]) + ((_deltaT) * (item (5) of [b v])))\n            replace item (3) of [b v] with ((item (3) of [b v]) + ((_deltaT) * (item (6) of [b v])))\n            replace item (4) of [b v] with ((item (4) of [b v]) + ((_deltaT) * (item (7) of [b v])))\n            replace item (11) of [b v] with ((item (11) of [b v]) + ((_deltaT) * (5)))\n            replace item (12) of [b v] with ((item (12) of [b v]) + ((_deltaT) * (.5)))\n            if <(item (11) of [b v]) > [100]> then\n                delete from id (C3) x times [13]\n            else\n                resend from id (C3)\n            end\n        else\n            if <(letter (2) of (item (1) of [b v])) = [C]> then\n                if <(letter (3) of (item (1) of [b v])) = [P]> then\n                    delete all of [buffer v]\n                    add ((playerX) - (item (2) of [b v])) to [buffer v]\n                    add ((playerY) - (item (3) of [b v])) to [buffer v]\n                    add ((playerZ) - (item (4) of [b v])) to [buffer v]\n                    set [returnval1 v] to ((item (1) of [buffer v]) * (item (1) of [buffer v]))\n                    change [returnval1 v] by ((item (2) of [buffer v]) * (item (2) of [buffer v]))\n                    change [returnval1 v] by ((item (3) of [buffer v]) * (item (3) of [buffer v]))\n                    set [returnval1 v] to ([sqrt v] of (returnVal1) )\n                    if <<not (item (5) of [b v])> and <(item (7) of [b v]) > (returnVal1)>> then\n                        replace item (5) of [b v] with [1]\n                        set [respawnx v] to (item (2) of [b v])\n                        set [respawny v] to (item (3) of [b v])\n                        set [respawnz v] to (item (4) of [b v])\n                        broadcast (SaveState v)\n                        start sound [checkPoint v]\n                    end\n                    if <[1] = (item (5) of [b v])> then\n                        if <((item (3) of [b v]) + (150)) > (item (6) of [b v])> then\n                            replace item (6) of [b v] with ((item (6) of [b v]) + ((_deltaT) * (5)))\n                            resend from id (C3)\n                        end\n                    end\n                else\n                    replace item (3) of [b v] with (((20) * ([sin v] of ((90) * (timer)) )) + (item (6) of [b v]))\n                    delete all of [buffer v]\n                    add ((playerX) - (item (2) of [b v])) to [buffer v]\n                    add ((playerY) - (item (3) of [b v])) to [buffer v]\n                    add ((playerZ) - (item (4) of [b v])) to [buffer v]\n                    set [returnval1 v] to ((item (1) of [buffer v]) * (item (1) of [buffer v]))\n                    change [returnval1 v] by ((item (2) of [buffer v]) * (item (2) of [buffer v]))\n                    change [returnval1 v] by ((item (3) of [buffer v]) * (item (3) of [buffer v]))\n                    set [returnval1 v] to ([sqrt v] of (returnVal1) )\n                    if <((1.5) * (playerSize)) > (returnVal1)> then\n                        start sound [Coin v]\n                        change [cashmoneytest v] by (1)\n                        delete from id ((C3) - (1)) x times [13]\n                    else\n                        resend from id (C3)\n                    end\n                end\n            else\n                if <(letter (2) of (item (1) of [b v])) = [M]> then\n                    set [readval v] to (C3)\n                    MovingPlatformStuff\n                    set [c3 v] to (readVal)\n                    resend from id (C3)\n                else\n                    if <(letter (2) of (item (1) of [b v])) = [S]> then\n                        SpinningPlatformStuff\n                        resend from id (C3)\n                    else\n                        if <(letter (2) of (item (1) of [b v])) = [E]> then\n                            ENEMIES STUFF ID (letter (3) of (item (1) of [b v]))\n                        else\n                            if <(letter (2) of (item (1) of [b v])) = [B]> then\n                                bulletDo\n                            else\n                                if <(item (1) of [b v]) = [EIBF]> then\n                                    delete all of [buffer v]\n                                    add ((playerX) - (item (2) of [b v])) to [buffer v]\n                                    add ((playerY) - (item (3) of [b v])) to [buffer v]\n                                    add ((playerZ) - (item (4) of [b v])) to [buffer v]\n                                    set [returnval1 v] to ((item (1) of [buffer v]) * (item (1) of [buffer v]))\n                                    change [returnval1 v] by ((item (2) of [buffer v]) * (item (2) of [buffer v]))\n                                    change [returnval1 v] by ((item (3) of [buffer v]) * (item (3) of [buffer v]))\n                                    set [returnval1 v] to ([sqrt v] of (returnVal1) )\n                                    set [v0 v] to (item (8) of [b v])\n                                    if <not (item (8) of [b v])> then\n                                        replace item (8) of [b v] with (renderDistance)\n                                    end\n                                    if <(returnVal1) > (item (8) of [b v])> then\n                                        replace item (6) of [b v] with ((item (6) of [b v]) + ((_deltaT) * (((100) - (item (6) of [b v])) / (5))))\n                                    else\n                                        replace item (6) of [b v] with ((item (6) of [b v]) + ((_deltaT) * (((0) - (item (6) of [b v])) / (5))))\n                                    end\n                                    replace item (8) of [b v] with (v0)\n                                    resend from id (C3)\n                                else\n                                    delete all of [buffer v]\n                                    add ((playerX) - (item (2) of [b v])) to [buffer v]\n                                    add ((playerY) - (item (3) of [b v])) to [buffer v]\n                                    add ((playerZ) - (item (4) of [b v])) to [buffer v]\n                                    set [returnval1 v] to ((item (1) of [buffer v]) * (item (1) of [buffer v]))\n                                    change [returnval1 v] by ((item (2) of [buffer v]) * (item (2) of [buffer v]))\n                                    change [returnval1 v] by ((item (3) of [buffer v]) * (item (3) of [buffer v]))\n                                    if <[10000] > (returnVal1)> then\n                                        set [gamestate v] to [W]\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nrepeat until <not <[] = (item (last) of [gameobjects v])>>\n    delete (last) of [gameobjects v]\nend\n\ndefine Repackage\nset [c3 v] to [0]\nset [returnval1 v] to []\nrepeat ((length of [b v]) - (1))\n    change [c3 v] by (1)\n    set [returnval1 v] to (join (returnVal1) (join (item (C3) of [b v]) [/]))\nend\n\ndefine MovingPlatformStuff\ndelete all of [buffer v]\nadd ((item (14) of [b v]) - (item (17) of [b v])) to [buffer v]\nadd ((item (15) of [b v]) - (item (18) of [b v])) to [buffer v]\nadd ((item (16) of [b v]) - (item (19) of [b v])) to [buffer v]\nset [returnval1 v] to ((item (1) of [buffer v]) * (item (1) of [buffer v]))\nchange [returnval1 v] by ((item (2) of [buffer v]) * (item (2) of [buffer v]))\nchange [returnval1 v] by ((item (3) of [buffer v]) * (item (3) of [buffer v]))\nset [returnval1 v] to (([sqrt v] of (returnVal1) ) / (10))\nset [c3 v] to ((2) * ((returnVal1) + (50)))\nset [ctick v] to (((_timer) * (30)) mod (C3))\nif <(returnVal1) > (cTick)> then\n    internal. INTERPOLATE(START, END, SCALE ((cTick) / (returnVal1)) sine? \nelse\n    if <((50) + (returnVal1)) > (cTick)> then\n        internal. INTERPOLATE(START, END, SCALE [1] sine? <>\n    else\n        if <((50) + ((2) * (returnVal1))) > (cTick)> then\n            internal. INTERPOLATE(START, END, SCALE ((1) - (((cTick) - ((50) + (returnVal1))) / (returnVal1))) sine? \n        else\n            internal. INTERPOLATE(START, END, SCALE [0] sine? <>\n        end\n    end\nend\n\ndefine internal. INTERPOLATE(START, END, SCALE (v) sine? 
\nif 
 then\n    internal. INTERPOLATE(START, END, SCALE (((1) + ([cos v] of (((v) * (180)) + (180)) )) / (2)) sine? <>\nelse\n    delete all of [buffer v]\n    add ((item (5) of [b v]) - (item (2) of [b v])) to [buffer v]\n    add ((item (6) of [b v]) - (item (3) of [b v])) to [buffer v]\n    add ((item (7) of [b v]) - (item (4) of [b v])) to [buffer v]\n    add ((item (8) of [b v]) - (item (2) of [b v])) to [buffer v]\n    add ((item (9) of [b v]) - (item (3) of [b v])) to [buffer v]\n    add ((item (10) of [b v]) - (item (4) of [b v])) to [buffer v]\n    replace item (20) of [b v] with (item (2) of [b v])\n    replace item (21) of [b v] with (item (3) of [b v])\n    replace item (22) of [b v] with (item (4) of [b v])\n    replace item (2) of [b v] with ((item (14) of [b v]) + ((v) * ((item (17) of [b v]) - (item (14) of [b v]))))\n    replace item (3) of [b v] with ((item (15) of [b v]) + ((v) * ((item (18) of [b v]) - (item (15) of [b v]))))\n    replace item (4) of [b v] with ((item (16) of [b v]) + ((v) * ((item (19) of [b v]) - (item (16) of [b v]))))\n    replace item (5) of [b v] with ((item (1) of [buffer v]) + ((item (14) of [b v]) + ((v) * ((item (17) of [b v]) - (item (14) of [b v])))))\n    replace item (6) of [b v] with ((item (2) of [buffer v]) + ((item (15) of [b v]) + ((v) * ((item (18) of [b v]) - (item (15) of [b v])))))\n    replace item (7) of [b v] with ((item (3) of [buffer v]) + ((item (16) of [b v]) + ((v) * ((item (19) of [b v]) - (item (16) of [b v])))))\n    replace item (8) of [b v] with ((item (4) of [buffer v]) + ((item (14) of [b v]) + ((v) * ((item (17) of [b v]) - (item (14) of [b v])))))\n    replace item (9) of [b v] with ((item (5) of [buffer v]) + ((item (15) of [b v]) + ((v) * ((item (18) of [b v]) - (item (15) of [b v])))))\n    replace item (10) of [b v] with ((item (6) of [buffer v]) + ((item (16) of [b v]) + ((v) * ((item (19) of [b v]) - (item (16) of [b v])))))\nend\n\ndefine resend from id (id)\nset [c2 v] to (id)\nrepeat (length of [b v])\n    replace item (C2) of [gameobjects v] with (item (((C2) - (id)) + (1)) of [b v])\n    change [c2 v] by (1)\nend\n\ndefine delete from id (id) x times (t)\nrepeat (t)\n    delete (id) of [gameobjects v]\n    change [readnum v] by (-1)\nend\n\ndefine ENEMIES STUFF ID (id)\ndelete all of [buffer v]\nif <not <(item (9) of [b v]) > [0]>> then\n    if <(id) = [1]> then\n        set [c1 v] to (((item (5) of [b v]) - (playerX)) * ((item (5) of [b v]) - (playerX)))\n        change [c1 v] by (((item (6) of [b v]) - (playerY)) * ((item (6) of [b v]) - (playerY)))\n        change [c1 v] by (((item (7) of [b v]) - (playerZ)) * ((item (7) of [b v]) - (playerZ)))\n        set [c1 v] to ([sqrt v] of (C1) )\n        if <(C1) < (item (10) of [b v])> then\n            add (playerX) to [buffer v]\n            add (playerY) to [buffer v]\n            add (playerZ) to [buffer v]\n            set [c1 v] to (((item (2) of [b v]) - (item (1) of [buffer v])) * ((item (2) of [b v]) - (item (1) of [buffer v])))\n            change [c1 v] by (((item (3) of [b v]) - (item (2) of [buffer v])) * ((item (3) of [b v]) - (item (2) of [buffer v])))\n            change [c1 v] by (((item (4) of [b v]) - (item (3) of [buffer v])) * ((item (4) of [b v]) - (item (3) of [buffer v])))\n            set [c1 v] to ([sqrt v] of (C1) )\n            if <(C1) < ((40) + (playerSize))> then\n                if <[-5] > (playerYSpd)> then\n                    replace item (9) of [b v] with ((item (9) of [b v]) + (1))\n                    replace item (3) of [b v] with ((item (3) of [b v]) - (25))\n                    if <not <(playerAirtimeStatus) = [g]>> then\n                        set [playeryspd v] to [15]\n                    end\n                    start sound [Bonk v]\n                else\n                    set [playeryspd v] to [5]\n                    change [playery v] by (20)\n                    set [playerxspd v] to (((playerX) - (item (2) of [b v])) * (.25))\n                    set [playerzspd v] to (((playerZ) - (item (4) of [b v])) * (.25))\n                end\n            end\n        else\n            add (item (5) of [b v]) to [buffer v]\n            add (item (6) of [b v]) to [buffer v]\n            add (item (7) of [b v]) to [buffer v]\n        end\n        set [c1 v] to (((item (2) of [b v]) - (item (1) of [buffer v])) * ((item (2) of [b v]) - (item (1) of [buffer v])))\n        change [c1 v] by (((item (4) of [b v]) - (item (3) of [buffer v])) * ((item (4) of [b v]) - (item (3) of [buffer v])))\n        set [c1 v] to ([sqrt v] of (C1) )\n        if <[10] < (C1)> then\n            if <[0] = ((item (4) of [b v]) - (playerZ))> then\n                replace item (8) of [b v] with ((((0) + ([atan v] of (((item (2) of [b v]) - (item (1) of [buffer v])) / (0.1)) )) + (180)) mod (360))\n            else\n                replace item (8) of [b v] with (((((180) * <not <((item (4) of [b v]) - (item (3) of [buffer v])) > [0]>>) + ([atan v] of (((item (2) of [b v]) - (item (1) of [buffer v])) / ((item (4) of [b v]) - (item (3) of [buffer v]))) )) + (180)) mod (360))\n            end\n            replace item (2) of [b v] with ((item (2) of [b v]) + (((_deltaT) * (5)) * ([sin v] of (item (8) of [b v]) )))\n            replace item (4) of [b v] with ((item (4) of [b v]) + (((_deltaT) * (5)) * ([cos v] of (item (8) of [b v]) )))\n        end\n    else\n        delete all of [buffer v]\n        add (playerX) to [buffer v]\n        add (playerY) to [buffer v]\n        add (playerZ) to [buffer v]\n        set [c1 v] to (((item (2) of [b v]) - (item (1) of [buffer v])) * ((item (2) of [b v]) - (item (1) of [buffer v])))\n        change [c1 v] by (((item (3) of [b v]) - (item (2) of [buffer v])) * ((item (3) of [b v]) - (item (2) of [buffer v])))\n        change [c1 v] by (((item (4) of [b v]) - (item (3) of [buffer v])) * ((item (4) of [b v]) - (item (3) of [buffer v])))\n        set [c1 v] to ([sqrt v] of (C1) )\n        if <(item (10) of [b v]) > (C1)> then\n            replace item (8) of [b v] with (((((180) * <not <((item (4) of [b v]) - (item (3) of [buffer v])) > [0]>>) + ([atan v] of (((item (2) of [b v]) - (item (1) of [buffer v])) / ((item (4) of [b v]) - (item (3) of [buffer v]))) )) + (180)) mod (360))\n            if <(item (5) of [b v]) > [30]> then\n                replace item (5) of [b v] with [0]\n                delete all of [buffer v]\n                add ((playerX) - (item (2) of [b v])) to [buffer v]\n                add ((playerY) - (item (3) of [b v])) to [buffer v]\n                add ((playerZ) - (item (4) of [b v])) to [buffer v]\n                set [returnval1 v] to ((item (1) of [buffer v]) * (item (1) of [buffer v]))\n                change [returnval1 v] by ((item (2) of [buffer v]) * (item (2) of [buffer v]))\n                change [returnval1 v] by ((item (3) of [buffer v]) * (item (3) of [buffer v]))\n                set [returnval1 v] to ([sqrt v] of (returnVal1) )\n                set [v0 v] to ((20) * ((item (1) of [buffer v]) / (returnVal1)))\n                set [v1 v] to ((20) * ((item (2) of [buffer v]) / (returnVal1)))\n                set [v2 v] to ((20) * ((item (3) of [buffer v]) / (returnVal1)))\n                add [] to [gameobjects v]\n                add [EB] to [gameobjects v]\n                add (item (2) of [b v]) to [gameobjects v]\n                add (item (3) of [b v]) to [gameobjects v]\n                add (item (4) of [b v]) to [gameobjects v]\n                add (v0) to [gameobjects v]\n                add (v1) to [gameobjects v]\n                add (v2) to [gameobjects v]\n                add [255] to [gameobjects v]\n                add [0] to [gameobjects v]\n                add [0] to [gameobjects v]\n                add [0] to [gameobjects v]\n                start sound [Pew v]\n            end\n        end\n        if <(C1) < ((40) + (playerSize))> then\n            if <[-5] > (playerYSpd)> then\n                replace item (9) of [b v] with ((item (9) of [b v]) + (1))\n                replace item (3) of [b v] with ((item (3) of [b v]) - (25))\n                set [playeryspd v] to [15]\n                start sound [Bonk v]\n            else\n                set [playeryspd v] to [5]\n                change [playery v] by (20)\n                set [playerxspd v] to (((playerX) - (item (2) of [b v])) / (4))\n                set [playerzspd v] to (((playerZ) - (item (4) of [b v])) / (4))\n            end\n        end\n        replace item (5) of [b v] with ((item (5) of [b v]) + (_deltaT))\n    end\n    resend from id (C3)\nelse\n    replace item (9) of [b v] with ((item (9) of [b v]) + (_deltaT))\n    if <(item (9) of [b v]) > [60]> then\n        delete from id (C3) x times [11]\n    else\n        resend from id (C3)\n    end\nend\n\ndefine SpinningPlatformStuff\nreplace item (20) of [b v] with (item (17) of [b v])\nreplace item (21) of [b v] with (item (18) of [b v])\nreplace item (22) of [b v] with (item (19) of [b v])\nreplace item (2) of [b v] with ((item (2) of [b v]) - (item (17) of [b v]))\nreplace item (3) of [b v] with ((item (3) of [b v]) - (item (18) of [b v]))\nreplace item (4) of [b v] with ((item (4) of [b v]) - (item (19) of [b v]))\nreplace item (5) of [b v] with ((item (5) of [b v]) - (item (17) of [b v]))\nreplace item (6) of [b v] with ((item (6) of [b v]) - (item (18) of [b v]))\nreplace item (7) of [b v] with ((item (7) of [b v]) - (item (19) of [b v]))\nreplace item (8) of [b v] with ((item (8) of [b v]) - (item (17) of [b v]))\nreplace item (9) of [b v] with ((item (9) of [b v]) - (item (18) of [b v]))\nreplace item (10) of [b v] with ((item (10) of [b v]) - (item (19) of [b v]))\nset [rotatedx v] to ((((item (19) of [b v]) - (item (16) of [b v])) * ([sin v] of (_deltaT) )) + (((item (17) of [b v]) - (item (14) of [b v])) * ([cos v] of (_deltaT) )))\nset [rotatedz v] to ((((item (19) of [b v]) - (item (16) of [b v])) * ([cos v] of (_deltaT) )) - (((item (17) of [b v]) - (item (14) of [b v])) * ([sin v] of (_deltaT) )))\nchange [rotatedx v] by (item (14) of [b v])\nchange [rotatedz v] by (item (16) of [b v])\nreplace item (17) of [b v] with (rotatedX)\nreplace item (19) of [b v] with (rotatedZ)\nreplace item (2) of [b v] with ((item (2) of [b v]) + (item (17) of [b v]))\nreplace item (3) of [b v] with ((item (3) of [b v]) + (item (18) of [b v]))\nreplace item (4) of [b v] with ((item (4) of [b v]) + (item (19) of [b v]))\nreplace item (5) of [b v] with ((item (5) of [b v]) + (item (17) of [b v]))\nreplace item (6) of [b v] with ((item (6) of [b v]) + (item (18) of [b v]))\nreplace item (7) of [b v] with ((item (7) of [b v]) + (item (19) of [b v]))\nreplace item (8) of [b v] with ((item (8) of [b v]) + (item (17) of [b v]))\nreplace item (9) of [b v] with ((item (9) of [b v]) + (item (18) of [b v]))\nreplace item (10) of [b v] with ((item (10) of [b v]) + (item (19) of [b v]))\n\ndefine bulletDo\ndelete all of [buffer v]\nreplace item (2) of [b v] with ((item (2) of [b v]) + ((_deltaT) * (item (5) of [b v])))\nreplace item (3) of [b v] with ((item (3) of [b v]) + ((_deltaT) * (item (6) of [b v])))\nreplace item (4) of [b v] with ((item (4) of [b v]) + ((_deltaT) * (item (7) of [b v])))\nadd ((playerX) - (item (2) of [b v])) to [buffer v]\nadd ((playerY) - (item (3) of [b v])) to [buffer v]\nadd ((playerZ) - (item (4) of [b v])) to [buffer v]\nset [returnval1 v] to ((item (1) of [buffer v]) * (item (1) of [buffer v]))\nchange [returnval1 v] by ((item (2) of [buffer v]) * (item (2) of [buffer v]))\nchange [returnval1 v] by ((item (3) of [buffer v]) * (item (3) of [buffer v]))\nset [returnval1 v] to ([sqrt v] of (returnVal1) )\nif <(playerSize) > (returnVal1)> then\n    change [playery v] by (20)\n    set [playeryspd v] to [5]\n    set [playerxspd v] to (item (5) of [b v])\n    set [playerzspd v] to (item (7) of [b v])\n    delete from id (C3) x times [12]\n    stop [this script v]\nend\nreplace item (11) of [b v] with ((item (11) of [b v]) + (_deltaT))\nif <(item (11) of [b v]) > [150]> then\n    delete from id (C3) x times [12]\n    stop [this script v]\nend\nresend from id (C3)\n\nwhen I receive [startgame v]\nforever\n    set volume to (((masterVolume) * (SFXVolume)) / (100)) %\nend\n\n@FPS\n\nwhen flag clicked\nfpsInit\nforever\n    t30 (t30)\nend\n\ndefine t30 (t30)\nset [t30 v] to ((timer) * (30))\nif <((t30) - (t30)) > [2]> then\n    set [_deltat v] to [2]\nelse\n    if <[0.01] > ((t30) - (t30))> then\n        set [_deltat v] to [0.01]\n    else\n        set [_deltat v] to ((t30) - (t30))\n    end\nend\nset [fps v] to (<((30) / ((t30) - (t30))) > [0]> * (round ((30) / ((t30) - (t30)))))\n\ndefine fpsInit\ndelete all of [fps old v]\nset [_deltat v] to [1]\nset [t30 v] to ((timer) * (30))\nset [fps v] to [30]\nrepeat (60)\n    add [20] to [fps old v]\nend\n\ndefine fps.Render\nadd (FPS) to [fps old v]\ndelete (1) of [fps old v]\nif <(FPS.VISIBLE?) = [1]> then\n    set pen size to (.5)\n    set pen color to (#ff7d7d)\n    show\n    set [i1 v] to [0]\n    repeat (length of [fps old v])\n        change [i1 v] by (1)\n        go to x: ((i1) - (230)) y: (((item (i1) of [fps old v]) / (2)) + (140))\n        pen down\n        set pen (color v) to (item (i1) of [fps old v])\n    end\n    pen up\n    set [i1 v] to [0]\n    set [mean v] to [0]\n    repeat (length of [fps old v])\n        change [i1 v] by (1)\n        change [mean v] by (item (i1) of [fps old v])\n    end\n    set [mean v] to (round ((Mean) / (length of [fps old v])))\n    set y to (((Mean) / (2)) + (140))\n    set pen color to (#40cd00)\n    set pen size to (1)\n    pen down\n    set x to (-230)\n    pen up\nelse\n    hide\nend\n\nwhen I receive [fps v]\nshow\nfps.Render\ngo to [back v] layer\ngo to x: (-230) y: (140)\n\nif <not <key ((join [] [enter]) v) pressed?>> then\nelse\n    hide\nend\n\n@UI\n\nwhen flag clicked\nset [id v] to [0]\nCHECK\nswitch costume to (costume1 v)\nif <[200001] > (length of [cycle v])> then\n    hide list [turbowarp recommended v]\n    show\n    wait until <key (space v) pressed?>\nend\nshow list [turbowarp recommended v]\nswitch costume to (costume2 v)\nshow\nask [PC or Mobile? \[Changeable in settings\] \(Mobile is janky for now\)] and wait\nif <(answer) = [mobile]> then\n    set [gamecontrols v] to [MOBILE]\n    set [graphicsquality v] to [G3]\nelse\n    set [gamecontrols v] to [PC]\n    set [graphicsquality v] to [G1]\nend\nhide\nbroadcast (StartGame v)\nset [id v] to [1]\ncreate clone of (_myself_ v)\nset [id v] to [0]\nwait (3) seconds\nset [id v] to [2]\ncreate clone of (_myself_ v)\nset [id v] to [0]\n\nhide variable [backfaceculling? v]\nhide variable [editorstatus v]\n\nshow variable [backfaceculling? v]\nshow variable [editorstatus v]\n\nshow variable [backfaceculling? v]\nshow variable [editorstatus v]\n\ndefine CHECK\ndelete all of [cycle v]\nrepeat (200001)\n    add [] to [cycle v]\nend\n\nhide variable [backfaceculling? v]\nhide variable [editorstatus v]\n\nwhen I receive [blackscreen v]\nif <(ID) = [0]> then\n    go to [front v] layer\n    switch costume to (costume2 v)\n    show\n    set [ghost v] effect to (100)\n    set [ghost v] to [100]\n    repeat until <[0] > (ghost)>\n        change [ghost v] by ((-5) * (_deltaT))\n        set [ghost v] effect to (ghost)\n    end\n    set [ghost v] to [0]\n    set [id v] to [1]\n    create clone of (_myself_ v)\n    hide\n    set [id v] to [0]\nend\n\nwhen I start as a clone\nif <(ID) = [1]> then\n    show\n    switch costume to (costume2 v)\n    wait (.2) seconds\n    repeat until <(ghost) > [100]>\n        change [ghost v] by ((5) * (_deltaT))\n        set [ghost v] effect to (ghost)\n    end\n    hide\n    delete this clone\nend\n\nwhen I start as a clone\nif <(ID) = [2]> then\n    go to [front v] layer\n    switch costume to (costume3 v)\n    show\n    set [ghost v] effect to (100)\n    set [ghost v] to [100]\n    repeat until <[0] > (ghost)>\n        change [ghost v] by ((-5) * (_deltaT))\n        set [ghost v] effect to (ghost)\n    end\n    wait (5) seconds\n    repeat until <(ghost) > [100]>\n        change [ghost v] by ((5) * (_deltaT))\n        set [ghost v] effect to (ghost)\n    end\n    hide\n    delete this clone\nend\n\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\n\n@Thumbnail\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\nset [ghost v] effect to (100)\n\nset [ghost v] effect to (0)\n\n@MusicPlayer\n\nwhen I receive [startgame v]\nwait (1) seconds\nforever\n    if < [MN] contains (gameState)?> then\n        wait (1) seconds\n        play sound [Hub World v] until done\n    end\nend\n\nwhen I receive [startgame v]\nwait (10) seconds\nglide (1) secs to x: (150) y: (-150)\nwait (3) seconds\nglide (1) secs to x: (325) y: (-150)\n\nwhen I receive [startgame v]\nforever\n    change volume by (((((masterVolume) / (100)) * ((100) + ((-80) * < (gameState) contains [M]?>))) - (volume)) / (10))\nend\n\nwhen I receive [startgame v]\nset size to (50) %\ngo to x: (325) y: (-150)\nstart sound [Robot64Intro v]\nforever\n    if <(masterVolume) > [100]> then\n        set [mastervolume v] to [100]\n    end\n    if <[0] > (masterVolume)> then\n        set [mastervolume v] to [0]\n    end\n    if <(SFXVolume) > [100]> then\n        set [sfxvolume v] to [100]\n    end\n    if <[0] > (SFXVolume)> then\n        set [sfxvolume v] to [0]\n    end\nend\n\n@PauseMenu\n\nwhen I receive [startgame v]\nrepeat (1)\n    delete this clone\nend\nforever\n    if <not <(gameState) = [I]>> then\n        show\n        if <not < (gameState) contains [M]?>> then\n            switch costume to (mainbutton v)\n            go to x: (220) y: (160)\n            set size to (50) %\n            if <touching (mouse-pointer v)?> then\n                set [brightness v] effect to (20)\n                if <mouse down?> then\n                    set [gamestate v] to [M]\n                end\n            else\n                set [brightness v] effect to (0)\n            end\n        else\n            go to [front v] layer\n            switch costume to (mainoverlay v)\n            set size to (100) %\n            clear graphic effects\n            go to x: (0) y: (0)\n        end\n        SetQuality (letter (2) of (graphicsQuality))\n    else\n        hide\n    end\nend\n\nwhen I receive [setuplevel v]\nCreateClone [H]\nset [i1 v] to [0]\nrepeat (4)\n    change [i1 v] by (1)\n    CreateClone (i1)\nend\nCreateClone [S1]\nCreateClone [S2]\nCreateClone [G1]\nCreateClone [G2]\nCreateClone [G3]\nCreateClone [PC]\nCreateClone [MOBILE]\nCreateClone [B]\n\ndefine CreateClone (id)\nset [id v] to (id)\ncreate clone of (_myself_ v)\nset [id v] to []\n\nwhen I start as a clone\nset size to (100) %\nset [i1 v] to [0]\nset [i2 v] to [0]\nforever\n    if <(gameState) = [M]> then\n        if <<[4.5] > (ID)> or <(ID) = [H]>> then\n            if <(ID) = [H]> then\n                switch costume to (m v)\n            else\n                if <<[4] = (ID)> and <(i2) > [0]>> then\n                    switch costume to (quitconfirm v)\n                else\n                    switch costume to ((3) + (ID))\n                end\n            end\n            show\n            go to [front v] layer\n            go to x: (0) y: ((90) + ((-50) * (ID)))\n            if <touching (mouse-pointer v)?> then\n                set [brightness v] effect to (20)\n                if <mouse down?> then\n                    if <(i1) = [0]> then\n                        set [i1 v] to [1]\n                        MainActions (ID)\n                    end\n                else\n                    set [i1 v] to [0]\n                end\n            else\n                set [brightness v] effect to (0)\n                if <mouse down?> then\n                    set [i1 v] to [1]\n                else\n                    set [i1 v] to [0]\n                end\n            end\n        else\n            hide\n        end\n    else\n        if <(gameState) = [MS]> then\n            if <<(ID) > [4]> or <(ID) = [H]>> then\n                show\n                go to [front v] layer\n                if <(ID) = [H]> then\n                    switch costume to (ms v)\n                    go to x: (0) y: (90)\n                else\n                    Position (ID)\n                    if <touching (mouse-pointer v)?> then\n                        set [brightness v] effect to (20)\n                        if <mouse down?> then\n                            if <(i1) = [0]> then\n                                set [i1 v] to [1]\n                                MainActions (ID)\n                            end\n                        else\n                            set [i1 v] to [0]\n                        end\n                    else\n                        set [brightness v] effect to (0)\n                        if <mouse down?> then\n                            set [i1 v] to [1]\n                        else\n                            set [i1 v] to [0]\n                        end\n                    end\n                    change [brightness v] effect by ((20) * <<(ID) = (graphicsQuality)> or <(ID) = (gameControls)>>)\n                    if < (ID) contains [S]?> then\n                        switch costume to (slider v)\n                    end\n                end\n            else\n                hide\n            end\n        else\n            hide\n        end\n    end\n    change [i2 v] by ((_deltaT) / (-30))\nend\n\ndefine MainActions (id)\nif <[1] = (id)> then\n    set [gamestate v] to [N]\n    stop [this script v]\nend\nif <[2] = (id)> then\n    set [gamestate v] to [MS]\n    stop [this script v]\nend\nif <[3] = (id)> then\n    set [playerdead? v] to [1]\n    set [gamestate v] to [N]\n    stop [this script v]\nend\nif <[4] = (id)> then\n    if <(i2) > [0]> then\n        stop [all v]\n    else\n        set [i2 v] to [1]\n    end\nend\nif <[S1] = (id)> then\n    set [i1 v] to [0]\n    set [mastervolume v] to ((mouse x) / (1.2))\n    if <(masterVolume) > [100]> then\n        set [mastervolume v] to [100]\n    end\n    if <[0] > (masterVolume)> then\n        set [mastervolume v] to [0]\n    end\n    stop [this script v]\nend\nif <[S2] = (id)> then\n    set [i1 v] to [0]\n    set [sfxvolume v] to ((mouse x) / (1.2))\n    if <(SFXVolume) > [100]> then\n        set [sfxvolume v] to [100]\n    end\n    if <[0] > (SFXVolume)> then\n        set [sfxvolume v] to [0]\n    end\n    stop [this script v]\nend\nif <[B] = (id)> then\n    set [gamestate v] to [M]\n    stop [this script v]\nend\nif < (id) contains [G]?> then\n    set [graphicsquality v] to (id)\n    stop [this script v]\nend\nif <[PC] = (id)> then\n    set [gamecontrols v] to [PC]\n    stop [this script v]\nend\nif <[MOBILE] = (id)> then\n    set [gamecontrols v] to [MOBILE]\n    stop [this script v]\nend\n\ndefine Position (id)\nswitch costume to (sliderhitbox v)\nif <[S1] = (id)> then\n    set y to (60)\n    set x to ((masterVolume) * (1.2))\n    stop [this script v]\nend\nif <[S2] = (id)> then\n    set y to (30)\n    set x to ((SFXVolume) * (1.2))\n    stop [this script v]\nend\nif < (id) contains [G]?> then\n    switch costume to (id)\n    go to x: ((-40) + ((50) * (letter (2) of (id)))) y: (-20)\n    stop [this script v]\nend\nif <[PC] = (id)> then\n    switch costume to (pc v)\n    set y to (-80)\n    set x to (60)\n    stop [this script v]\nend\nif <[MOBILE] = (id)> then\n    switch costume to (mobile v)\n    set y to (-80)\n    set x to (10)\n    stop [this script v]\nend\nif <[B] = (id)> then\n    switch costume to (back v)\n    set y to (-140)\n    set x to (0)\n    stop [this script v]\nend\n\ndefine SetQuality (q)\nif <(q) = [1]> then\n    set [renderdistance v] to [5000]\n    set [renderresolution v] to [1]\nend\nif <(q) = [2]> then\n    set [renderdistance v] to [2500]\n    set [renderresolution v] to [1]\nend\nif <(q) = [3]> then\n    set [renderdistance v] to [1500]\n    set [renderresolution v] to [2]\nend\n\nforever\n    set [renderresolution v] to [2]\nend\n\n@MobileControls\n\ndefine RENDER JOYSTICK || BASE (bx) (by) SIZE (size)\ngo to x: (bx) y: (by)\nset pen color to (#000000)\nset pen (transparency v) to (75)\nset pen size to ((size) * (2))\npen down\npen up\nif <mouse down?> then\n    set [x v] to ((mouse x) - (bx))\n    set [y v] to ((mouse y) - (by))\n    set [d v] to ([sqrt v] of (((x) * (x)) + ((y) * (y))) )\n    if <(jsms) = [0]> then\n        if <(d) > ((2) * (size))> then\n            set [jsms v] to [-1]\n        else\n            set [jsms v] to [1]\n        end\n    end\n    if <(d) > (size)> then\n        set [x v] to (((x) / (d)) * (size))\n        set [y v] to (((y) / (d)) * (size))\n    end\n    if <(jsms) = [1]> then\n        go to x: ((x) + (bx)) y: ((y) + (by))\n        set [x v] to ((x) / (size))\n        set [y v] to ((y) / (size))\n    else\n        set [x v] to [0]\n        set [y v] to [0]\n    end\nelse\n    set [jsms v] to [0]\n    set [x v] to [0]\n    set [y v] to [0]\nend\nset pen size to ((size) / (1.5))\npen down\npen up\n\nwhen I receive [render v]\nif <(gameControls) = [MOBILE]> then\n    RENDER JUMP BUTTON || BASE [180] [-120]\n    RENDER LEAP BUTTON || BASE [200] [-30]\n    RENDER STOMP BUTTON || BASE [-200] [-30]\n    if (item (5) of [keyframes v]) then\n        RENDER JOYSTICK || BASE [180] [-120] SIZE [50]\n    else\n        RENDER JOYSTICK || BASE [-180] [-120] SIZE [50]\n    end\n    if <([sqrt v] of (((x) * (x)) + ((y) * (y))) ) > [0]> then\n        replace item (1) of [keyframes v] with ((item (1) of [keyframes v]) + (1))\n    else\n        replace item (1) of [keyframes v] with [0]\n    end\nend\n\nif <(y) > [.25]> then\n    replace item (1) of [keyframes v] with ((item (1) of [keyframes v]) + (1))\nelse\n    replace item (1) of [keyframes v] with [0]\nend\nif <(y) < [-.25]> then\n    replace item (2) of [keyframes v] with ((item (2) of [keyframes v]) + (1))\nelse\n    replace item (2) of [keyframes v] with [0]\nend\nif <(x) > [.25]> then\n    replace item (3) of [keyframes v] with ((item (3) of [keyframes v]) + (1))\nelse\n    replace item (3) of [keyframes v] with [0]\nend\nif <(x) < [-.25]> then\n    replace item (4) of [keyframes v] with ((item (4) of [keyframes v]) + (1))\nelse\n    replace item (4) of [keyframes v] with [0]\nend\n\ndefine RENDER JUMP BUTTON || BASE (bx) (by)\ngo to x: (bx) y: (by)\nif (item (5) of [keyframes v]) then\n    switch costume to (jumpclear v)\nelse\n    switch costume to (jump v)\nend\nif <mouse down?> then\n    if <(jms) = [0]> then\n        if <touching (mouse-pointer v)?> then\n            set [jms v] to [1]\n        else\n            set [jms v] to [-1]\n        end\n    end\nelse\n    set [jms v] to [0]\nend\nif <(jms) = [1]> then\n    replace item (5) of [keyframes v] with ((item (5) of [keyframes v]) + (1))\nelse\n    replace item (5) of [keyframes v] with [0]\nend\nset size to (100) %\nstamp\n\ndefine RENDER LEAP BUTTON || BASE (bx) (by)\nset size to (100) %\ngo to x: (bx) y: (by)\nswitch costume to (leap v)\nif <<touching (mouse-pointer v)?> and <mouse down?>> then\n    replace item (6) of [keyframes v] with ((item (6) of [keyframes v]) + (1))\n    set [brightness v] effect to (20)\nelse\n    replace item (6) of [keyframes v] with [0]\nend\nstamp\nclear graphic effects\n\ndefine RENDER STOMP BUTTON || BASE (bx) (by)\nset size to (100) %\ngo to x: (bx) y: (by)\nswitch costume to (stomp v)\nif <<touching (mouse-pointer v)?> and <mouse down?>> then\n    replace item (7) of [keyframes v] with ((item (7) of [keyframes v]) + (1))\n    set [brightness v] effect to (20)\nelse\n    replace item (7) of [keyframes v] with [0]\nend\nstamp\nclear graphic effects\n\nreplace item (10) of [keyframes v] with (x)\n\nreplace item (11) of [keyframes v] with [0]\n\nreplace item (10) of [keyframes v] with [0]\n\nreplace item (11) of [keyframes v] with (() - (x))\n\n