Platformer 3D | 2.7k blocks
@Stage\n\n@BLANK\n\n@Renderer\n\ndefine Go to x: (x) y: (y) z: (z)\nset p to x: ((x) - (PUBLIC.CamX)) y: ((y) - (PUBLIC.CamY)) z: ((z) - (PUBLIC.CamZ))\nset p to x: (((private.px) * (private.CamCosY)) - ((private.pz) * (private.CamSinY))) y: (private.py) z: (((private.px) * (private.CamSinY)) + ((private.pz) * (private.CamCosY)))\nset p to x: (private.px) y: (((private.py) * (private.CamCosX)) - ((private.pz) * (private.CamSinX))) z: (((private.py) * (private.CamSinX)) + ((private.pz) * (private.CamCosX)))\ngo to x: (((private.px) / (private.pz)) * (PUBLIC.FOCALLENGHT)) y: (((private.py) / (private.pz)) * (PUBLIC.FOCALLENGHT))\n\ndefine Render\nset [private.i v] to [1]\nrepeat ((length of [px v]) / (3))\n    set [private.currenttriangle. v] to ((((item (private.I) of [id v]) - (1)) * (3)) + (1))\n    set [private.x1 v] to (item ((private.CurrentTriangle.) + (0)) of [px v])\n    set [private.y1 v] to (item ((private.CurrentTriangle.) + (0)) of [py v])\n    set [private.z1 v] to (item ((private.CurrentTriangle.) + (0)) of [pz v])\n    set [private.x2 v] to (item ((private.CurrentTriangle.) + (1)) of [px v])\n    set [private.y2 v] to (item ((private.CurrentTriangle.) + (1)) of [py v])\n    set [private.z2 v] to (item ((private.CurrentTriangle.) + (1)) of [pz v])\n    set [private.x3 v] to (item ((private.CurrentTriangle.) + (2)) of [px v])\n    set [private.y3 v] to (item ((private.CurrentTriangle.) + (2)) of [py v])\n    set [private.z3 v] to (item ((private.CurrentTriangle.) + (2)) of [pz v])\n    set pen color to r: (item ((private.CurrentTriangle.) + (0)) of [rgb v]) g: (item ((private.CurrentTriangle.) + (1)) of [rgb v]) b: (item ((private.CurrentTriangle.) + (2)) of [rgb v])\n    fill 3D triangle from (private.x1) (private.y1) (private.z1) to (private.x2) (private.y2) (private.z2) to (private.x3) (private.y3) (private.z3)\n    change [private.i v] by (1)\nend\n\nset [private.x v] to (x)\nset [private.y v] to (y)\nset [private.z v] to (z)\nset pen color to (#119600)\nfill 3D triangle from (private.x) (private.y) (private.z) to ((private.x) + (50)) (private.y) (private.z) to ((private.x) + (50)) ((private.y) + (50)) (private.z)\nchange pen (color v) by (1)\nfill 3D triangle from (private.x) (private.y) (private.z) to (private.x) ((private.y) + (50)) (private.z) to ((private.x) + (50)) ((private.y) + (50)) (private.z)\nchange pen (color v) by (1)\nfill 3D triangle from (private.x) ((private.y) + (50)) (private.z) to (private.x) (private.y) (private.z) to (private.x) (private.y) ((private.z) + (50))\nchange pen (color v) by (1)\nfill 3D triangle from (private.x) (private.y) ((private.z) + (50)) to (private.x) ((private.y) + (50)) (private.z) to (private.x) ((private.y) + (50)) ((private.z) + (50))\nchange pen (color v) by (1)\nfill 3D triangle from (private.x) (private.y) ((private.z) + (50)) to ((private.x) + (50)) (private.y) ((private.z) + (50)) to ((private.x) + (50)) (private.y) ((private.z) + (0))\nchange pen (color v) by (1)\nfill 3D triangle from ((private.x) + (50)) (private.y) ((private.z) + (50)) to ((private.x) + (50)) (private.y) ((private.z) + (50)) to ((private.x) + (50)) (private.y) ((private.z) + (0))\nchange pen (color v) by (1)\nfill 3D triangle from ((private.x) + (0)) (private.y) ((private.z) + (50)) to ((private.x) + (0)) (private.y) ((private.z) + (0)) to ((private.x) + (50)) (private.y) (private.z)\nchange pen (color v) by (1)\nfill 3D triangle from ((private.x) + (50)) (private.y) ((private.z) + (50)) to ((private.x) + (50)) ((private.y) + (50)) ((private.z) + (50)) to (private.x) ((private.y) + (50)) ((private.z) + (50))\nchange pen (color v) by (1)\nfill 3D triangle from ((private.x) + (50)) (private.y) ((private.z) + (50)) to ((private.x) + (0)) ((private.y) + (50)) ((private.z) + (50)) to ((private.x) + (0)) ((private.y) + (0)) ((private.z) + (50))\nchange pen (color v) by (1)\nfill 3D triangle from ((private.x) + (50)) ((private.y) + (50)) (private.z) to ((private.x) + (50)) (private.y) (private.z) to ((private.x) + (50)) (private.y) ((private.z) + (50))\nchange pen (color v) by (1)\nfill 3D triangle from ((private.x) + (50)) ((private.y) + (50)) ((private.z) + (50)) to ((private.x) + (50)) ((private.y) + (50)) (private.z) to ((private.x) + (50)) (private.y) ((private.z) + (50))\nfill 3D triangle from (private.x) ((private.y) + (50)) (private.z) to (private.x) (private.y) (private.z) to (private.x) (private.y) ((private.z) + (50))\nfill 3D triangle from (private.x) (private.y) (private.z) to ((private.x) + (50)) (private.y) (private.z) to ((private.x) + (50)) ((private.y) + (50)) (private.z)\n\npen up\nGo to x: [2] y: [1] z: [10]\npen down\nGo to x: [2] y: [1] z: [10]\npen up\nGo to x: [2] y: [1] z: [10]\npen down\nGo to x: (private.x) y: ((private.y) + (50)) z: ((private.z) + (0))\npen up\n\ndefine Controls\ncalculate trig values\n\ndefine set p to x: (x) y: (y) z: (z)\nset [private.px v] to (x)\nset [private.py v] to (y)\nset [private.pz v] to (z)\n\ndefine calculate trig values\nset [private.camcosx v] to ([cos v] of (PUBLC.CamRotX) )\nset [private.camsinx v] to ([sin v] of (PUBLC.CamRotX) )\nset [private.camcosy v] to ([cos v] of (PUBLC.CamRotY) )\nset [private.camsiny v] to ([sin v] of (PUBLC.CamRotY) )\n\ndefine fillTri (a) (b) (c) (d) (e) (f) (r)\nset [_tri2 v] to ([sqrt v] of ((((c) - (e)) * ((c) - (e))) + (((d) - (f)) * ((d) - (f)))) )\nset [_tri3 v] to ([sqrt v] of ((((a) - (e)) * ((a) - (e))) + (((b) - (f)) * ((b) - (f)))) )\nset [_tri4 v] to ([sqrt v] of ((((a) - (c)) * ((a) - (c))) + (((b) - (d)) * ((b) - (d)))) )\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) * (a)) + ((_tri3) * (c))) + ((_tri4) * (e))) / (_tri1)) y: (((((_tri2) * (b)) + ((_tri3) * (d))) + ((_tri4) * (f))) / (_tri1))\nset pen size to (_tri0)\npen down\nif <(_tri0) > [0]> then\n    if <<(_tri3) < (_tri2)> or <(_tri4) < (_tri2)>> then\n        if <(_tri4) < (_tri3)> then\n            set [_tri1 v] to ((x position) - (e))\n            set [_tri2 v] to ((y position) - (f))\n        else\n            set [_tri1 v] to ((x position) - (c))\n            set [_tri2 v] to ((y position) - (d))\n        end\n    else\n        set [_tri1 v] to ((x position) - (a))\n        set [_tri2 v] to ((y position) - (b))\n    end\n    set [_tri1 v] to (([sqrt v] of (((_tri1) * (_tri1)) + ((_tri2) * (_tri2))) ) / ((_tri0) / (2)))\n    set [_tri8 v] to ((((_tri1) * (r)) / ((_tri1) - (1))) + (.25))\n    set [_tri1 v] to ((.5) - ((.5) / (_tri1)))\n    set [_tri2 v] to (((x position) - (a)) / (_tri0))\n    set [_tri3 v] to (((y position) - (b)) / (_tri0))\n    set [_tri4 v] to (((x position) - (c)) / (_tri0))\n    set [_tri5 v] to (((y position) - (d)) / (_tri0))\n    set [_tri6 v] to (((x position) - (e)) / (_tri0))\n    set [_tri7 v] to (((y position) - (f)) / (_tri0))\n    repeat until <(_tri0) < (_tri8)>\n        set [_tri0 v] to ((_tri1) * (_tri0))\n        set pen size to ((_tri0) + (.5))\n        go to x: ((a) + ((_tri0) * (_tri2))) y: ((b) + ((_tri0) * (_tri3)))\n        go to x: ((c) + ((_tri0) * (_tri4))) y: ((d) + ((_tri0) * (_tri5)))\n        go to x: ((e) + ((_tri0) * (_tri6))) y: ((f) + ((_tri0) * (_tri7)))\n        go to x: ((a) + ((_tri0) * (_tri2))) y: ((b) + ((_tri0) * (_tri3)))\n        if <(_tri8) < [-3]> then\n            pen up\n            stop [this script v]\n        end\n    end\nend\nset pen size to (r)\ngo to x: (a) y: (b)\ngo to x: (c) y: (d)\ngo to x: (e) y: (f)\ngo to x: (a) y: (b)\npen up\n\ndefine Transform point x: (x) y: (y) z: (z)\nset p to x: ((x) - (PUBLIC.CamX)) y: ((y) - (PUBLIC.CamY)) z: ((z) - (PUBLIC.CamZ))\nset p to x: (((private.px) * (private.CamCosY)) - ((private.pz) * (private.CamSinY))) y: (private.py) z: (((private.px) * (private.CamSinY)) + ((private.pz) * (private.CamCosY)))\nset p to x: (private.px) y: (((private.py) * (private.CamCosX)) - ((private.pz) * (private.CamSinX))) z: (((private.py) * (private.CamSinX)) + ((private.pz) * (private.CamCosX)))\n\ndefine fill 3D triangle from (x1) (y1) (z1) to (x2) (y2) (z2) to (x3) (y3) (z3)\nTransform point x: (x1) y: (y1) z: (z1)\nset [private.x1 v] to (private.px)\nset [private.y1 v] to (private.py)\nset [private.z1 v] to (private.pz)\nTransform point x: (x2) y: (y2) z: (z2)\nset [private.x2 v] to (private.px)\nset [private.y2 v] to (private.py)\nset [private.z2 v] to (private.pz)\nTransform point x: (x3) y: (y3) z: (z3)\nset [private.x3 v] to (private.px)\nset [private.y3 v] to (private.py)\nset [private.z3 v] to (private.pz)\nif <<(private.z1) > [7]> and <<(private.z2) > [7]> and <(private.z3) > [7]>>> then\n    change pen (brightness v) by (((((0) - (private.z1)) + (((0) - (private.z2)) + ((0) - (private.z3)))) / (6)) + (30))\n    if <(((((0) - (private.z1)) + (((0) - (private.z2)) + ((0) - (private.z3)))) / (6)) + (90)) > [5]> then\n        fillTri ((PUBLIC.FOCALLENGHT) * ((private.x1) / (private.z1))) ((PUBLIC.FOCALLENGHT) * ((private.y1) / (private.z1))) ((PUBLIC.FOCALLENGHT) * ((private.x2) / (private.z2))) ((PUBLIC.FOCALLENGHT) * ((private.y2) / (private.z2))) ((PUBLIC.FOCALLENGHT) * ((private.x3) / (private.z3))) ((PUBLIC.FOCALLENGHT) * ((private.y3) / (private.z3))) [1]\n    end\nend\n\ndefine Add 3D triangle from: (x1) (y1) (z1) to: (x2) (y2) (z2) to: (x3) (y3) (z3) RGB: (r) (g) (b)\nadd (x1) to [px v]\nadd (y1) to [py v]\nadd (z1) to [pz v]\nadd (x2) to [px v]\nadd (y2) to [py v]\nadd (z2) to [pz v]\nadd (x3) to [px v]\nadd (y3) to [py v]\nadd (z3) to [pz v]\nadd (r) to [rgb v]\nadd (g) to [rgb v]\nadd (b) to [rgb v]\n\ndefine set pen color to r: (r) g: (g) b: (b)\nset pen color to ((((r) * (65536)) + ((g) * (256))) + (b))\n\ndefine calculate distances.\ndelete all of [distance v]\nset [private.i v] to [1]\nrepeat ((length of [px v]) / (3))\n    set [private.x1 v] to (item ((private.I) + (0)) of [px v])\n    set [private.y1 v] to (item ((private.I) + (0)) of [py v])\n    set [private.z1 v] to (item ((private.I) + (0)) of [pz v])\n    set [private.x2 v] to (item ((private.I) + (1)) of [px v])\n    set [private.y2 v] to (item ((private.I) + (1)) of [py v])\n    set [private.z2 v] to (item ((private.I) + (1)) of [pz v])\n    set [private.x3 v] to (item ((private.I) + (2)) of [px v])\n    set [private.y3 v] to (item ((private.I) + (2)) of [py v])\n    set [private.z3 v] to (item ((private.I) + (2)) of [pz v])\n    set p to x: (((private.x1) + ((private.x2) + (private.x3))) / (3)) y: (((private.y1) + ((private.y2) + (private.y3))) / (3)) z: (((private.z1) + ((private.z2) + (private.z3))) / (3))\n    set p to x: ((private.px) - (PUBLIC.CamX)) y: ((private.py) - (PUBLIC.CamY)) z: ((private.pz) - (PUBLIC.CamZ))\n    add ([sqrt v] of (((private.px) * (private.px)) + (((private.py) * (private.py)) + ((private.pz) * (private.pz)))) ) to [distance v]\n    change [private.i v] by (3)\nend\n\ndefine Add layer (i) (id)\nset [private.lower v] to [0]\nset [private.index v] to [0]\nset [private.upper v] to (length of [distance v])\nrepeat until <not <(private.lower) < (private.upper)>>\n    set [private.middle v] to ([floor v] of (((private.lower) + (private.upper)) / (2)) )\n    if <(i) < (item (item ((private.middle) + (1)) of [id v]) of [distance v])> then\n        set [private.lower v] to ((private.middle) + (1))\n    else\n        set [private.upper v] to (private.middle)\n    end\n    change [private.index v] by (1)\n    if <(private.Index) > (length of [distance v])> then\n        stop [this script v]\n    end\nend\ninsert (id) at ((private.lower) + (1)) of [id v] \n\ndefine sort triangles.\ndelete all of [id v]\nset [private.i v] to [1]\nrepeat (length of [distance v])\n    Add layer (item (private.I) of [distance v]) (private.I)\n    change [private.i v] by (1)\nend\n\ndefine z clip triangle case A: (x1) (y1) (z1) (x2) (y2) (z2) (x3) (y3) (z3)\nset [private.z1 v] to (((z2) - (1)) / ((z2) - (z1)))\nset [private.x1 v] to ((PUBLIC.FOCALLENGHT) * ((x2) - (((x2) - (x1)) * (private.z1))))\nset [private.y1 v] to ((PUBLIC.FOCALLENGHT) * ((y2) - (((y2) - (y1)) * (private.z1))))\nset [private.z2 v] to (((z3) - (1)) / ((z3) - (z1)))\nset [private.x2 v] to ((PUBLIC.FOCALLENGHT) * ((x3) - (((x3) - (x1)) * (private.z2))))\nset [private.y2 v] to ((PUBLIC.FOCALLENGHT) * ((y3) - (((y3) - (y1)) * (private.z2))))\nfillTri (private.x1) (private.y1) ((PUBLIC.FOCALLENGHT) * ((x2) / (z2))) ((PUBLIC.FOCALLENGHT) * ((y2) / (z2))) ((PUBLIC.FOCALLENGHT) * ((x3) / (z3))) ((PUBLIC.FOCALLENGHT) * ((y3) / (z3))) [1]\nfillTri (private.x1) (private.y1) (private.x2) (private.y2) ((PUBLIC.FOCALLENGHT) * ((x3) / (z3))) ((PUBLIC.FOCALLENGHT) * ((y3) / (z3))) [1]\n\ndefine z clip triangle case B: (x1) (y1) (z1) (x2) (y2) (z2) (x3) (y3) (z3)\nset [private.z1 v] to (((z3) - (1)) / ((z3) - (z1)))\nset [private.x1 v] to ((PUBLIC.FOCALLENGHT) * ((x3) - (((x3) - (x1)) * (private.z1))))\nset [private.y1 v] to ((PUBLIC.FOCALLENGHT) * ((y3) - (((y3) - (y1)) * (private.z1))))\nset [private.z2 v] to (((z3) - (1)) / ((z3) - (z2)))\nset [private.x2 v] to ((PUBLIC.FOCALLENGHT) * ((x3) - (((x3) - (x2)) * (private.z2))))\nset [private.y2 v] to ((PUBLIC.FOCALLENGHT) * ((y3) - (((y3) - (y2)) * (private.z2))))\nfillTri (private.x1) (private.y1) (private.x2) (private.y2) ((PUBLIC.FOCALLENGHT) * ((x3) / (z3))) ((PUBLIC.FOCALLENGHT) * ((y3) / (z3))) [1]\n\ndefine Add square at x: (x) y: (y) z: (z) with an RGB value of (r) (g) (b)\nset [private.x v] to (x)\nset [private.y v] to (y)\nset [private.z v] to (z)\nAdd 3D triangle from: (private.x) (private.y) (private.z) to: ((private.x) + (20)) (private.y) (private.z) to: ((private.x) + (20)) (private.y) ((private.z) + (20)) RGB: (r) (g) (b)\nAdd 3D triangle from: (private.x) (private.y) (private.z) to: (private.x) (private.y) ((private.z) + (20)) to: ((private.x) + (20)) (private.y) ((private.z) + (20)) RGB: (r) (g) (b)\n\ndefine Add game\nif <(PUBLIC.LEVEL) = [1]> then\n    Level 1\nelse\n    if <(PUBLIC.LEVEL) = [2]> then\n        Level 2\n    else\n        if <(PUBLIC.LEVEL) = [3]> then\n            level 3\n        else\n            if <(PUBLIC.LEVEL) = [4]> then\n                Level 4\n            else\n                if <(PUBLIC.LEVEL) = [5]> then\n                    Level 5\n                else\n                    if <(PUBLIC.LEVEL) = [6]> then\n                        Level 6\n                    else\n                        if <(PUBLIC.LEVEL) = [7]> then\n                            Level 7\n                        else\n                            if <(PUBLIC.LEVEL) = [8]> then\n                                Level 8\n                            else\n                                if <(PUBLIC.LEVEL) = [9]> then\n                                    Level 9\n                                else\n                                    if <(PUBLIC.LEVEL) = [10]> then\n                                        Level 10\n                                    else\n                                        if <(PUBLIC.LEVEL) = [11]> then\n                                            Level 11\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Add cube at x: (x) y: (y) z: (z) with an RGB value of (r) (g) (b)\nadd (x) to [cube x v]\nadd (y) to [cube y v]\nadd (z) to [cube z v]\nset [private.x v] to (x)\nset [private.y v] to (y)\nset [private.z v] to (z)\nAdd 3D triangle from: (private.x) (private.y) (private.z) to: ((private.x) + (20)) (private.y) (private.z) to: ((private.x) + (20)) (private.y) ((private.z) + (20)) RGB: (r) (g) (b)\nAdd 3D triangle from: (private.x) (private.y) (private.z) to: (private.x) (private.y) ((private.z) + (20)) to: ((private.x) + (20)) (private.y) ((private.z) + (20)) RGB: (r) (g) (b)\nAdd 3D triangle from: (private.x) (private.y) (private.z) to: ((private.x) + (20)) ((private.y) - (20)) (private.z) to: ((private.x) + (20)) (private.y) (private.z) RGB: (r) (g) (b)\nAdd 3D triangle from: ((private.x) + (0)) (private.y) (private.z) to: ((private.x) + (20)) ((private.y) - (20)) (private.z) to: ((private.x) + (0)) ((private.y) - (20)) (private.z) RGB: (r) (g) (b)\nAdd 3D triangle from: ((private.x) + (20)) (private.y) (private.z) to: ((private.x) + (20)) ((private.y) - (20)) ((private.z) + (20)) to: ((private.x) + (20)) ((private.y) - (20)) (private.z) RGB: (r) (g) (b)\nAdd 3D triangle from: ((private.x) + (20)) (private.y) ((private.z) + (20)) to: ((private.x) + (20)) ((private.y) - (20)) ((private.z) + (20)) to: ((private.x) + (20)) ((private.y) - (0)) (private.z) RGB: (r) (g) (b)\nAdd 3D triangle from: (private.x) (private.y) (private.z) to: (private.x) ((private.y) - (20)) ((private.z) + (20)) to: (private.x) ((private.y) - (20)) (private.z) RGB: (r) (g) (b)\nAdd 3D triangle from: (private.x) (private.y) ((private.z) + (20)) to: (private.x) ((private.y) - (20)) ((private.z) + (20)) to: (private.x) ((private.y) - (0)) (private.z) RGB: (r) (g) (b)\nAdd 3D triangle from: (private.x) ((private.y) - (20)) (private.z) to: ((private.x) + (20)) ((private.y) - (20)) (private.z) to: ((private.x) + (20)) ((private.y) - (20)) ((private.z) + (20)) RGB: (r) (g) (b)\nAdd 3D triangle from: (private.x) ((private.y) - (20)) (private.z) to: (private.x) ((private.y) - (20)) ((private.z) + (20)) to: ((private.x) + (20)) ((private.y) - (20)) ((private.z) + (20)) RGB: (r) (g) (b)\nAdd 3D triangle from: (private.x) (private.y) ((private.z) + (20)) to: ((private.x) + (20)) ((private.y) - (20)) ((private.z) + (20)) to: ((private.x) + (20)) (private.y) ((private.z) + (20)) RGB: (r) (g) (b)\nAdd 3D triangle from: ((private.x) + (0)) (private.y) ((private.z) + (20)) to: ((private.x) + (20)) ((private.y) - (20)) ((private.z) + (20)) to: ((private.x) + (0)) ((private.y) - (20)) ((private.z) + (20)) RGB: (r) (g) (b)\n\ndefine Create a row of tiles by changing the x: (x) y: (y) and z position: (z) and loop: (times) with a RGB value of: (r) (g) (b)\nrepeat (times)\n    change [private.rowstartx v] by (x)\n    change [private.rowstarty v] by (y)\n    change [private.rowstartz v] by (z)\n    Add cube at x: (private.rowstartx) y: (private.rowstarty) z: (private.rowstartz) with an RGB value of (r) (g) (b)\nend\n\nwhen I receive [respawn v]\nset [public.camx v] to [0]\nset [publc.camrotx v] to [0]\nset [publc.camroty v] to [180]\nset [public.camy v] to [0]\nset [public.camz v] to [90]\nset [public.focallenght v] to [240]\ndelete all of [cube x v]\ndelete all of [cube y v]\ndelete all of [cube z v]\ndelete all of [lava x v]\ndelete all of [lava y v]\ndelete all of [lava z v]\ndelete all of [px v]\ndelete all of [flag x v]\ndelete all of [flag y v]\ndelete all of [flag z v]\ndelete all of [py v]\ndelete all of [pz v]\ndelete all of [rgb v]\nAdd game\n\nwhen I receive [next level v]\nstop [other scripts in sprite v]\nset [public.camx v] to [0]\nset [publc.camrotx v] to [0]\nset [publc.camroty v] to [180]\nset [public.camy v] to [0]\nset [public.camz v] to [90]\nset [public.focallenght v] to [240]\nchange [public.level v] by (1)\ndelete all of [cube x v]\ndelete all of [cube y v]\ndelete all of [cube z v]\ndelete all of [lava x v]\ndelete all of [lava y v]\ndelete all of [lava z v]\ndelete all of [px v]\ndelete all of [py v]\ndelete all of [pz v]\ndelete all of [rgb v]\ndelete all of [flag x v]\ndelete all of [flag y v]\ndelete all of [flag z v]\nwait (5) seconds\nAdd game\nControls\ncalculate distances.\nsort triangles.\nerase all\nRender\n\ndefine Level 1\nAdd cube at x: [-10] y: [0] z: [0] with an RGB value of [0] [70] [120]\nAdd cube at x: [-10] y: [20] z: [-40] with an RGB value of [0] [70] [120]\nAdd cube at x: [50] y: [20] z: [-40] with an RGB value of [0] [70] [120]\nadd [50] to [flag x v]\nadd [20] to [flag y v]\nadd [-80] to [flag z v]\nAdd cube at x: [50] y: [20] z: [-80] with an RGB value of [0] [255] [0]\nset [private.rowstartx v] to [-10]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [-30]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [10]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\n\ndefine Level 2\nAdd cube at x: [-10] y: [0] z: [0] with an RGB value of [0] [70] [120]\nAdd cube at x: [-10] y: [20] z: [-40] with an RGB value of [0] [70] [120]\nAdd cube at x: [-10] y: [40] z: [-80] with an RGB value of [0] [70] [120]\nAdd Lava at x: [-10] y: [40] z: [-100] with a RGB value of: [200] [0] [0]\nAdd cube at x: [-10] y: [40] z: [-120] with an RGB value of [0] [70] [129]\nadd [-10] to [flag x v]\nadd [40] to [flag y v]\nadd [-140] to [flag z v]\nAdd cube at x: [-10] y: [40] z: [-140] with an RGB value of [0] [255] [0]\nset [private.rowstartx v] to [-10]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [-30]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [10]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\n\ndefine Add Lava at x: (x) y: (y) z: (z) with a RGB value of: (r) (g) (b)\nadd (x) to [lava x v]\nadd (y) to [lava y v]\nadd (z) to [lava z v]\nAdd cube at x: (x) y: (y) z: (z) with an RGB value of (r) (g) (b)\n\nwhen I receive [start game v]\nforever\n    set pen color to (#119600)\n    set pen size to (2)\n    broadcast (Tick - Player v) and wait\n    Controls\n    calculate distances.\n    sort triangles.\n    erase all\n    Render\nend\n\nwhen flag clicked\nset [public.level v] to [1]\nset [public.camx v] to [0]\nset [publc.camrotx v] to [0]\nset [publc.camroty v] to [180]\nset [public.camy v] to [0]\nset [public.camz v] to [90]\nset [public.focallenght v] to [240]\ndelete all of [cube x v]\ndelete all of [cube y v]\ndelete all of [cube z v]\ndelete all of [lava x v]\ndelete all of [lava y v]\ndelete all of [lava z v]\ndelete all of [px v]\ndelete all of [py v]\ndelete all of [pz v]\ndelete all of [rgb v]\nAdd game\nhide\n\ndefine level 3\nAdd cube at x: [-10] y: [-20] z: [20] with an RGB value of [0] [70] [120]\nAdd Lava at x: [-10] y: [-20] z: [0] with a RGB value of: [200] [0] [0]\nAdd cube at x: [-10] y: [-20] z: [-20] with an RGB value of [0] [70] [120]\nAdd Lava at x: [-10] y: [-20] z: [-40] with a RGB value of: [200] [0] [0]\nAdd Lava at x: [-10] y: [-20] z: [-60] with a RGB value of: [200] [0] [0]\nadd [-10] to [flag x v]\nadd [-20] to [flag y v]\nadd [-80] to [flag z v]\nAdd cube at x: [-10] y: [-20] z: [-80] with an RGB value of [0] [255] [0]\nset [private.rowstartx v] to [-10]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [-30]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [10]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\n\ndefine Level 4\nAdd cube at x: [-10] y: [-20] z: [20] with an RGB value of [0] [70] [120]\nAdd Lava at x: [-10] y: [-20] z: [0] with a RGB value of: [200] [0] [0]\nAdd cube at x: [-10] y: [-20] z: [-20] with an RGB value of [0] [70] [120]\nAdd Lava at x: [-10] y: [-20] z: [-40] with a RGB value of: [200] [0] [0]\nAdd cube at x: [-10] y: [0] z: [-60] with an RGB value of [0] [70] [120]\nAdd cube at x: [-30] y: [0] z: [-60] with an RGB value of [0] [70] [120]\nAdd Lava at x: [-50] y: [0] z: [-60] with a RGB value of: [200] [0] [0]\nadd [-70] to [flag x v]\nadd [0] to [flag y v]\nadd [-60] to [flag z v]\nAdd cube at x: [-70] y: [0] z: [-60] with an RGB value of [0] [255] [0]\nset [private.rowstartx v] to [-10]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [-30]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [10]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\n\ndefine Level 5\nAdd cube at x: [-10] y: [-20] z: [20] with an RGB value of [0] [70] [120]\nAdd Lava at x: [-10] y: [-20] z: [0] with a RGB value of: [200] [0] [0]\nAdd cube at x: [-10] y: [-20] z: [-20] with an RGB value of [0] [70] [120]\nAdd cube at x: [-10] y: [0] z: [-40] with an RGB value of [0] [70] [120]\nAdd Lava at x: [-10] y: [0] z: [-60] with a RGB value of: [200] [0] [0]\nAdd cube at x: [-10] y: [0] z: [-80] with an RGB value of [0] [70] [120]\nAdd cube at x: [-10] y: [20] z: [-120] with an RGB value of [0] [70] [120]\nAdd cube at x: [-10] y: [40] z: [-160] with an RGB value of [0] [70] [120]\nadd [-10] to [flag x v]\nadd [40] to [flag y v]\nadd [-180] to [flag z v]\nAdd cube at x: [-10] y: [40] z: [-180] with an RGB value of [0] [255] [0]\nset [private.rowstartx v] to [-10]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [-30]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [10]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\n\ndefine Level 6\nAdd cube at x: [-10] y: [-20] z: [20] with an RGB value of [0] [70] [120]\nAdd cube at x: [-10] y: [-40] z: [-20] with an RGB value of [0] [70] [120]\nAdd cube at x: [-10] y: [-40] z: [-60] with an RGB value of [0] [70] [120]\nAdd cube at x: [-10] y: [-20] z: [-100] with an RGB value of [0] [70] [120]\nAdd Lava at x: [-10] y: [-20] z: [-120] with a RGB value of: [200] [0] [0]\nAdd cube at x: [-10] y: [-20] z: [-160] with an RGB value of [0] [70] [120]\nAdd Lava at x: [-10] y: [-20] z: [-180] with a RGB value of: [200] [0] [0]\nadd [-10] to [flag x v]\nadd [-20] to [flag y v]\nadd [-200] to [flag z v]\nAdd cube at x: [-10] y: [-20] z: [-200] with an RGB value of [0] [255] [0]\nset [private.rowstartx v] to [-10]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [-30]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [10]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\n\ndefine Level 7\nAdd cube at x: [-10] y: [-20] z: [20] with an RGB value of [0] [70] [120]\nAdd cube at x: [-10] y: [-20] z: [-20] with an RGB value of [0] [70] [120]\nAdd cube at x: [10] y: [-20] z: [-20] with an RGB value of [0] [70] [120]\nAdd cube at x: [30] y: [-20] z: [-20] with an RGB value of [0] [70] [120]\nAdd Lava at x: [50] y: [-20] z: [-20] with a RGB value of: [200] [0] [0]\nAdd cube at x: [90] y: [-20] z: [-20] with an RGB value of [0] [70] [120]\nAdd Lava at x: [110] y: [-20] z: [-20] with a RGB value of: [200] [0] [0]\nadd [130] to [flag x v]\nadd [-20] to [flag y v]\nadd [-20] to [flag z v]\nAdd cube at x: [130] y: [-20] z: [-20] with an RGB value of [0] [255] [0]\nset [private.rowstartx v] to [-10]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [-30]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [10]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\n\ndefine Level 8\nAdd cube at x: [-10] y: [-20] z: [20] with an RGB value of [0] [70] [120]\nAdd cube at x: [-10] y: [-20] z: [-20] with an RGB value of [0] [70] [120]\nAdd cube at x: [-10] y: [0] z: [-60] with an RGB value of [0] [70] [120]\nAdd cube at x: [-10] y: [20] z: [-100] with an RGB value of [0] [70] [120]\nAdd Lava at x: [-10] y: [20] z: [-120] with a RGB value of: [200] [0] [0]\nAdd cube at x: [-10] y: [20] z: [-140] with an RGB value of [0] [70] [120]\nAdd Lava at x: [-30] y: [20] z: [-140] with a RGB value of: [200] [0] [0]\nadd [-50] to [flag x v]\nadd [20] to [flag y v]\nadd [-140] to [flag z v]\nAdd cube at x: [-50] y: [20] z: [-140] with an RGB value of [0] [255] [0]\nset [private.rowstartx v] to [-10]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [-30]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [10]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\n\nbroadcast (Respawn v)\n\ndefine Level 9\nAdd cube at x: [-10] y: [-20] z: [20] with an RGB value of [0] [70] [120]\nAdd cube at x: [-10] y: [-20] z: [-20] with an RGB value of [0] [70] [120]\nAdd Lava at x: [-10] y: [-20] z: [-40] with a RGB value of: [200] [0] [0]\nAdd cube at x: [-10] y: [-40] z: [-80] with an RGB value of [0] [70] [120]\nAdd Lava at x: [-10] y: [-40] z: [-100] with a RGB value of: [200] [0] [0]\nAdd cube at x: [-10] y: [-40] z: [-120] with an RGB value of [0] [70] [120]\nAdd cube at x: [-10] y: [-20] z: [-160] with an RGB value of [0] [70] [120]\nAdd Lava at x: [-10] y: [-20] z: [-180] with a RGB value of: [200] [0] [0]\nAdd cube at x: [-10] y: [-20] z: [-200] with an RGB value of [0] [70] [120]\nadd [-10] to [flag x v]\nadd [-20] to [flag y v]\nadd [-220] to [flag z v]\nAdd cube at x: [-10] y: [-20] z: [-220] with an RGB value of [0] [255] [0]\nset [private.rowstartx v] to [-10]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [-30]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [10]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\n\ndefine Level 10\nAdd cube at x: [-10] y: [-20] z: [20] with an RGB value of [0] [70] [120]\nAdd cube at x: [-10] y: [-20] z: [-20] with an RGB value of [0] [70] [120]\nAdd Lava at x: [-10] y: [-20] z: [-40] with a RGB value of: [200] [0] [0]\nAdd cube at x: [-10] y: [-20] z: [-60] with an RGB value of [0] [70] [120]\nAdd cube at x: [-30] y: [-20] z: [-60] with an RGB value of [0] [70] [120]\nAdd Lava at x: [-50] y: [-20] z: [-60] with a RGB value of: [200] [0] [0]\nAdd cube at x: [-90] y: [-20] z: [-60] with an RGB value of [0] [70] [120]\nAdd Lava at x: [-110] y: [-20] z: [-60] with a RGB value of: [200] [0] [0]\nAdd cube at x: [-130] y: [-20] z: [-40] with an RGB value of [0] [70] [120]\nAdd cube at x: [-130] y: [-20] z: [0] with an RGB value of [0] [70] [120]\nAdd Lava at x: [-130] y: [-20] z: [20] with a RGB value of: [200] [0] [0]\nadd [-130] to [flag x v]\nadd [-20] to [flag y v]\nadd [40] to [flag z v]\nAdd cube at x: [-130] y: [-20] z: [40] with an RGB value of [0] [255] [0]\nset [private.rowstartx v] to [-10]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [-30]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [10]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\n\ndefine Level 11\nAdd cube at x: [-10] y: [40] z: [-40] with an RGB value of [0] [70] [120]\nAdd cube at x: [-30] y: [20] z: [-40] with an RGB value of [0] [70] [120]\nAdd cube at x: [-50] y: [0] z: [-40] with an RGB value of [0] [70] [120]\nAdd cube at x: [-70] y: [20] z: [-40] with an RGB value of [0] [70] [120]\nAdd cube at x: [-90] y: [40] z: [-40] with an RGB value of [0] [70] [120]\nAdd cube at x: [10] y: [20] z: [-40] with an RGB value of [0] [70] [120]\nAdd cube at x: [30] y: [0] z: [-40] with an RGB value of [0] [70] [120]\nAdd cube at x: [50] y: [20] z: [-40] with an RGB value of [0] [70] [120]\nAdd cube at x: [70] y: [40] z: [-40] with an RGB value of [0] [70] [120]\nAdd cube at x: [-10] y: [40] z: [160] with an RGB value of [0] [70] [120]\nAdd cube at x: [-30] y: [20] z: [160] with an RGB value of [0] [70] [120]\nAdd cube at x: [-50] y: [0] z: [160] with an RGB value of [0] [70] [120]\nAdd cube at x: [-70] y: [20] z: [160] with an RGB value of [0] [70] [120]\nAdd cube at x: [-90] y: [40] z: [160] with an RGB value of [0] [70] [120]\nAdd cube at x: [10] y: [20] z: [160] with an RGB value of [0] [70] [120]\nAdd cube at x: [30] y: [0] z: [160] with an RGB value of [0] [70] [120]\nAdd cube at x: [50] y: [20] z: [160] with an RGB value of [0] [70] [120]\nAdd cube at x: [70] y: [40] z: [160] with an RGB value of [0] [70] [120]\nset [private.rowstartx v] to [-10]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [-30]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [10]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [30]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [50]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [-50]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [-70]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [70]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\nset [private.rowstartx v] to [-90]\nset [private.rowstarty v] to [-20]\nset [private.rowstartz v] to [100]\nCreate a row of tiles by changing the x: [0] y: [0] and z position: [-20] and loop: [3] with a RGB value of: [0] [100] [0]\n\n@Collisions\n\ndefine check collisions y +\nset [private.stop v] to [0]\nset [private.index v] to [1]\nset [private.index v] to [1]\nrepeat (length of [cube x v])\n    if <(PUBLIC.CamY) > ((item (private.Index) of [cube y v]) - (0))> then\n        if <(PUBLIC.CamY) < ((item (private.Index) of [cube y v]) + (20))> then\n            if <(PUBLIC.CamX) > ((item (private.Index) of [cube x v]) - (0))> then\n                if <(PUBLIC.CamX) < ((item (private.Index) of [cube x v]) + (25))> then\n                    if <(PUBLIC.CamZ) > ((item (private.Index) of [cube z v]) - (0))> then\n                        if <(PUBLIC.CamZ) < ((item (private.Index) of [cube z v]) + (30))> then\n                            set [public.camy v] to ((item (private.Index) of [cube y v]) + (20))\n                            set [private.vely v] to [0]\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [private.index v] by (1)\nend\n\ndefine Controls.\nset [private.velx v] to [0]\nset [private.velz v] to [0]\nif <(Private.OnGround?) = [0]> then\n    change [private.vely v] by (-0.3)\nend\nif <key (space v) pressed?> then\n    if <(Private.OnGround?) = [1]> then\n        set [private.vely v] to [4]\n        start sound [fast-simple-chop-5-6270 v]\n    end\nend\nif <key (up arrow v) pressed?> then\n    change [publc.camrotx v] by (3)\nend\nif <key (down arrow v) pressed?> then\n    change [publc.camrotx v] by (-3)\nend\nif <key (right arrow v) pressed?> then\n    change [publc.camroty v] by (3)\nend\nif <key (left arrow v) pressed?> then\n    change [publc.camroty v] by (-3)\nend\nset [private.velx v] to [0]\nset [private.velz v] to [0]\nif <key (w v) pressed?> then\n    change [private.velx v] by (([sin v] of (PUBLC.CamRotY) ) * (2))\n    change [private.velz v] by (([cos v] of (PUBLC.CamRotY) ) * (2))\nend\nif <key (s v) pressed?> then\n    change [private.velx v] by (([sin v] of (PUBLC.CamRotY) ) * (-2))\n    change [private.velz v] by (([cos v] of (PUBLC.CamRotY) ) * (-2))\nend\nif <key (a v) pressed?> then\n    change [private.velx v] by (([sin v] of ((PUBLC.CamRotY) - (90)) ) * (2))\n    change [private.velz v] by (([cos v] of ((PUBLC.CamRotY) - (90)) ) * (2))\nend\nif <key (d v) pressed?> then\n    change [private.velx v] by (([sin v] of ((PUBLC.CamRotY) + (90)) ) * (2))\n    change [private.velz v] by (([cos v] of ((PUBLC.CamRotY) + (90)) ) * (2))\nend\n\nwhen I receive [tick - player v]\ncheck touching.\nControls.\nMove Player in x by a speed of (private.VelX)\nMove Player in y by a speed of (private.VelY)\nmove player in z by  a speed of (private.VelZ)\nCam detections.\n\ndefine check touching.\nset [private.onground? v] to [0]\nset [private.index v] to [1]\nrepeat (length of [cube x v])\n    if <((PUBLIC.CamY) - (0.2)) > ((item (private.Index) of [cube y v]) - (0))> then\n        if <((PUBLIC.CamY) - (0.2)) < ((item (private.Index) of [cube y v]) + (20))> then\n            if <(PUBLIC.CamX) > ((item (private.Index) of [cube x v]) - (0))> then\n                if <(PUBLIC.CamX) < ((item (private.Index) of [cube x v]) + (20))> then\n                    if <(PUBLIC.CamZ) > ((item (private.Index) of [cube z v]) - (0))> then\n                        if <(PUBLIC.CamZ) < ((item (private.Index) of [cube z v]) + (30))> then\n                            set [private.onground? v] to [1]\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [private.index v] by (1)\nend\n\ndefine Move Player in y by a speed of (speedy)\nrepeat ([abs v] of (speedy) )\n    if <(speedy) > [0]> then\n        change [public.camy v] by (1)\n        Check flag collisions\n        check lava collisions\n        check collisions y -\n    else\n        change [public.camy v] by (-1)\n        Check flag collisions\n        check lava collisions\n        check collisions y +\n    end\n    if <(private.stop) = [1]> then\n        stop [this script v]\n    end\nend\n\ndefine Move Player in x by a speed of (speedx)\nrepeat ([abs v] of (speedx) )\n    if <(speedx) > [0]> then\n        change [public.camx v] by (1)\n        Check flag collisions\n        check lava collisions\n        Check Collisions x -\n    else\n        change [public.camx v] by (-1)\n        Check flag collisions\n        check lava collisions\n        check collisions x +\n    end\nend\n\ndefine check collisions x +\nset [private.index v] to [1]\nrepeat (length of [cube x v])\n    if <(PUBLIC.CamY) > ((item (private.Index) of [cube y v]) - (20))> then\n        if <(PUBLIC.CamY) < ((item (private.Index) of [cube y v]) + (5))> then\n            if <(PUBLIC.CamX) > ((item (private.Index) of [cube x v]) - (0))> then\n                if <(PUBLIC.CamX) < ((item (private.Index) of [cube x v]) + (30))> then\n                    if <(PUBLIC.CamZ) > ((item (private.Index) of [cube z v]) - (0))> then\n                        if <(PUBLIC.CamZ) < ((item (private.Index) of [cube z v]) + (30))> then\n                            set [public.camx v] to ((item (private.Index) of [cube x v]) + (30))\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [private.index v] by (1)\nend\n\ndefine move player in z by  a speed of (speed)\nrepeat ([abs v] of (speed) )\n    if <(speed) > [0]> then\n        change [public.camz v] by (1)\n        Check flag collisions\n        check lava collisions\n        check collisions z -\n    else\n        change [public.camz v] by (-1)\n        Check flag collisions\n        check lava collisions\n        check collisions z +\n    end\nend\n\ndefine check collisions z +\nset [private.index v] to [1]\nrepeat (length of [cube x v])\n    if <(PUBLIC.CamY) > ((item (private.Index) of [cube y v]) - (20))> then\n        if <(PUBLIC.CamY) < ((item (private.Index) of [cube y v]) + (5))> then\n            if <(PUBLIC.CamX) > ((item (private.Index) of [cube x v]) - (0))> then\n                if <(PUBLIC.CamX) < ((item (private.Index) of [cube x v]) + (20))> then\n                    if <(PUBLIC.CamZ) > ((item (private.Index) of [cube z v]) - (0))> then\n                        if <(PUBLIC.CamZ) < ((item (private.Index) of [cube z v]) + (30))> then\n                            set [public.camz v] to ((item (private.Index) of [cube z v]) + (30))\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [private.index v] by (1)\nend\n\ncheck collisions z +\n\ndefine check collisions z -\nset [private.index v] to [1]\nrepeat (length of [cube x v])\n    if <(PUBLIC.CamY) > ((item (private.Index) of [cube y v]) - (20))> then\n        if <(PUBLIC.CamY) < ((item (private.Index) of [cube y v]) + (5))> then\n            if <(PUBLIC.CamX) > ((item (private.Index) of [cube x v]) - (0))> then\n                if <(PUBLIC.CamX) < ((item (private.Index) of [cube x v]) + (20))> then\n                    if <(PUBLIC.CamZ) > ((item (private.Index) of [cube z v]) - (10))> then\n                        if <(PUBLIC.CamZ) < ((item (private.Index) of [cube z v]) + (30))> then\n                            set [public.camz v] to ((item (private.Index) of [cube z v]) + (-10))\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [private.index v] by (1)\nend\n\ndefine Check Collisions x -\nset [my variable v] to [0]\nset [private.index v] to [1]\nrepeat (length of [cube x v])\n    if <(PUBLIC.CamY) > ((item (private.Index) of [cube y v]) - (20))> then\n        if <(PUBLIC.CamY) < ((item (private.Index) of [cube y v]) + (5))> then\n            if <(PUBLIC.CamX) > ((item (private.Index) of [cube x v]) - (10))> then\n                if <(PUBLIC.CamX) < ((item (private.Index) of [cube x v]) + (20))> then\n                    if <(PUBLIC.CamZ) > ((item (private.Index) of [cube z v]) - (0))> then\n                        if <(PUBLIC.CamZ) < ((item (private.Index) of [cube z v]) + (30))> then\n                            set [public.camx v] to ((item (private.Index) of [cube x v]) - (10))\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [private.index v] by (1)\nend\n\ndefine check collisions y -\nset [private.stop v] to [0]\nset [private.index v] to [1]\nset [private.index v] to [1]\nrepeat (length of [cube x v])\n    if <(PUBLIC.CamY) > ((item (private.Index) of [cube y v]) - (20))> then\n        if <(PUBLIC.CamY) < ((item (private.Index) of [cube y v]) + (20))> then\n            if <(PUBLIC.CamX) > ((item (private.Index) of [cube x v]) - (0))> then\n                if <(PUBLIC.CamX) < ((item (private.Index) of [cube x v]) + (20))> then\n                    if <(PUBLIC.CamZ) > ((item (private.Index) of [cube z v]) - (0))> then\n                        if <(PUBLIC.CamZ) < ((item (private.Index) of [cube z v]) + (20))> then\n                            set [public.camy v] to ((item (private.Index) of [cube y v]) - (20))\n                            set [private.vely v] to [0]\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [private.index v] by (1)\nend\n\nif <(PUBLIC.CamY) > [-5]> then\n\ndefine Cam detections.\nif <(PUBLIC.CamY) < [-200]> then\n    broadcast (Respawn v)\nend\nif <(PUBLC.CamRotX) < [-90]> then\n    set [publc.camrotx v] to [-90]\nend\nif <(PUBLC.CamRotX) > [90]> then\n    set [publc.camrotx v] to [90]\nend\n\ndefine Check flag collisions\nset [private.index v] to [1]\nrepeat (length of [flag x v])\n    if <(PUBLIC.CamY) > ((item (private.Index) of [flag y v]) - (20))> then\n        if <(PUBLIC.CamY) < ((item (private.Index) of [flag y v]) + (25))> then\n            if <(PUBLIC.CamX) > ((item (private.Index) of [flag x v]) - (10))> then\n                if <(PUBLIC.CamX) < ((item (private.Index) of [flag x v]) + (20))> then\n                    if <(PUBLIC.CamZ) > ((item (private.Index) of [flag z v]) - (0))> then\n                        if <(PUBLIC.CamZ) < ((item (private.Index) of [flag z v]) + (20))> then\n                            start sound [success_bell-6776 v]\n                            broadcast (Next Level v)\n                            stop [this script v]\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [private.index v] by (1)\nend\n\ndefine check lava collisions\nset [my variable v] to [0]\nset [private.index v] to [1]\nrepeat (length of [lava x v])\n    if <(PUBLIC.CamY) > ((item (private.Index) of [lava y v]) - (20))> then\n        if <(PUBLIC.CamY) < ((item (private.Index) of [lava y v]) + (25))> then\n            if <(PUBLIC.CamX) > ((item (private.Index) of [lava x v]) - (5))> then\n                if <(PUBLIC.CamX) < ((item (private.Index) of [lava x v]) + (23))> then\n                    if <(PUBLIC.CamZ) > ((item (private.Index) of [lava z v]) - (0))> then\n                        if <(PUBLIC.CamZ) < ((item (private.Index) of [lava z v]) + (20))> then\n                            broadcast (Respawn v)\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [private.index v] by (1)\nend\n\nwhen I receive [start game v]\nforever\n    if <(Private.OnGround?) = [1]> then\n        if <<<<key (w v) pressed?> or <key (d v) pressed?>> or <key (a v) pressed?>> or <key (s v) pressed?>> then\n            start sound (join [step ] (pick random (1) to (2)))\n            wait (0.2) seconds\n        end\n    end\nend\n\n@Slide\n\nwhen I receive [next level v]\nwait (4) seconds\nshow\nswitch costume to (big v)\npoint in direction (90)\ngo to x: (-660) y: (0)\nswitch costume to (costume1 v)\nstart sound [fast-simple-chop-5-6270 v]\nrepeat ([abs v] of (((0) - (x position)) / (6)) )\n    switch costume to (big v)\n    change x by ([abs v] of (((0) - (x position)) / (6)) )\n    switch costume to (costume1 v)\n    if <(x position) > [-1]> then\n        wait (1) seconds\n        broadcast (start game v)\n        start sound [fast-simple-chop-5-6270 v]\n        repeat ([abs v] of (((660) - (x position)) / (6)) )\n            switch costume to (big v)\n            change x by ([abs v] of (((660) - (x position)) / (6)) )\n            switch costume to (costume1 v)\n            if <(x position) > [580]> then\n                hide\n                stop [this script v]\n            end\n        end\n    end\nend\n\nwhen flag clicked\nhide\n\n@Menu\n\nwhen flag clicked\nhide\nbroadcast (Menu v)\n\nwhen I receive [menu v]\nswitch costume to (background v)\ncreate clone of (_myself_ v)\nswitch costume to (font v)\ncreate clone of (_myself_ v)\nswitch costume to (play button v)\ncreate clone of (_myself_ v)\nswitch costume to (slide v)\ncreate clone of (_myself_ v)\nswitch costume to (screenshot 2024-02-10 110419 v)\n\nwhen I start as a clone\nshow\nif < (costume [name v]) contains [Slide]?> then\n    repeat (10)\n        hide\n    end\nend\nif < (costume [name v]) contains [Background]?> then\n    go to x: (0) y: (0)\nend\nif < (costume [name v]) contains [Font]?> then\n    go to x: (-400) y: (100)\n    repeat ([abs v] of (((0) - (x position)) / (6)) )\n        switch costume to (big v)\n        change x by (((0) - (x position)) / (6))\n        switch costume to (font v)\n    end\nend\nif < (costume [name v]) contains [Play Button]?> then\n    go to x: (400) y: (-50)\n    repeat ([abs v] of (((0) - (x position)) / (6)) )\n        switch costume to (big v)\n        change x by (((0) - (x position)) / (6))\n        switch costume to (play button v)\n    end\nend\n\nwhen I start as a clone\nshow\nif < (costume [name v]) contains [Play Button]?> then\n    forever\n        if <touching (mouse-pointer v)?> then\n            change size by (((130) - (size)) / (6))\n            if <mouse down?> then\n                broadcast (StartGameSlide v) and wait\n            end\n        else\n            change size by (((100) - (size)) / (6))\n        end\n    end\nend\n\nwhen I receive [startgameslide v]\nif < (costume [name v]) contains [Slide]?> then\n    show\n    switch costume to (big v)\n    point in direction (90)\n    go to x: (-660) y: (0)\n    switch costume to (slide v)\n    repeat ([abs v] of (((0) - (x position)) / (6)) )\n        switch costume to (big v)\n        change x by ([abs v] of (((0) - (x position)) / (6)) )\n        switch costume to (slide v)\n        if <(x position) > [-1]> then\n            wait (1) seconds\n            broadcast (start game v)\n            repeat ([abs v] of (((660) - (x position)) / (6)) )\n                switch costume to (big v)\n                change x by ([abs v] of (((660) - (x position)) / (6)) )\n                switch costume to (slide v)\n                if <(x position) > [460]> then\n                    hide\n                    delete this clone\n                end\n            end\n            hide\n            delete this clone\n        end\n    end\nend\n\nwhen I receive [start game v]\nif <not < (costume [name v]) contains [Slide]?>> then\n    delete this clone\nend\n\n@Timer\n\nwhen I start as a clone\nshow\nforever\n    point in direction (90)\n    Round (timer) to the nearest [10]\n    if <not < (private.Return) contains [.]?>> then\n        set [private.return v] to (join (private.Return) [.0])\n    end\n    change size by (((300) - (size)) / (6))\n    switch costume to (join [Number ] (letter (private.Index) of (private.Return)))\n    wait (0.1) seconds\n    if <(PUBLIC.NEXTLEVEL) = [1]> then\n        stop [this script v]\n    end\nend\n\nwhen I receive [startgameslide v]\nset [public.nextlevel v] to [0]\nwait (2.5) seconds\nreset timer\nhide\nswitch costume to (random v)\ngo to x: (-20) y: (150)\nset size to (300) %\nset [private.index v] to [0]\nrepeat (10)\n    change [private.index v] by (1)\n    create clone of (_myself_ v)\n    change x by (20)\nend\nswitch costume to (random v)\n\nwhen I receive [next level v]\nif < (costume [name v]) contains [Random]?> then\n    wait (7) seconds\n    set [public.nextlevel v] to [0]\n    reset timer\n    hide\n    go to x: (-20) y: (150)\n    set size to (300) %\n    set [private.index v] to [0]\n    repeat (10)\n        change [private.index v] by (1)\n        create clone of (_myself_ v)\n        change x by (20)\n    end\nend\n\ndefine Round (number) to the nearest (decimal)\nset [private.return v] to ((round ((number) * (decimal))) / (decimal))\n\nwhen I receive [next level v]\n\nwhen I receive [next level v]\nif < (costume [name v]) contains [Number]?> then\n    set [public.nextlevel v] to [1]\n    set [private.prevcostume. v] to (costume [name v])\n    go to center y\n    wait (2) seconds\n    start sound [fast-simple-chop-5-6270 v]\n    repeat ([abs v] of (((-200) - (y position)) / (6)) )\n        switch costume to (big v)\n        change y by (((-200) - (y position)) / (6))\n        switch costume to (private.PrevCostume.)\n        if <(y position) < [-199]> then\n            delete this clone\n        end\n    end\nend\n\ndefine go to center y\nstart sound [fast-simple-chop-5-6270 v]\nrepeat ([abs v] of (((0) - (y position)) / (6)) )\n    switch costume to (big v)\n    change y by (((0) - (y position)) / (6))\n    switch costume to (private.PrevCostume.)\n    if <(y position) < [0.5]> then\n        stop [this script v]\n    end\nend\n\nbroadcast (Next Level v)\n\n@Level counter\n\nwhen I start as a clone\nshow\nforever\n    switch costume to (join [Number ] (PUBLIC.LEVEL))\n    wait (0.1) seconds\nend\n\nwhen I receive [startgameslide v]\nwait (2.5) seconds\nshow\ngo to x: (-100) y: (150)\ncreate clone of (_myself_ v)\nswitch costume to (level sign v)\ngo to x: (-180) y: (150)\nset size to (300) %\n\nwhen flag clicked\nhide\n\n@Center\n\nwhen flag clicked\ngo to x: (0) y: (0)\n\n@Music\n\nwhen flag clicked\nforever\n    set volume to (50) %\n    play sound [summer-adventures-115949 v] until done\nend\n\n@Thumbnail\n\nwhen flag clicked\ngo to [front v] layer\nset [ghost v] effect to (100)\nswitch costume to (font v)\n\n
------------------------------Platformer3D-----------------------------\n\nGuys what are y'all doing playing this old project? play my new demo here: https://scratch.mit.edu/projects/992534211/\n\n it can run on scratch but it is a whole ton smoother here: https://turbowarp.org/964498652?hqpen\n\nBlock count: 2.7K.\n\nProject type: Platformer\n\nDimensions: 3\n\n❤️ and/or ⭐ for a 3D battleship or a 3D floor is lava\nTry this https://scratch.mit.edu/projects/914817109/\n\n---------------------------INSTRUCTIONS---------------------------\n\nMove: WASD.\n\nRotate: Arrow keys.\n\nJump: Space.\n\nwhat to do? jump on the platforms and jump over the lava blocks. Get to the bright green checkpoint at the end to get to the next level.\n\nComment your time for each level! \n\nIt ends at level 11.\n\nadd to 20 studios to make me happy xD\n\n------------------------------CREDITS---------------------------------\nThanks to @CodingBio for the tutorial\nthanks to @-Rex-Test- and @Geotale for the triangle renderer\nBinary Insertion Sort (implementation): @ggenije\nThanks to pixabay for the sound effects\nThanks  SergePavkinMusic for the music which I found on pixabay.\nThanks to @The_Wonderful_Goose for some bug fixes\n\nTags(Ignore)\n#Platformer #3D #Platformer3D #Games #Trending #All #Platformer #Blocks #Games #All#Games#All#Games#All