Full 3D platformer engine v1.21
@Stage\n\n@Sprite1\n\n@RENDERER\n\ndefine 3D tri fill (x1) (y1) (z1) (x2) (y2) (z2) (x3) (y3) (z3) res (res)\ndo 3D stuff with (x2) (y2) (z2)\nset [#x2 v] to (#x)\nset [#y2 v] to (#y)\nset [#z2 v] to (#z)\ndo 3D stuff with (x3) (y3) (z3)\nset [#x3 v] to (#x)\nset [#y3 v] to (#y)\nset [#z3 v] to (#z)\ndo 3D stuff with (x1) (y1) (z1)\nif <(#z) < (_nearPlane)> then\n    set [#z v] to (_nearPlane)\nend\nif <(#z2) < (_nearPlane)> then\n    set [#z2 v] to (_nearPlane)\nend\nif <(#z3) < (_nearPlane)> then\n    set [#z3 v] to (_nearPlane)\nend\nif <<(#z) > (_nearPlane)> or <<(#z2) > (_nearPlane)> or <(#z3) > (_nearPlane)>>> then\n    2D Tri Fill (((#x) * (_FOV)) / (#z)) (((#y) * (_FOV)) / (#z)) (((#x2) * (_FOV)) / (#z2)) (((#y2) * (_FOV)) / (#z2)) (((#x3) * (_FOV)) / (#z3)) (((#y3) * (_FOV)) / (#z3)) (res)\nend\n\ndefine Tic\nPlMovement\nsort\nrender\nAdd level\n\nwhen flag clicked\nSinCosList\nbig\nreset\ndelete all of [ccoins v]\nforever\n    set [/deltatime v] to ((timer) - (/oldtme))\n    set [/oldtme v] to (timer)\n    set [fps v] to (round ((1) / (/deltatime)))\n    if <(FPS) < [14]> then\n        set [/deltatime v] to ((1) / (14))\n    end\n    broadcast (tic v) and wait\nend\n\ndefine render\nitemsOfEach\nerase all\nset [@counter v] to [0]\nrepeat (length of [compileddata v])\n    change [@counter v] by (1)\n    decode string (item (@counter) of [compileddata v])\n    if <(length of [decodeddata v]) = [11]> then\n        set pen color to (item (11) of [decodeddata v])\n        3D tri fill (item (1) of [decodeddata v]) (item (2) of [decodeddata v]) (item (3) of [decodeddata v]) (item (4) of [decodeddata v]) (item (5) of [decodeddata v]) (item (6) of [decodeddata v]) (item (7) of [decodeddata v]) (item (8) of [decodeddata v]) (item (9) of [decodeddata v]) res ((3) - ((1) * <is compiled?>))\n    else\n        if <(length of [decodeddata v]) = [4]> then\n            if <(item (item (4) of [decodeddata v]) of [ccoins v]) = [0]> then\n                render coin at (item (1) of [decodeddata v]) (item (2) of [decodeddata v]) (item (3) of [decodeddata v])\n            end\n        else\n            if <(length of [decodeddata v]) = [6]> then\n                renderBox at (item (1) of [decodeddata v]) (item (2) of [decodeddata v]) (item (3) of [decodeddata v]) color (item (4) of [decodeddata v]) size (item (5) of [decodeddata v]) res [3]\n            else\n                if <(length of [decodeddata v]) = [8]> then\n                    renderLine at (item (1) of [decodeddata v]) (item (2) of [decodeddata v]) (item (3) of [decodeddata v]) (item (4) of [decodeddata v]) (item (5) of [decodeddata v]) (item (6) of [decodeddata v]) r ((item (7) of [decodeddata v]) * (1.35)) color (item (8) of [decodeddata v]) time [2]\n                    renderLine at (item (1) of [decodeddata v]) (item (2) of [decodeddata v]) (item (3) of [decodeddata v]) (item (4) of [decodeddata v]) (item (5) of [decodeddata v]) (item (6) of [decodeddata v]) r (item (7) of [decodeddata v]) color (item (8) of [decodeddata v]) time [1]\n                end\n            end\n        end\n    end\nend\n\ndefine Add level\nset [coincounter v] to [0]\ndelete all of [slotedhexa v]\ndelete all of [compileddata v]\ndelete all of [slotedtris v]\ndelete all of [slotedcoins v]\ndelete all of [slotedlines v]\ndelete all of [movingplatformschange v]\ndelete all of [distancedata v]\ndelete all of [collisionindex v]\nadd [0] to [collisionindex v]\nadd [0] to [collisionindex v]\nadd [0] to [collisionindex v]\nPlAdd\n_add hexa at [-50] [-50] [-50] to [50] [-50] [50] color [#38d906] mode [1]\n_add hexa at [-100] [-50] [50] to [100] [-50] [150] color [#ca6506] mode [1]\n_add tri [-100] [-50] [150] [-100] [0] [250] [100] [0] [250] mode [1] color [#00b1cc] <>\n_add tri [-100] [-50] [150] [100] [-50] [150] [100] [0] [250] mode [1] color [#00b1cc] <>\n_add hexa at [-200] [-50] [50] to [-100] [0] [150] color [#cca200] mode [1]\n_add tri [-100] [0] [250] [100] [0] [250] [100] [0] [350] mode [1] color [#b000a3] <>\n_add tri [-100] [0] [250] [-100] [0] [350] [100] [0] [350] mode [1] color [#b000a3] <>\n_add spike [0] [-50] [100] height [40] color [#d40000]\n_add spike [-20] [-50] [100] height [20] color [#d40000]\n_add spike [20] [-50] [100] height [20] color [#d40000]\n_add coin [-150] [50] [100]\n_add hexa at [-50] [-100] [-150] to [50] [-50] [-50] color [#fbff00] mode [3]\n_add line from [0] [-5] [350] to [0] [30] [450] radius [20] color [#5e2500] mode [1]\n_add line from [-50] [-5] [350] to [-50] [30] [450] radius [20] color [#5e2500] mode [1]\n_add line from [50] [-5] [350] to [50] [30] [450] radius [20] color [#5e2500] mode [1]\n_add tri [-100] [35] [450] [100] [35] [450] [0] [35] [550] mode [1] color [#9a6b18] <>\n_add coin [0] [100] [500]\n_add moving tri [-200] [0] [50] [-200] [0] [150] [-300] [0] [100] moves [-100] [0] [0] speed [0.5] color [#cca200] mode [1]\n\ndefine _add tri (x1) (y1) (z1) (x2) (y2) (z2) (x3) (y3) (z3) mode (m) color (#) <collide?>\nreplace item (1) of [collisionindex v] with (<not <collide?>> + (item (1) of [collisionindex v]))\nadd (join (x1) (join [/] (join (y1) (join [/] (join (z1) (join [/] (join (x2) (join [/] (join (y2) (join [/] (join (z2) (join [/] (join (x3) (join [/] (join (y3) (join [/] (join (z3) (join [/] (join (m) (join [/] (#))))))))))))))))))))) to [compileddata v]\nif <(m) = [0]> then\n    set [_dist1 v] to (round ((((x1) - (_ScrollX)) * ((x1) - (_ScrollX))) + (((((y1) + (playerYoffset)) - (_ScrollY)) * (((y1) + (playerYoffset)) - (_ScrollY))) + (((z1) - (_ScrollZ)) * ((z1) - (_ScrollZ))))))\n    set [_dist2 v] to (round ((((x2) - (_ScrollX)) * ((x2) - (_ScrollX))) + (((((y2) + (playerYoffset)) - (_ScrollY)) * (((y2) + (playerYoffset)) - (_ScrollY))) + (((z2) - (_ScrollZ)) * ((z2) - (_ScrollZ))))))\n    set [_dist3 v] to (round ((((x3) - (_ScrollX)) * ((x3) - (_ScrollX))) + (((((y3) + (playerYoffset)) - (_ScrollY)) * (((y3) + (playerYoffset)) - (_ScrollY))) + (((z3) - (_ScrollZ)) * ((z3) - (_ScrollZ))))))\nelse\n    set [_dist1 v] to (round ((((x1) - (_ScrollX)) * ((x1) - (_ScrollX))) + (((((y1) + (item (m) of [modes high v])) - (_ScrollY)) * (((y1) + (item (m) of [modes high v])) - (_ScrollY))) + (((z1) - (_ScrollZ)) * ((z1) - (_ScrollZ))))))\n    set [_dist2 v] to (round ((((x2) - (_ScrollX)) * ((x2) - (_ScrollX))) + (((((y2) + (item (m) of [modes high v])) - (_ScrollY)) * (((y2) + (item (m) of [modes high v])) - (_ScrollY))) + (((z2) - (_ScrollZ)) * ((z2) - (_ScrollZ))))))\n    set [_dist3 v] to (round ((((x3) - (_ScrollX)) * ((x3) - (_ScrollX))) + (((((y3) + (item (m) of [modes high v])) - (_ScrollY)) * (((y2) + (item (m) of [modes high v])) - (_ScrollY))) + (((z3) - (_ScrollZ)) * ((z3) - (_ScrollZ))))))\nend\nadd (round (((_Dist1) + ((_Dist2) + (_Dist3))) / (3))) to [distancedata v]\nif <not <collide?>> then\n    if <not <<<(z1) > ((_PlayerZ) + (25))> and <(z2) > ((_PlayerZ) + (25))>> and <(z3) > ((_PlayerZ) + (25))>>> then\n        if <not <<<((_PlayerZ) + (-25)) > (z1)> and <((_PlayerZ) + (-25)) > (z2)>> and <((_PlayerZ) + (-25)) > (z3)>>> then\n            if <not <<<(x1) > ((_PlayerX) + (25))> and <(x2) > ((_PlayerX) + (25))>> and <(x3) > ((_PlayerX) + (25))>>> then\n                if <not <<<((_PlayerX) + (-25)) > (x1)> and <((_PlayerX) + (-25)) > (x2)>> and <((_PlayerX) + (-25)) > (x3)>>> then\n                    if <<((_PlayerY) + (100)) > (y1)> or <<((_PlayerY) + (100)) > (y2)> or <((_PlayerY) + (100)) > (y3)>>> then\n                        add (x1) to [slotedtris v]\n                        add (y1) to [slotedtris v]\n                        add (z1) to [slotedtris v]\n                        add (x2) to [slotedtris v]\n                        add (y2) to [slotedtris v]\n                        add (z2) to [slotedtris v]\n                        add (x3) to [slotedtris v]\n                        add (y3) to [slotedtris v]\n                        add (z3) to [slotedtris v]\n                        add (m) to [slotedtris v]\n                        add (#) to [slotedtris v]\n                        if <<(y1) = (y2)> and <(y2) = (y3)>> then\n                            add [1] to [slotedtris v]\n                        else\n                            add [0] to [slotedtris v]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine decode string (string)\ndelete all of [decodeddata v]\nadd [] to [decodeddata v]\nset [@counter2 v] to [0]\nrepeat (length of (string))\n    change [@counter2 v] by (1)\n    if <(letter (@counter2) of (string)) = [/]> then\n        add [] to [decodeddata v]\n    else\n        replace item (length of [decodeddata v]) of [decodeddata v] with (join (item (length of [decodeddata v]) of [decodeddata v]) (letter (@counter2) of (string)))\n    end\nend\n\ndefine reset\nreset timer\nset [/deltatime v] to [0.03]\nset [/oldtme v] to [0]\nset [_rotx v] to [-25]\nset [_roty v] to [0]\nset [_playerx v] to [0]\nset [_playery v] to [0]\nset [_playerz v] to [0]\nset [_scrollx v] to [0]\nset [_scrolly v] to [0]\nset [_scrollz v] to [-100]\nset [_fov v] to [300]\nset [_nearplane v] to [1]\nset [_playeryvel v] to [0]\nset [_dir v] to [0]\nset [_objectivedir v] to [0]\nset [\(\)playerspeed v] to [150]\nset [\(\)rotatespeed v] to [100]\nset [\(\)gravity v] to [700]\nset [playeryoffset v] to [130]\n\ndefine sort\nset [@counter v] to (length of [distancedata v])\nrepeat (length of [distancedata v])\n    set [@counter2 v] to [0]\n    set [@counter3 v] to [1]\n    repeat (@counter)\n        change [@counter2 v] by (1)\n        if <(item (@counter2) of [distancedata v]) < (item (@counter3) of [distancedata v])> then\n            set [@counter3 v] to (@counter2)\n        end\n    end\n    replaceSorting\n    change [@counter v] by (-1)\nend\n\ndefine replaceSorting\nset [@counter2 v] to (item (@counter3) of [distancedata v])\nreplace item (@counter3) of [distancedata v] with (item (@counter) of [distancedata v])\nreplace item (@counter) of [distancedata v] with (@counter2)\nset [@counter2 v] to (item (@counter3) of [compileddata v])\nreplace item (@counter3) of [compileddata v] with (item (@counter) of [compileddata v])\nreplace item (@counter) of [compileddata v] with (@counter2)\n\ndefine Sin & Cos\nset [=xsin v] to (item ((((_RotX) - (1)) mod (360)) + (1)) of [/sin v])\nset [=xcos v] to (item ((((_RotX) - (1)) mod (360)) + (1)) of [/cos v])\nset [=ysin v] to (item ((((_RotY) - (1)) mod (360)) + (1)) of [/sin v])\nset [=ycos v] to (item ((((_RotY) - (1)) mod (360)) + (1)) of [/cos v])\n\ndefine PlMovement\nchange [_rotx v] by ((0) * (<key (up arrow v) pressed?> - <key (down arrow v) pressed?>))\nchange [_roty v] by (((\(\)rotateSpeed) * (/deltatime)) * (<key (left arrow v) pressed?> - <key (right arrow v) pressed?>))\nset [_roty v] to (round (_RotY))\nif <(_RotX) > [0]> then\n    set [_rotx v] to [0]\nend\nif <[-90] > (_RotX)> then\n    set [_rotx v] to [-90]\nend\nSin & Cos\nset [_scrollx v] to ((_PlayerX) + ((300) * ((=Ysin) * (=Xcos))))\nset [_scrolly v] to ((_PlayerY) + ((-300) * (=Xsin)))\nset [_scrollz v] to ((_PlayerZ) + ((-300) * ((=Ycos) * (=Xcos))))\nPlChange pos (((0) - ((\(\)playerSpeed) * (/deltatime))) * ((=Ysin) * (<key (w v) pressed?> - <key (s v) pressed?>))) (((\(\)playerSpeed) * (/deltatime)) * ((=Ycos) * (<key (w v) pressed?> - <key (s v) pressed?>)))\nPlChange pos (((0) - ((\(\)playerSpeed) * (/deltatime))) * ((=Ycos) * (<key (a v) pressed?> - <key (d v) pressed?>))) (((0) - ((\(\)playerSpeed) * (/deltatime))) * ((=Ysin) * (<key (a v) pressed?> - <key (d v) pressed?>)))\nchange [_playeryvel v] by ((0) - ((\(\)gravity) * (/deltatime)))\nchange [_playery v] by ((_PlayerYVel) * (/deltatime))\nset [_playery v] to (round (_PlayerY))\nPlCollision? <> moving <>\nif <[collisions v] contains [1]?> then\n    repeat until <not <[collisions v] contains [1]?>>\n        if <(_PlayerYVel) > [0]> then\n            change [_playery v] by (-1)\n        else\n            change [_playery v] by (1)\n        end\n        PlCollision?  moving <>\n    end\n    set [_playeryvel v] to [0]\n    change [_playery v] by (-3)\n    PlCollision? <> moving <>\n    if <<[collisions v] contains [1]?> and <key (space v) pressed?>> then\n        set [_playeryvel v] to [400]\n    end\n    change [_playery v] by (3)\nend\nPl Move with moving platforms\nPlCollision? <> moving <>\nif <[collisions v] contains [2]?> then\n    reset\nend\nif <[collisions v] contains [3]?> then\n    set [_playeryvel v] to [525]\nend\nobjDir\nset [_dir v] to (() - (_RotY))\n\ndefine PlChange pos (x) (z)\nchange [_playerx v] by (round (x))\nPlCollision? <> moving <>\nif <[collisions v] contains [1]?> then\n    repeat (8)\n        if <[collisions v] contains [1]?> then\n            change [_playery v] by (1)\n        end\n        PlCollision?  moving <>\n    end\n    if <[collisions v] contains [1]?> then\n        change [_playery v] by (-8)\n        change [_playerx v] by ((0) - (round (x)))\n    end\nend\nchange [_playerz v] by (round (z))\nPlCollision? <> moving <>\nif <[collisions v] contains [1]?> then\n    repeat (8)\n        if <[collisions v] contains [1]?> then\n            change [_playery v] by (1)\n        end\n        PlCollision?  moving <>\n    end\n    if <[collisions v] contains [1]?> then\n        change [_playery v] by (-8)\n        change [_playerz v] by ((0) - (round (z)))\n    end\nend\ncoins?\n\ndefine PlCollision? <all?> moving <m>\nset [collisionindex v] to [0]\ndelete all of [collisions v]\nif <not <all?>> then\n    delete all of [collisions# v]\nend\nif <all?> then\n    set [@counter2 v] to [0]\n    repeat (length of [collisions# v])\n        change [@counter2 v] by (1)\n        set [@counter v] to (item (@counter2) of [collisions# v])\n        set [collisionindex v] to ((@counter) / (12))\n        if <not <(@counter) > (length of [slotedtris v])>> then\n            if <(item ((@counter) - (0)) of [slotedtris v]) = [1]> then\n                if <(item ((@counter) - (10)) of [slotedtris v]) < ((_PlayerY) + (-20))> then\n                    # Collision - Sphere pos: (_PlayerX) ((_PlayerY) + (-20)) (_PlayerZ) radius [15] Triangle (item ((@counter) - (11)) of [slotedtris v]) (item ((@counter) - (10)) of [slotedtris v]) (item ((@counter) - (9)) of [slotedtris v]) . (item ((@counter) - (8)) of [slotedtris v]) (item ((@counter) - (7)) of [slotedtris v]) (item ((@counter) - (6)) of [slotedtris v]) . (item ((@counter) - (5)) of [slotedtris v]) (item ((@counter) - (4)) of [slotedtris v]) (item ((@counter) - (3)) of [slotedtris v])\n                else\n                    if <((_PlayerY) + (20)) < (item ((@counter) - (10)) of [slotedtris v])> then\n                        # Collision - Sphere pos: (_PlayerX) ((_PlayerY) + (20)) (_PlayerZ) radius [15] Triangle (item ((@counter) - (11)) of [slotedtris v]) (item ((@counter) - (10)) of [slotedtris v]) (item ((@counter) - (9)) of [slotedtris v]) . (item ((@counter) - (8)) of [slotedtris v]) (item ((@counter) - (7)) of [slotedtris v]) (item ((@counter) - (6)) of [slotedtris v]) . (item ((@counter) - (5)) of [slotedtris v]) (item ((@counter) - (4)) of [slotedtris v]) (item ((@counter) - (3)) of [slotedtris v])\n                    else\n                        # Collision - Sphere pos: (_PlayerX) (item ((@counter) - (10)) of [slotedtris v]) (_PlayerZ) radius [15] Triangle (item ((@counter) - (11)) of [slotedtris v]) (item ((@counter) - (10)) of [slotedtris v]) (item ((@counter) - (9)) of [slotedtris v]) . (item ((@counter) - (8)) of [slotedtris v]) (item ((@counter) - (7)) of [slotedtris v]) (item ((@counter) - (6)) of [slotedtris v]) . (item ((@counter) - (5)) of [slotedtris v]) (item ((@counter) - (4)) of [slotedtris v]) (item ((@counter) - (3)) of [slotedtris v])\n                    end\n                end\n                if <(~collisionResult) = [1]> then\n                end\n            else\n                # Collision - Sphere pos: (_PlayerX) ((_PlayerY) + (-20)) (_PlayerZ) radius [15] Triangle (item ((@counter) - (11)) of [slotedtris v]) (item ((@counter) - (10)) of [slotedtris v]) (item ((@counter) - (9)) of [slotedtris v]) . (item ((@counter) - (8)) of [slotedtris v]) (item ((@counter) - (7)) of [slotedtris v]) (item ((@counter) - (6)) of [slotedtris v]) . (item ((@counter) - (5)) of [slotedtris v]) (item ((@counter) - (4)) of [slotedtris v]) (item ((@counter) - (3)) of [slotedtris v])\n                if <(~collisionResult) = [1]> then\n                else\n                    # Collision - Sphere pos: (_PlayerX) (_PlayerY) (_PlayerZ) radius [15] Triangle (item ((@counter) - (11)) of [slotedtris v]) (item ((@counter) - (10)) of [slotedtris v]) (item ((@counter) - (9)) of [slotedtris v]) . (item ((@counter) - (8)) of [slotedtris v]) (item ((@counter) - (7)) of [slotedtris v]) (item ((@counter) - (6)) of [slotedtris v]) . (item ((@counter) - (5)) of [slotedtris v]) (item ((@counter) - (4)) of [slotedtris v]) (item ((@counter) - (3)) of [slotedtris v])\n                    if <(~collisionResult) = [1]> then\n                    else\n                        # Collision - Sphere pos: (_PlayerX) ((_PlayerY) + (20)) (_PlayerZ) radius [15] Triangle (item ((@counter) - (11)) of [slotedtris v]) (item ((@counter) - (10)) of [slotedtris v]) (item ((@counter) - (9)) of [slotedtris v]) . (item ((@counter) - (8)) of [slotedtris v]) (item ((@counter) - (7)) of [slotedtris v]) (item ((@counter) - (6)) of [slotedtris v]) . (item ((@counter) - (5)) of [slotedtris v]) (item ((@counter) - (4)) of [slotedtris v]) (item ((@counter) - (3)) of [slotedtris v])\n                    end\n                end\n            end\n        end\n        if <(~collisionResult) = [0]> then\n            delete (@counter2) of [collisions# v]\n            change [@counter2 v] by (1)\n        else\n            if <not <m>> then\n                add ([abs v] of (item ((@counter) - (2)) of [slotedtris v]) ) to [collisions v]\n            else\n                add (item ((@counter) - (2)) of [slotedtris v]) to [collisions v]\n            end\n            add (@counter) to [collisionindex v]\n        end\n    end\nelse\n    set [@counter v] to [0]\n    repeat ((length of [slotedtris v]) / (12))\n        change [@counter v] by (12)\n        change [collisionindex v] by (1)\n        if <not <(@counter) > (length of [slotedtris v])>> then\n            if <not <[collisions v] contains (item ((@counter) - (2)) of [slotedtris v])?>> then\n                if <(item ((@counter) - (0)) of [slotedtris v]) = [1]> then\n                    if <(item ((@counter) - (10)) of [slotedtris v]) < ((_PlayerY) + (-20))> then\n                        # Collision - Sphere pos: (_PlayerX) ((_PlayerY) + (-20)) (_PlayerZ) radius [15] Triangle (item ((@counter) - (11)) of [slotedtris v]) (item ((@counter) - (10)) of [slotedtris v]) (item ((@counter) - (9)) of [slotedtris v]) . (item ((@counter) - (8)) of [slotedtris v]) (item ((@counter) - (7)) of [slotedtris v]) (item ((@counter) - (6)) of [slotedtris v]) . (item ((@counter) - (5)) of [slotedtris v]) (item ((@counter) - (4)) of [slotedtris v]) (item ((@counter) - (3)) of [slotedtris v])\n                    else\n                        if <((_PlayerY) + (20)) < (item ((@counter) - (10)) of [slotedtris v])> then\n                            # Collision - Sphere pos: (_PlayerX) ((_PlayerY) + (20)) (_PlayerZ) radius [15] Triangle (item ((@counter) - (11)) of [slotedtris v]) (item ((@counter) - (10)) of [slotedtris v]) (item ((@counter) - (9)) of [slotedtris v]) . (item ((@counter) - (8)) of [slotedtris v]) (item ((@counter) - (7)) of [slotedtris v]) (item ((@counter) - (6)) of [slotedtris v]) . (item ((@counter) - (5)) of [slotedtris v]) (item ((@counter) - (4)) of [slotedtris v]) (item ((@counter) - (3)) of [slotedtris v])\n                        else\n                            # Collision - Sphere pos: (_PlayerX) (item ((@counter) - (10)) of [slotedtris v]) (_PlayerZ) radius [15] Triangle (item ((@counter) - (11)) of [slotedtris v]) (item ((@counter) - (10)) of [slotedtris v]) (item ((@counter) - (9)) of [slotedtris v]) . (item ((@counter) - (8)) of [slotedtris v]) (item ((@counter) - (7)) of [slotedtris v]) (item ((@counter) - (6)) of [slotedtris v]) . (item ((@counter) - (5)) of [slotedtris v]) (item ((@counter) - (4)) of [slotedtris v]) (item ((@counter) - (3)) of [slotedtris v])\n                        end\n                    end\n                    if <(~collisionResult) = [1]> then\n                    end\n                else\n                    # Collision - Sphere pos: (_PlayerX) ((_PlayerY) + (-20)) (_PlayerZ) radius [15] Triangle (item ((@counter) - (11)) of [slotedtris v]) (item ((@counter) - (10)) of [slotedtris v]) (item ((@counter) - (9)) of [slotedtris v]) . (item ((@counter) - (8)) of [slotedtris v]) (item ((@counter) - (7)) of [slotedtris v]) (item ((@counter) - (6)) of [slotedtris v]) . (item ((@counter) - (5)) of [slotedtris v]) (item ((@counter) - (4)) of [slotedtris v]) (item ((@counter) - (3)) of [slotedtris v])\n                    if <(~collisionResult) = [1]> then\n                    else\n                        # Collision - Sphere pos: (_PlayerX) (_PlayerY) (_PlayerZ) radius [15] Triangle (item ((@counter) - (11)) of [slotedtris v]) (item ((@counter) - (10)) of [slotedtris v]) (item ((@counter) - (9)) of [slotedtris v]) . (item ((@counter) - (8)) of [slotedtris v]) (item ((@counter) - (7)) of [slotedtris v]) (item ((@counter) - (6)) of [slotedtris v]) . (item ((@counter) - (5)) of [slotedtris v]) (item ((@counter) - (4)) of [slotedtris v]) (item ((@counter) - (3)) of [slotedtris v])\n                        if <(~collisionResult) = [1]> then\n                        else\n                            # Collision - Sphere pos: (_PlayerX) ((_PlayerY) + (20)) (_PlayerZ) radius [15] Triangle (item ((@counter) - (11)) of [slotedtris v]) (item ((@counter) - (10)) of [slotedtris v]) (item ((@counter) - (9)) of [slotedtris v]) . (item ((@counter) - (8)) of [slotedtris v]) (item ((@counter) - (7)) of [slotedtris v]) (item ((@counter) - (6)) of [slotedtris v]) . (item ((@counter) - (5)) of [slotedtris v]) (item ((@counter) - (4)) of [slotedtris v]) (item ((@counter) - (3)) of [slotedtris v])\n                        end\n                    end\n                end\n            end\n        end\n        if <(~collisionResult) = [1]> then\n            add (@counter) to [collisions# v]\n            if <not <m>> then\n                add ([abs v] of (item ((@counter) - (2)) of [slotedtris v]) ) to [collisions v]\n                Find index type [1] Index ((@counter) / (12))\n            else\n                add (item ((@counter) - (2)) of [slotedtris v]) to [collisions v]\n            end\n        end\n    end\nend\nset [boxcounter v] to [0]\nrepeat ((length of [slotedhexa v]) / (7))\n    change [boxcounter v] by (7)\n    Pl hexa collision? (item ((BoxCounter) - (6)) of [slotedhexa v]) (item ((BoxCounter) - (5)) of [slotedhexa v]) (item ((BoxCounter) - (4)) of [slotedhexa v]) (item ((BoxCounter) - (3)) of [slotedhexa v]) (item ((BoxCounter) - (2)) of [slotedhexa v]) (item ((BoxCounter) - (1)) of [slotedhexa v]) player (_PlayerX) (_PlayerY) (_PlayerZ) r [15] h [20]\n    if <(@collision?) = [1]> then\n        if <not <m>> then\n            add ([abs v] of (item (BoxCounter) of [slotedhexa v]) ) to [collisions v]\n            Find index type [3] Index ((BoxCounter) / (7))\n        else\n            add (item (BoxCounter) of [slotedhexa v]) to [collisions v]\n        end\n    end\nend\nset [boxcounter v] to [0]\nrepeat ((length of [slotedlines v]) / (8))\n    change [boxcounter v] by (8)\n    Pl line collision (item ((BoxCounter) - (7)) of [slotedlines v]) (item ((BoxCounter) - (6)) of [slotedlines v]) (item ((BoxCounter) - (5)) of [slotedlines v]) (item ((BoxCounter) - (4)) of [slotedlines v]) (item ((BoxCounter) - (3)) of [slotedlines v]) (item ((BoxCounter) - (2)) of [slotedlines v]) r (item ((BoxCounter) - (1)) of [slotedlines v]) sphere (_PlayerX) ((_PlayerY) - (20)) (_PlayerZ) r [15]\n    if <(@collision?) = [1]> then\n        if <not <m>> then\n            add ([abs v] of (item (BoxCounter) of [slotedlines v]) ) to [collisions v]\n            Find index type [2] Index ((BoxCounter) / (8))\n        else\n            add (item (BoxCounter) of [slotedlines v]) to [collisions v]\n        end\n    else\n    end\nend\n\ndefine PlAdd\ndelete all of [plsc v]\nadd (item ((((_Dir) - (1)) mod (360)) + (1)) of [/sin v]) to [plsc v]\nadd (item ((((_Dir) - (-119)) mod (360)) + (1)) of [/sin v]) to [plsc v]\nadd (item ((((_Dir) - (121)) mod (360)) + (1)) of [/sin v]) to [plsc v]\nadd (item ((((_Dir) - (1)) mod (360)) + (1)) of [/cos v]) to [plsc v]\nadd (item ((((_Dir) - (-119)) mod (360)) + (1)) of [/cos v]) to [plsc v]\nadd (item ((((_Dir) - (121)) mod (360)) + (1)) of [/cos v]) to [plsc v]\nadd player tri [1] [15] [-35] [2] [15] [-35] [3] [15] [-35] color [#198e9f] pl (_PlayerX) (_PlayerY) (_PlayerZ)\nadd player tri [1] [15] [-35] [2] [15] [-35] [3] [0] [8] color [#198e9f] pl (_PlayerX) (_PlayerY) (_PlayerZ)\nadd player tri [1] [15] [-35] [2] [0] [8] [3] [15] [-35] color [#198e9f] pl (_PlayerX) (_PlayerY) (_PlayerZ)\nadd player tri [1] [0] [8] [2] [15] [-35] [3] [15] [-35] color [#198e9f] pl (_PlayerX) (_PlayerY) (_PlayerZ)\nadd player tri [1] [0] [8] [2] [8] [21] [3] [8] [21] color [#18ce4e] pl (_PlayerX) (_PlayerY) (_PlayerZ)\nadd player tri [1] [0] [35] [2] [8] [21] [3] [8] [21] color [#18ce4e] pl (_PlayerX) (_PlayerY) (_PlayerZ)\nadd player tri [2] [0] [35] [1] [8] [21] [2] [8] [21] color [#18ce4e] pl (_PlayerX) (_PlayerY) (_PlayerZ)\nadd player tri [2] [0] [8] [1] [8] [21] [2] [8] [21] color [#18ce4e] pl (_PlayerX) (_PlayerY) (_PlayerZ)\nadd player tri [3] [0] [8] [3] [8] [21] [1] [8] [21] color [#18ce4e] pl (_PlayerX) (_PlayerY) (_PlayerZ)\nadd player tri [3] [0] [35] [3] [8] [21] [1] [8] [21] color [#18ce4e] pl (_PlayerX) (_PlayerY) (_PlayerZ)\n\ndefine add player tri (º1) (d1) (y1) (º2) (d2) (y2) (º3) (d3) (y3) color (#) pl (x) (y) (z)\n_add tri (round ((x) + ((item (º1) of [plsc v]) * (d1)))) (round ((y) + (y1))) (round ((z) + ((item ((º1) + (3)) of [plsc v]) * (d1)))) (round ((x) + ((item (º2) of [plsc v]) * (d2)))) (round ((y) + (y2))) (round ((z) + ((item ((º2) + (3)) of [plsc v]) * (d2)))) (round ((x) + ((item (º3) of [plsc v]) * (d3)))) (round ((y) + (y3))) (round ((z) + ((item ((º3) + (3)) of [plsc v]) * (d3)))) mode [0] color (#) \n\ndefine _add spike (x) (y) (z) height (h) color (#)\n_add tri ((x) - (10)) (y) ((z) - (10)) ((x) + (10)) (y) ((z) - (10)) (x) ((y) + (h)) (z) mode [2] color (#) <>\n_add tri ((x) + (10)) (y) ((z) + (10)) ((x) + (10)) (y) ((z) - (10)) (x) ((y) + (h)) (z) mode [2] color (#) <>\n_add tri ((x) + (10)) (y) ((z) + (10)) ((x) - (10)) (y) ((z) + (10)) (x) ((y) + (h)) (z) mode [2] color (#) <>\n_add tri ((x) - (10)) (y) ((z) - (10)) ((x) - (10)) (y) ((z) + (10)) (x) ((y) + (h)) (z) mode [2] color (#) <>\n\ndefine render coin at (x) (y) (z)\ndo 3D stuff with (x) (y) (z)\nif <(#z) > [0.3]> then\n    go to x: (((#x) / (#z)) * (_FOV)) y: (((#y) / (#z)) * (_FOV))\n    set [coin1 v] to (round (((((0) - (_RotY)) mod (180)) / (5)) mod (36)))\n    if <(length of (coin1)) = [1]> then\n        switch costume to (join [50] (coin1))\n    else\n        switch costume to (join [5] (coin1))\n    end\n    set size to ((100) / (([sqrt v] of ((((x) - (_ScrollX)) * ((x) - (_ScrollX))) + ((((y) - (_ScrollY)) * ((y) - (_ScrollY))) + (((z) - (_ScrollZ)) * ((z) - (_ScrollZ))))) ) / (35))) %\n    stamp\n    big\nend\n\ndefine _add coin (x) (y) (z)\nchange [coincounter v] by (1)\nif <(CoinCounter) > (length of [ccoins v])> then\n    add [0] to [ccoins v]\nend\nadd ((((x) - (_ScrollX)) * ((x) - (_ScrollX))) + ((((y) - (_ScrollY)) * ((y) - (_ScrollY))) + (((z) - (_ScrollZ)) * ((z) - (_ScrollZ))))) to [distancedata v]\nadd (join (x) (join [/] (join (y) (join [/] (join (z) (join [/] (CoinCounter))))))) to [compileddata v]\nadd (x) to [slotedcoins v]\nadd (y) to [slotedcoins v]\nadd (z) to [slotedcoins v]\n\ndefine big\nswitch costume to (dot v)\nset size to ([10 ^ v] of (999) ) %\nswitch costume to (big v)\n\ndefine sphere to sphere collision (x) (y) (z) 2 (x2) (y2) (z2) r (r1) (r2)\nset [@collision? v] to [0]\nif <((((x2) - (x)) * ((x2) - (x))) + ((((y2) - (y)) * ((y2) - (y))) + (((z2) - (z)) * ((z2) - (z))))) < (((r1) + (r2)) * ((r1) + (r2)))> then\n    set [@collision? v] to [1]\nend\n\ndefine coins?\nset [@counter v] to [0]\nrepeat ((length of [slotedcoins v]) / (3))\n    change [@counter v] by (3)\n    if <((((_PlayerZ) - (item (@counter) of [slotedcoins v])) * ((_PlayerZ) - (item (@counter) of [slotedcoins v]))) + ((((_PlayerY) - (item ((@counter) - (1)) of [slotedcoins v])) * ((_PlayerY) - (item ((@counter) - (1)) of [slotedcoins v]))) + (((_PlayerX) - (item ((@counter) - (2)) of [slotedcoins v])) * ((_PlayerX) - (item ((@counter) - (2)) of [slotedcoins v]))))) < [3600]> then\n        sphere to sphere collision (item ((@counter) - (2)) of [slotedcoins v]) (item ((@counter) - (1)) of [slotedcoins v]) (item (@counter) of [slotedcoins v]) 2 (_PlayerX) (_PlayerY) (_PlayerZ) r [15] [15]\n        if <(@collision?) = [0]> then\n            sphere to sphere collision (item ((@counter) - (2)) of [slotedcoins v]) (item ((@counter) - (1)) of [slotedcoins v]) (item (@counter) of [slotedcoins v]) 2 (_PlayerX) ((_PlayerY) - (20)) (_PlayerZ) r [15] [15]\n            if <(@collision?) = [0]> then\n                sphere to sphere collision (item ((@counter) - (2)) of [slotedcoins v]) (item ((@counter) - (1)) of [slotedcoins v]) (item (@counter) of [slotedcoins v]) 2 (_PlayerX) ((_PlayerY) - (-20)) (_PlayerZ) r [15] [15]\n            end\n        end\n        if <(@collision?) = [1]> then\n            replace item ((@counter) / (3)) of [ccoins v] with [1]\n        end\n    end\nend\n\ndefine SinCosList\ndelete all of [/cos v]\ndelete all of [/sin v]\nset [@counter v] to [0]\nrepeat (360)\n    add ([sin v] of (@counter) ) to [/sin v]\n    add ([cos v] of (@counter) ) to [/cos v]\n    change [@counter v] by (1)\nend\n\nset [fps v] to ((round (((1) / (/deltatime)) * (100))) / (100))\n\nwhen I receive [tic v]\nTic\n\ndefine objDir\nif <key (w v) pressed?> then\n    if <key (s v) pressed?> then\n        if <key (a v) pressed?> then\n            if <key (d v) pressed?> then\n        else\n            if <key (d v) pressed?> then\n                set [_objectivedir v] to [90]\n            end\n        end\n    else\n        if <key (a v) pressed?> then\n            if <key (d v) pressed?> then\n                set [_objectivedir v] to [0]\n            else\n                set [_objectivedir v] to [-45]\n            end\n        else\n            if <key (d v) pressed?> then\n                set [_objectivedir v] to [45]\n            else\n                set [_objectivedir v] to [0]\n            end\n        end\n    end\nelse\n    if <key (s v) pressed?> then\n        if <key (a v) pressed?> then\n            if <key (d v) pressed?> then\n                set [_objectivedir v] to [180]\n            else\n                set [_objectivedir v] to [-135]\n            end\n        else\n            if <key (d v) pressed?> then\n                set [_objectivedir v] to [135]\n            else\n                set [_objectivedir v] to [180]\n            end\n        end\n    else\n        if <key (a v) pressed?> then\n            if <key (d v) pressed?> then\n        else\n            if <key (d v) pressed?> then\n                set [_objectivedir v] to [90]\n            end\n        end\n    end\nend\n\nif <([abs v] of (((_ObjectiveDir) - (_Dir)) mod (360)) ) > [3]> then\n    if <(((_ObjectiveDir) - (_Dir)) mod (360)) < (((180) + (_RotY)) mod (360))> then\n        change [_dir v] by (3)\n    else\n        change [_dir v] by (-3)\n    end\nend\nset [_dir v] to (() - ((_RotY) + (_ObjectiveDir)))\n\ndefine renderBox at (x) (y) (z) color (#) size (s) res (r)\nset pen color to (#)\nif <(_ScrollX) > ((x) + ((s) / (2)))> then\n    3D tri fill ((x) + ((s) / (2))) ((y) + ((s) / (2))) ((z) + ((s) / (-2))) ((x) + ((s) / (2))) ((y) + ((s) / (2))) ((z) + ((s) / (2))) ((x) + ((s) / (2))) ((y) + ((s) / (-2))) ((z) + ((s) / (2))) res (r)\n    3D tri fill ((x) + ((s) / (2))) ((y) + ((s) / (2))) ((z) + ((s) / (-2))) ((x) + ((s) / (2))) ((y) + ((s) / (-2))) ((z) + ((s) / (-2))) ((x) + ((s) / (2))) ((y) + ((s) / (-2))) ((z) + ((s) / (2))) res (r)\nelse\n    if <((x) + ((s) / (-2))) > (_ScrollX)> then\n        3D tri fill ((x) + ((s) / (-2))) ((y) + ((s) / (2))) ((z) + ((s) / (-2))) ((x) + ((s) / (-2))) ((y) + ((s) / (2))) ((z) + ((s) / (2))) ((x) + ((s) / (-2))) ((y) + ((s) / (-2))) ((z) + ((s) / (2))) res (r)\n        3D tri fill ((x) + ((s) / (-2))) ((y) + ((s) / (2))) ((z) + ((s) / (-2))) ((x) + ((s) / (-2))) ((y) + ((s) / (-2))) ((z) + ((s) / (-2))) ((x) + ((s) / (-2))) ((y) + ((s) / (-2))) ((z) + ((s) / (2))) res (r)\n    end\nend\nif <(_ScrollZ) > ((z) + ((s) / (2)))> then\n    3D tri fill ((x) + ((s) / (-2))) ((y) + ((s) / (-2))) ((z) + ((s) / (2))) ((x) + ((s) / (-2))) ((y) + ((s) / (2))) ((z) + ((s) / (2))) ((x) + ((s) / (2))) ((y) + ((s) / (2))) ((z) + ((s) / (2))) res (r)\n    3D tri fill ((x) + ((s) / (-2))) ((y) + ((s) / (-2))) ((z) + ((s) / (2))) ((x) + ((s) / (2))) ((y) + ((s) / (-2))) ((z) + ((s) / (2))) ((x) + ((s) / (2))) ((y) + ((s) / (2))) ((z) + ((s) / (2))) res (r)\nelse\n    if <((z) + ((s) / (-2))) > (_ScrollZ)> then\n        3D tri fill ((x) + ((s) / (-2))) ((y) + ((s) / (-2))) ((z) + ((s) / (-2))) ((x) + ((s) / (-2))) ((y) + ((s) / (2))) ((z) + ((s) / (-2))) ((x) + ((s) / (2))) ((y) + ((s) / (2))) ((z) + ((s) / (-2))) res (r)\n        3D tri fill ((x) + ((s) / (-2))) ((y) + ((s) / (-2))) ((z) + ((s) / (-2))) ((x) + ((s) / (2))) ((y) + ((s) / (-2))) ((z) + ((s) / (-2))) ((x) + ((s) / (2))) ((y) + ((s) / (2))) ((z) + ((s) / (-2))) res (r)\n    end\nend\nif <(_ScrollY) > ((y) + ((s) / (2)))> then\n    3D tri fill ((x) + ((s) / (2))) ((y) + ((s) / (2))) ((z) + ((s) / (2))) ((x) + ((s) / (2))) ((y) + ((s) / (2))) ((z) + ((s) / (-2))) ((x) + ((s) / (-2))) ((y) + ((s) / (2))) ((z) + ((s) / (-2))) res (r)\n    3D tri fill ((x) + ((s) / (2))) ((y) + ((s) / (2))) ((z) + ((s) / (2))) ((x) + ((s) / (-2))) ((y) + ((s) / (2))) ((z) + ((s) / (2))) ((x) + ((s) / (-2))) ((y) + ((s) / (2))) ((z) + ((s) / (-2))) res (r)\nelse\n    if <((y) + ((s) / (-2))) > (_ScrollY)> then\n        3D tri fill ((x) + ((s) / (2))) ((y) + ((s) / (-2))) ((z) + ((s) / (2))) ((x) + ((s) / (2))) ((y) + ((s) / (-2))) ((z) + ((s) / (-2))) ((x) + ((s) / (-2))) ((y) + ((s) / (-2))) ((z) + ((s) / (-2))) res (r)\n        3D tri fill ((x) + ((s) / (2))) ((y) + ((s) / (-2))) ((z) + ((s) / (2))) ((x) + ((s) / (-2))) ((y) + ((s) / (-2))) ((z) + ((s) / (2))) ((x) + ((s) / (-2))) ((y) + ((s) / (-2))) ((z) + ((s) / (-2))) res (r)\n    end\nend\n\ndefine Pl box collision? (x) (y) (z) size (s) player (x2) (y2) (z2) radius (r) h (h)\n\ndefine _add hexa at (x1) (y1) (z1) to (x2) (y2) (z2) color (#) mode (m)\nreplace item (2) of [collisionindex v] with ((1) + (item (2) of [collisionindex v]))\nadd (x1) to [slotedhexa v]\nadd (y1) to [slotedhexa v]\nadd (z1) to [slotedhexa v]\nadd (x2) to [slotedhexa v]\nadd (y2) to [slotedhexa v]\nadd (z2) to [slotedhexa v]\nadd (m) to [slotedhexa v]\nif <not <(y1) = (y2)>> then\n    if <(_ScrollY) > (y2)> then\n        _add tri (x1) (y2) (z1) (x1) (y2) (z2) (x2) (y2) (z2) mode [1] color (#) \n        _add tri (x1) (y2) (z1) (x2) (y2) (z1) (x2) (y2) (z2) mode [1] color (#) \n    else\n        if <(y1) > (_ScrollY)> then\n            _add tri (x1) (y1) (z1) (x1) (y1) (z2) (x2) (y1) (z2) mode [1] color (#) \n            _add tri (x1) (y1) (z1) (x2) (y1) (z1) (x2) (y1) (z2) mode [1] color (#) \n        end\n    end\n    if <(_ScrollZ) > (z2)> then\n        _add tri (x1) (y1) (z2) (x1) (y2) (z2) (x2) (y2) (z2) mode [1] color (#) \n        _add tri (x1) (y1) (z2) (x2) (y1) (z2) (x2) (y2) (z2) mode [1] color (#) \n    else\n        if <(z1) > (_ScrollZ)> then\n            _add tri (x1) (y1) (z1) (x1) (y2) (z1) (x2) (y2) (z1) mode [1] color (#) \n            _add tri (x1) (y1) (z1) (x2) (y1) (z1) (x2) (y2) (z1) mode [1] color (#) \n        end\n    end\n    if <(_ScrollX) > (x2)> then\n        _add tri (x2) (y1) (z1) (x2) (y1) (z2) (x2) (y2) (z2) mode [1] color (#) \n        _add tri (x2) (y1) (z1) (x2) (y2) (z1) (x2) (y2) (z2) mode [1] color (#) \n    else\n        if <(x1) > (_ScrollX)> then\n            _add tri (x1) (y1) (z1) (x1) (y1) (z2) (x1) (y2) (z2) mode [1] color (#) \n            _add tri (x1) (y1) (z1) (x1) (y2) (z1) (x1) (y2) (z2) mode [1] color (#) \n        end\n    end\nelse\n    if <(_ScrollY) > (y2)> then\n        _add tri (x1) (y2) (z1) (x1) (y2) (z2) (x2) (y2) (z2) mode [1] color (#) \n        _add tri (x1) (y2) (z1) (x2) (y2) (z1) (x2) (y2) (z2) mode [1] color (#) \n    else\n        if <(y1) > (_ScrollY)> then\n            _add tri (x1) (y1) (z1) (x1) (y1) (z2) (x2) (y1) (z2) mode [1] color (#) \n            _add tri (x1) (y1) (z1) (x2) (y1) (z1) (x2) (y1) (z2) mode [1] color (#) \n        end\n    end\nend\n\ndefine Pl hexa collision? (x1) (y1) (z1) (x2) (y2) (z2) player (x) (y) (z) r (r) h (h)\nset [cdotx v] to (x)\nset [cdoty v] to (y)\nset [cdotz v] to (z)\nif <(cdotx) > (x2)> then\n    set [cdotx v] to (x2)\nelse\n    if <(x1) > (cdotx)> then\n        set [cdotx v] to (x1)\n    end\nend\nif <(cdotz) > (z2)> then\n    set [cdotz v] to (z2)\nelse\n    if <(z1) > (cdotz)> then\n        set [cdotz v] to (z1)\n    end\nend\nif <(cdoty) > (y2)> then\n    set [cdoty v] to (y2)\nelse\n    if <(y1) > (cdoty)> then\n        set [cdoty v] to (y1)\n    end\nend\nset [cmyy v] to (cdoty)\nif <((y) - (h)) > (cmyY)> then\n    set [cmyy v] to ((y) - (h))\nelse\n    if <(cmyY) > ((y) + (h))> then\n        set [cmyy v] to ((y) + (h))\n    end\nend\nif <((((z) - (cdotz)) * ((z) - (cdotz))) + ((((cmyY) - (cdoty)) * ((cmyY) - (cdoty))) + (((x) - (cdotx)) * ((x) - (cdotx))))) < ((r) * (r))> then\n    set [@collision? v] to [1]\nelse\n    set [@collision? v] to [0]\nend\n\ndefine _add line from (x1) (y1) (z1) to (x2) (y2) (z2) radius (r) color (#) mode (m)\nreplace item (3) of [collisionindex v] with ((1) + (item (3) of [collisionindex v]))\nif <not <<(z1) > ((_PlayerZ) + ((30) + (r)))> and <(z2) > ((_PlayerZ) + ((30) + (r)))>>> then\n    add (x1) to [slotedlines v]\n    add (y1) to [slotedlines v]\n    add (z1) to [slotedlines v]\n    add (x2) to [slotedlines v]\n    add (y2) to [slotedlines v]\n    add (z2) to [slotedlines v]\n    add (r) to [slotedlines v]\n    add (m) to [slotedlines v]\nend\nset [_dist1 v] to [0]\nadd ((((((z1) + (z2)) / (2)) - (_ScrollZ)) * ((((z1) + (z2)) / (2)) - (_ScrollZ))) + ((((((y1) + (y2)) / (2)) - (_ScrollY)) * ((((y1) + (y2)) / (2)) - (_ScrollY))) + (((((x1) + (x2)) / (2)) - (_ScrollX)) * ((((x1) + (x2)) / (2)) - (_ScrollX))))) to [distancedata v]\nadd (join (x1) (join [/] (join (y1) (join [/] (join (z1) (join [/] (join (x2) (join [/] (join (y2) (join [/] (join (z2) (join [/] (join (r) (join [/] (#))))))))))))))) to [compileddata v]\n\ndefine renderLine at (x1) (y1) (z1) (x2) (y2) (z2) r (r) color (#) time (x)\npen up\nset pen color to (#)\nif <(x) = [2]> then\n    change pen (brightness v) by (-10)\nend\ndo 3D stuff with (x2) (y2) (z2)\nset [#x2 v] to (#x)\nset [#y2 v] to (#y)\nset [#z2 v] to (#z)\ndo 3D stuff with (x1) (y1) (z1)\nset [_dist1 v] to ([sqrt v] of ((((x1) - (_ScrollX)) * ((x1) - (_ScrollX))) + ((((y1) - (_ScrollY)) * ((y1) - (_ScrollY))) + (((z1) - (_ScrollZ)) * ((z1) - (_ScrollZ))))) )\nset [_dist2 v] to ([sqrt v] of ((((x2) - (_ScrollX)) * ((x2) - (_ScrollX))) + ((((y2) - (_ScrollY)) * ((y2) - (_ScrollY))) + (((z2) - (_ScrollZ)) * ((z2) - (_ScrollZ))))) )\nif <not <<(#z) < [0.3]> and <(#z2) < [0.3]>>> then\n    if <(#z) < [0.3]> then\n        set [#z v] to [0.3]\n    end\n    if <(#z2) < [0.3]> then\n        set [#z2 v] to [0.3]\n    end\n    set [#x v] to (((#x) / (#z)) * (_FOV))\n    set [#y v] to (((#y) / (#z)) * (_FOV))\n    set [#x2 v] to (((#x2) / (#z2)) * (_FOV))\n    set [#y2 v] to (((#y2) / (#z2)) * (_FOV))\n    go to x: (#x) y: (#y)\n    set pen size to (((r) / (_Dist1)) * (_FOV))\n    pen down\n    pen up\n    go to x: (#x2) y: (#y2)\n    set pen size to (((r) / (_Dist2)) * (_FOV))\n    pen down\n    pen up\n    #Get Direction ((#x2) - (#x)) ((#y2) - (#y))\n    if <(_Dist2) > (_Dist1)> then\n        set pen size to (((r) / (_Dist1)) * (_FOV))\n        set [@get direction v] to ((0) - (@Get Direction))\n        2d line ((#x) + (item ((((round ((@Get Direction) + (90))) - (1)) mod (360)) + (1)) of [/sin v])) ((#y) + (item ((((round ((@Get Direction) + (90))) - (1)) mod (360)) + (1)) of [/cos v])) to (#x2) (#y2)\n        2d line ((#x) + (item ((((round ((@Get Direction) + (-90))) - (1)) mod (360)) + (1)) of [/sin v])) ((#y) + (item ((((round ((@Get Direction) + (-90))) - (1)) mod (360)) + (1)) of [/cos v])) to (#x2) (#y2)\n    else\n        if <(_Dist1) > (_Dist2)> then\n            set pen size to (((r) / (_Dist2)) * (_FOV))\n            2d line ((#x2) + (item ((((round ((@Get Direction) + (90))) - (1)) mod (360)) + (1)) of [/sin v])) ((#y2) + (item ((((round ((@Get Direction) + (90))) - (1)) mod (360)) + (1)) of [/cos v])) to (#x) (#y)\n            2d line ((#x2) + (item ((((round ((@Get Direction) + (-90))) - (1)) mod (360)) + (1)) of [/sin v])) ((#y2) + (item ((((round ((@Get Direction) + (-90))) - (1)) mod (360)) + (1)) of [/cos v])) to (#x) (#y)\n        end\n    end\nend\n\ndefine Pl line collision (x1) (y1) (z1) (x2) (y2) (z2) r (r2) sphere (x) (y) (z) r (r)\n# Closest Point To Line Segment p: (x) (y) (z) Line: (x1) (y1) (z1) | (x2) (y2) (z2)\nset [@collision? v] to <((((z) - (Col: ~returnZ)) * ((z) - (Col: ~returnZ))) + ((((y) - (Col: ~returnY)) * ((y) - (Col: ~returnY))) + (((x) - (Col: ~returnX)) * ((x) - (Col: ~returnX))))) < (((r) + (r2)) * ((r) + (r2)))>\n\ndefine 2d line (x1) (y1) to (x2) (y2)\npen up\ngo to x: (x1) y: (y1)\npen down\ngo to x: (x2) y: (y2)\npen up\n\ndefine _add moving tri (x1) (y1) (z1) (x2) (y2) (z2) (x3) (y3) (z3) moves (x) (y) (z) speed (s) color (c) mode (m)\nset [@counter3 v] to ([abs v] of ((((timer) * (s)) mod (2)) - (1)) )\n_add tri ((x1) + ((x) * (@counter3))) ((y1) + ((y) * (@counter3))) ((z1) + ((z) * (@counter3))) ((x2) + ((x) * (@counter3))) ((y2) + ((y) * (@counter3))) ((z2) + ((z) * (@counter3))) ((x3) + ((x) * (@counter3))) ((y3) + ((y) * (@counter3))) ((z3) + ((z) * (@counter3))) mode ((0) - (m)) color (c) <>\nmoving (x) (y) (z) this (@counter3) last ([abs v] of (((((timer) - (/deltatime)) * (s)) mod (2)) - (1)) ) index (join [1] (item (1) of [collisionindex v]))\n\ndefine moving (x) (y) (z) this (t) last (l) index (i)\nadd (((x) * (t)) - ((x) * (l))) to [movingplatformschange v]\nadd (((y) * (t)) - ((y) * (l))) to [movingplatformschange v]\nadd (((z) * (t)) - ((z) * (l))) to [movingplatformschange v]\nadd (i) to [movingplatformschange v]\n\ndefine itemsOfEach\ndelete all of [itemsofeach v]\nadd [0] to [itemsofeach v]\nadd [0] to [itemsofeach v]\nadd [0] to [itemsofeach v]\n\ndefine find moving collider Index (type) i (i)\n\ndefine Find index type (m) Index (i)\nset [collisionindex v] to ((item # of (join (m) (i)) in [/cos v]) / (4))\n\ndefine Pl Move with moving platforms\nchange [_playery v] by (-3)\nPlCollision? <> moving \nchange [_playery v] by (3)\nif <[collisions v] contains [-1]?> then\n    PlChange pos (item (((CollisionIndex) * (4)) - (3)) of [movingplatformschange v]) (item (((CollisionIndex) * (4)) - (2)) of [movingplatformschange v])\n    change [_playery v] by (item (((CollisionIndex) * (4)) - (1)) of [movingplatformschange v])\n    PlCollision? <> moving <>\n    if <[collisions v] contains [1]?> then\n        repeat until <not <[collisions v] contains [1]?>>\n            if <(item (((CollisionIndex) * (4)) - (1)) of [movingplatformschange v]) > [0]> then\n                change [_playery v] by (-1)\n            else\n                change [_playery v] by (1)\n            end\n            PlCollision? <> moving <>\n        end\n    end\nend\n\ndefine _add moving line (x1) (y1) (z1) (x2) (y2) (z2) r (r) speed (s) change (x) (y) (z) color (c) mode (m)\nset [@counter3 v] to ([abs v] of ((((timer) * (s)) mod (2)) - (1)) )\n_add line from ((x1) + ((x) * (@counter3))) ((y1) + ((y) * (@counter3))) ((z1) + ((z) * (@counter3))) to ((x2) + ((x) * (@counter3))) ((y2) + ((y) * (@counter3))) ((z2) + ((z) * (@counter3))) radius (r) color (c) mode ((0) - (m))\nmoving (x) (y) (z) this (@counter3) last ([abs v] of (((((timer) - (/deltatime)) * (s)) mod (2)) - (1)) ) index (join [2] (item (2) of [collisionindex v]))\n\ndefine #Get Direction (dx) (dy)\nif <(dy) = [0]> then\n    if <(dx) > [0]> then\n        set [@get direction v] to [90]\n    else\n        set [@get direction v] to [-90]\n    end\nelse\n    set [@get direction v] to ([atan v] of ((dx) / (dy)) )\n    if <(dy) < [0]> then\n        if <(dx) > [0]> then\n            change [@get direction v] by (180)\n        else\n            if <(dx) < [0]> then\n                change [@get direction v] by (-180)\n            else\n                set [@get direction v] to [180]\n            end\n        end\n    end\nend\n\ndefine # Get Max and Min (a) (b) (c)\nif <(a) > (b)> then\n    if <(b) > (c)> then\n        set [~max v] to (a)\n        set [~min v] to (c)\n    else\n        set [~min v] to (b)\n        if <(a) > (c)> then\n            set [~max v] to (a)\n        else\n            set [~max v] to (c)\n        end\n    end\nelse\n    if <(a) > (c)> then\n        set [~max v] to (b)\n        set [~min v] to (c)\n    else\n        set [~min v] to (a)\n        if <(b) > (c)> then\n            set [~max v] to (b)\n        else\n            set [~max v] to (c)\n        end\n    end\nend\n\ndefine # Closest Point To Line Segment p: (px) (py) (pz) Line: (x1) (y1) (z1) | (x2) (y2) (z2)\nset [col: ~vx v] to ((x2) - (x1))\nset [col: ~vy v] to ((y2) - (y1))\nset [col: ~vz v] to ((z2) - (z1))\nset [col: ~t v] to (((((px) - (x1)) * (Col: ~vx)) + ((((py) - (y1)) * (Col: ~vy)) + (((pz) - (z1)) * (Col: ~vz)))) / (((Col: ~vx) * (Col: ~vx)) + (((Col: ~vy) * (Col: ~vy)) + ((Col: ~vz) * (Col: ~vz)))))\nif <(Col: ~T) > [1]> then\n    set [col: ~t v] to [1]\nend\nif <(Col: ~T) < [0]> then\n    set [col: ~t v] to [0]\nend\nset [col: ~returnx v] to ((x1) + ((Col: ~vx) * (Col: ~T)))\nset [col: ~returny v] to ((y1) + ((Col: ~vy) * (Col: ~T)))\nset [col: ~returnz v] to ((z1) + ((Col: ~vz) * (Col: ~T)))\n\ndefine # Get Plain Data with (x1) (y1) (z1) . (x2) (y2) (z2) . (x3) (y3) (z3)\nset [col: plain function a v] to ((((z3) - (z1)) * ((y2) - (y1))) - (((y3) - (y1)) * ((z2) - (z1))))\nset [col: plain function b v] to ((((x3) - (x1)) * ((z2) - (z1))) - (((z3) - (z1)) * ((x2) - (x1))))\nset [col: plain function c v] to ((((y3) - (y1)) * ((x2) - (x1))) - (((x3) - (x1)) * ((y2) - (y1))))\nif <not <(Col: plain function B) < [0]>> then\n    set [col: plain function a v] to (() - (Col: plain function A))\n    set [col: plain function b v] to (() - (Col: plain function B))\n    set [col: plain function c v] to (() - (Col: plain function C))\nend\nset [col: plain function d v] to ([sqrt v] of (((Col: plain function A) * (Col: plain function A)) + (((Col: plain function B) * (Col: plain function B)) + ((Col: plain function C) * (Col: plain function C)))) )\nset [col: plain function a v] to ((Col: plain function A) / (Col: plain function D))\nset [col: plain function b v] to ((Col: plain function B) / (Col: plain function D))\nset [col: plain function c v] to ((Col: plain function C) / (Col: plain function D))\nset [col: plain function d v] to (((Col: plain function A) * (x1)) + (((Col: plain function B) * (y1)) + ((Col: plain function C) * (z1))))\n\ndefine # Precise Collision Sphere (x) (y) (z) radius (r) To triangle (x1) (y1) (z1) . (x2) (y2) (z2) . (x3) (y3) (z3)\nset [col: ~tempx v] to ((x) - ((Col: plain function A) * (Col: ~dot)))\nset [col: ~tempy v] to ((y) - ((Col: plain function B) * (Col: ~dot)))\nset [col: ~tempz v] to ((z) - ((Col: plain function C) * (Col: ~dot)))\nset [col: ~ax v] to ((x1) - (Col: ~tempX))\nset [col: ~ay v] to ((y1) - (Col: ~tempY))\nset [col: ~az v] to ((z1) - (Col: ~tempZ))\nset [col: ~bx v] to ((x2) - (Col: ~tempX))\nset [col: ~by v] to ((y2) - (Col: ~tempY))\nset [col: ~bz v] to ((z2) - (Col: ~tempZ))\nset [col: ~cx v] to ((x3) - (Col: ~tempX))\nset [col: ~cy v] to ((y3) - (Col: ~tempY))\nset [col: ~cz v] to ((z3) - (Col: ~tempZ))\nset [col: ~pbcx v] to (((Col: ~by) * (Col: ~cz)) - ((Col: ~bz) * (Col: ~cy)))\nset [col: ~pbcy v] to (((Col: ~bz) * (Col: ~cx)) - ((Col: ~bx) * (Col: ~cz)))\nset [col: ~pbcz v] to (((Col: ~bx) * (Col: ~cy)) - ((Col: ~by) * (Col: ~cx)))\nset [col: ~pcax v] to (((Col: ~cy) * (Col: ~az)) - ((Col: ~cz) * (Col: ~ay)))\nset [col: ~pcay v] to (((Col: ~cz) * (Col: ~ax)) - ((Col: ~cx) * (Col: ~az)))\nset [col: ~pcaz v] to (((Col: ~cx) * (Col: ~ay)) - ((Col: ~cy) * (Col: ~ax)))\nset [col: ~pabx v] to (((Col: ~ay) * (Col: ~bz)) - ((Col: ~az) * (Col: ~by)))\nset [col: ~paby v] to (((Col: ~az) * (Col: ~bx)) - ((Col: ~ax) * (Col: ~bz)))\nset [col: ~pabz v] to (((Col: ~ax) * (Col: ~by)) - ((Col: ~ay) * (Col: ~bx)))\nif <not <<(((Col: ~PbcX) * (Col: ~PcaX)) + (((Col: ~PbcY) * (Col: ~PcaY)) + ((Col: ~PbcZ) * (Col: ~PcaZ)))) < [0]> or <(((Col: ~PbcX) * (Col: ~PabX)) + (((Col: ~PbcY) * (Col: ~PabY)) + ((Col: ~PbcZ) * (Col: ~PabZ)))) < [0]>>> then\n    set [col: ~colx v] to (Col: ~tempX)\n    set [col: ~coly v] to (Col: ~tempY)\n    set [col: ~colz v] to (Col: ~tempZ)\n    change [col: ~tempx v] by (() - (x))\n    change [col: ~tempy v] by (() - (y))\n    change [col: ~tempz v] by (() - (z))\n    set [col: ~mag v] to ([sqrt v] of (((Col: ~tempX) * (Col: ~tempX)) + (((Col: ~tempY) * (Col: ~tempY)) + ((Col: ~tempZ) * (Col: ~tempZ)))) )\n    if <(Col: ~mag) < (r)> then\n        set [~collisionresult v] to [1]\n    end\n    stop [this script v]\nend\n# Closest Point To Line Segment p: (x) (y) (z) Line: (x1) (y1) (z1) | (x2) (y2) (z2)\nset [col: ~tempx v] to ((Col: ~returnX) - (x))\nset [col: ~tempy v] to ((Col: ~returnY) - (y))\nset [col: ~tempz v] to ((Col: ~returnZ) - (z))\nset [col: ~mag v] to ([sqrt v] of (((Col: ~tempX) * (Col: ~tempX)) + (((Col: ~tempY) * (Col: ~tempY)) + ((Col: ~tempZ) * (Col: ~tempZ)))) )\nset [col: ~colx v] to (Col: ~returnX)\nset [col: ~coly v] to (Col: ~returnY)\nset [col: ~colz v] to (Col: ~returnZ)\n# Closest Point To Line Segment p: (x) (y) (z) Line: (x1) (y1) (z1) | (x3) (y3) (z3)\nset [col: ~tempx v] to ((Col: ~returnX) - (x))\nset [col: ~tempy v] to ((Col: ~returnY) - (y))\nset [col: ~tempz v] to ((Col: ~returnZ) - (z))\nset [col: ~temp v] to ([sqrt v] of (((Col: ~tempX) * (Col: ~tempX)) + (((Col: ~tempY) * (Col: ~tempY)) + ((Col: ~tempZ) * (Col: ~tempZ)))) )\nif <(Col: ~temp) < (Col: ~mag)> then\n    set [col: ~mag v] to (Col: ~temp)\n    set [col: ~colx v] to (Col: ~returnX)\n    set [col: ~coly v] to (Col: ~returnY)\n    set [col: ~colz v] to (Col: ~returnZ)\nend\n# Closest Point To Line Segment p: (x) (y) (z) Line: (x3) (y3) (z3) | (x2) (y2) (z2)\nset [col: ~tempx v] to ((Col: ~returnX) - (x))\nset [col: ~tempy v] to ((Col: ~returnY) - (y))\nset [col: ~tempz v] to ((Col: ~returnZ) - (z))\nset [col: ~temp v] to ([sqrt v] of (((Col: ~tempX) * (Col: ~tempX)) + (((Col: ~tempY) * (Col: ~tempY)) + ((Col: ~tempZ) * (Col: ~tempZ)))) )\nif <(Col: ~temp) < (Col: ~mag)> then\n    set [col: ~mag v] to (Col: ~temp)\n    set [col: ~colx v] to (Col: ~returnX)\n    set [col: ~coly v] to (Col: ~returnY)\n    set [col: ~colz v] to (Col: ~returnZ)\nend\nif <(Col: ~mag) < ((r) * (1))> then\n    set [~collisionresult v] to [1]\nend\n\ndefine # Collision - Sphere pos: (x) (y) (z) radius (r) Triangle (x1) (y1) (z1) . (x2) (y2) (z2) . (x3) (y3) (z3)\nset [~collisionresult v] to [0]\n# Get Max and Min (x1) (x2) (x3)\nset [col: tri x max v] to (~max)\nset [col: tri x min v] to (~min)\n# Get Max and Min (y1) (y2) (y3)\nset [col: tri y max v] to (~max)\nset [col: tri y min v] to (~min)\n# Get Max and Min (z1) (z2) (z3)\nset [col: tri z max v] to (~max)\nset [col: tri z min v] to (~min)\n# Get Plain Data with (x1) (y1) (z1) . (x2) (y2) (z2) . (x3) (y3) (z3)\nset [col: ~dot v] to ((((x) * (Col: plain function A)) + (((y) * (Col: plain function B)) + ((z) * (Col: plain function C)))) - (Col: plain function D))\nif <<((x) + (r)) > (Col: tri x min)> and <((x) - (r)) < (Col: tri x max)>> then\n    if <<((y) + (r)) > (Col: tri y min)> and <((y) - (r)) < (Col: tri y max)>> then\n        if <<((z) + (r)) > (Col: tri z min)> and <((z) - (r)) < (Col: tri z max)>> then\n            if <([abs v] of (Col: ~dot) ) < (r)> then\n                # Precise Collision Sphere (x) (y) (z) radius (r) To triangle (x1) (y1) (z1) . (x2) (y2) (z2) . (x3) (y3) (z3)\n            end\n        end\n    end\nend\n\ndefine set point (x) (y) (z)\nset [#x v] to (x)\nset [#y v] to (y)\nset [#z v] to (z)\n\ndefine do 3D stuff with (x) (y) (z)\nset point ((x) - (_ScrollX)) ((y) - (_ScrollY)) ((z) - (_ScrollZ))\nset point (((#x) * (=Ycos)) + ((#z) * (=Ysin))) (#y) (((#z) * (=Ycos)) - ((#x) * (=Ysin)))\nset point (#x) (((#y) * (=Xcos)) - ((#z) * (=Xsin))) (((#y) * (=Xsin)) + ((#z) * (=Xcos)))\n\ndefine 2D Tri Fill (x1) (y1) (x2) (y2) (x3) (y3) (outline)\nset [%tri2 v] to ([sqrt v] of ((((x2) - (x3)) * ((x2) - (x3))) + (((y2) - (y3)) * ((y2) - (y3)))) )\nset [%tri3 v] to ([sqrt v] of ((((x1) - (x3)) * ((x1) - (x3))) + (((y1) - (y3)) * ((y1) - (y3)))) )\nset [%tri4 v] to ([sqrt v] of ((((x1) - (x2)) * ((x1) - (x2))) + (((y1) - (y2)) * ((y1) - (y2)))) )\nset [%tri1 v] to (((%tri2) + ((%tri3) + (%tri4))) / (2))\nset [%tri0 v] to ((2) * ([sqrt v] of ((((%tri1) - (%tri2)) * (((%tri1) - (%tri3)) * ((%tri1) - (%tri4)))) / (%tri1)) ))\nchange [%tri1 v] by (%tri1)\ngo to x: (((((%tri2) * (x1)) + ((%tri3) * (x2))) + ((%tri4) * (x3))) / (%tri1)) y: (((((%tri2) * (y1)) + ((%tri3) * (y2))) + ((%tri4) * (y3))) / (%tri1))\nset pen size to (%tri0)\npen down\nif <(%tri0) > [0]> then\n    if <<(%tri3) < (%tri2)> or <(%tri4) < (%tri2)>> then\n        if <<(%tri2) < (%tri3)> or <(%tri4) < (%tri3)>> then\n            set [%tri1 v] to ((x position) - (x3))\n            set [%tri2 v] to ((y position) - (y3))\n        else\n            set [%tri1 v] to ((x position) - (x2))\n            set [%tri2 v] to ((y position) - (y2))\n        end\n    else\n        set [%tri1 v] to ((x position) - (x1))\n        set [%tri2 v] to ((y position) - (y1))\n    end\n    set [%tri1 v] to (([sqrt v] of (((%tri1) * (%tri1)) + ((%tri2) * (%tri2))) ) / ((%tri0) / (2)))\n    set [%tri8 v] to (((%tri1) * (outline)) / ((%tri1) - (1)))\n    set [%tri1 v] to ((0.5) - ((0.5) / (%tri1)))\n    set [%tri2 v] to (((x position) - (x1)) / (%tri0))\n    set [%tri3 v] to (((y position) - (y1)) / (%tri0))\n    set [%tri4 v] to (((x position) - (x2)) / (%tri0))\n    set [%tri5 v] to (((y position) - (y2)) / (%tri0))\n    set [%tri6 v] to (((x position) - (x3)) / (%tri0))\n    set [%tri7 v] to (((y position) - (y3)) / (%tri0))\n    repeat ([floor v] of (([log v] of ((1) / (%tri0)) ) / ([log v] of (%tri1) )) )\n        set [%tri0 v] to ((%tri1) * (%tri0))\n        set pen size to ((%tri0) + (.5))\n        go to x: ((x1) + ((%tri0) * (%tri2))) y: ((y1) + ((%tri0) * (%tri3)))\n        go to x: ((x2) + ((%tri0) * (%tri4))) y: ((y2) + ((%tri0) * (%tri5)))\n        go to x: ((x3) + ((%tri0) * (%tri6))) y: ((y3) + ((%tri0) * (%tri7)))\n        go to x: ((x1) + ((%tri0) * (%tri2))) y: ((y1) + ((%tri0) * (%tri3)))\n    end\nend\nset pen size to (outline)\nchange pen (brightness v) by (-15)\ngo to x: (x1) y: (y1)\ngo to x: (x2) y: (y2)\ngo to x: (x3) y: (y3)\ngo to x: (x1) y: (y1)\npen up\nchange pen (brightness v) by (15)\n\nchange [_playerx v] by (() - (((=Ysin) * (<key (w v) pressed?> - <key (s v) pressed?>)) + ((=Ycos) * (<key (a v) pressed?> - <key (d v) pressed?>))))\nchange [_playerz v] by (((=Ycos) * (<key (w v) pressed?> - <key (s v) pressed?>)) - ((=Ysin) * (<key (a v) pressed?> - <key (d v) pressed?>)))\n\n
Move with WASD, rotate with arrow keys. NOT mobile friendly.\nPlay it here for better quality! https://turbowarp.org/486819568?hqpen&fps=60\n\nNext: \n-Nothing