Platformer
@Stage\n\nwhen I receive [スタート v]\nset [start v] to [1]\nwait until <(hidden) = [3]>\nnext costume\nwait (0.5) seconds\nFade (3)\nnext costume\nwait (0.5) seconds\nbroadcast (Show Settings v)\nFade (4)\nwait until <(level) = [2]>\nnext costume\nwait (0.5) seconds\nFade (2)\nnext costume\nwait (0.5) seconds\nFade (3)\nwait until <(level) = [3]>\nnext costume\nwait (0.5) seconds\nFade (2)\nnext costume\nwait (0.5) seconds\nFade (3)\nwait until <(level) = [4]>\nnext costume\nwait (0.5) seconds\nFade (2)\nwait until <(level) = [5]>\nnext costume\nwait (0.5) seconds\nFade (2)\nnext costume\nwait (0.5) seconds\nFade (3)\nwait until <(level) = [6]>\nnext costume\nwait (0.5) seconds\nFade (2)\nnext costume\nwait (0.5) seconds\nFade (3)\nwait until <(level) = [7]>\nnext costume\nwait (0.5) seconds\nFade (2)\nnext costume\nwait (0.5) seconds\nFade (3)\nwait until <(level) = [8]>\nnext costume\nwait (0.5) seconds\nFade (2)\nnext costume\nwait (0.5) seconds\nFade (3)\n\nwhen flag clicked\nforever\n    play sound (pick random (1) to (2)) until done\nend\n\n@3D Engine\n\nwhen flag clicked\nset [level v] to [1]\nset [start v] to [0]\nset [pause v] to [0]\nset [mouse? v] to [0]\nset [playerview? v] to [0]\nerase all\nreset\nwait until <(start) = [1]>\nforever\n    if <(pause) = [0]> then\n        erase all\n        ReadKeys\n        Decay (0.93)\n        set cam (0) (lookX) (0)\n        change [gravity v] by (-10)\n        move (xz) (gravity) (zz)\n        LoopThroughCubesAndCollide\n        moveObjects\n        Interact\n        teleportPlayer\n        change [lookx v] by (horAcc)\n        change [looky v] by (vertAcc)\n        change [lookz v] by (rollAcc)\n        if <([abs v] of (lookY) ) > [80]> then\n            change [looky v] by ((0) - (vertAcc))\n            set [vertacc v] to [0]\n        end\n        set cam (lookY) (lookX) (0)\n        render (length of [pointx v]) points\n        ConnectPoints\n        if <(PlayerView?) = [1]> then\n            Set Pen Color to R: (0) G: (220) B: (0)\n            connect point ((length of [pointscreenx v]) - (1)) to point (length of [pointscreenx v])\n            Set Pen Color to R: (0) G: (200) B: (0)\n            go to x: (item ((length of [pointscreenx v]) - (1)) of [pointscreenx v]) y: (item ((length of [pointscreenx v]) - (1)) of [pointscreeny v])\n            set pen size to ((item ((length of [pointscreenx v]) - (1)) of [pointscreensize v]) * (3))\n            pen down\n            pen up\n        end\n    end\nend\n\ndefine None\nadd (x) to [pointx v]\nadd (y) to [pointy v]\nadd (z) to [pointz v]\n\ndefine reset\nresetLists\nAdd Objects\nresetPosAndMove\nresetCamAngles\n\ndefine None\nset [vertacc v] to ((vertAcc) * ((rate) / (1.1)))\nset [horacc v] to ((horAcc) * ((rate) / (1.1)))\nset [rollacc v] to ((rollAcc) * (rate))\nset [moveacc v] to ((moveAcc) * (rate))\nset [sideacc v] to ((SideAcc) * (rate))\n\ndefine None\nset [cosvert v] to ([cos v] of (vert) )\nset [sinvert v] to ([sin v] of (vert) )\nset [coshor v] to ([cos v] of (hor) )\nset [sinhor v] to ([sin v] of (hor) )\nset [cosroll v] to ([cos v] of (roll) )\nset [sinroll v] to ([sin v] of (roll) )\nset [transformx v] to (((CosRoll) * (xx)) + ((SinRoll) * (xy)))\nset [transformy v] to (((CosRoll) * (xy)) - ((SinRoll) * (xx)))\nset [xx v] to (((CosHor) * (transformX)) + ((SinHor) * (xz)))\nset [transformz v] to (((CosHor) * (xz)) - ((SinHor) * (transformX)))\nset [xy v] to (((CosVert) * (transformY)) + ((SinVert) * (transformZ)))\nset [xz v] to (((CosVert) * (transformZ)) - ((SinVert) * (transformY)))\nset [transformx v] to (((CosRoll) * (yx)) + ((SinRoll) * (yy)))\nset [transformy v] to (((CosRoll) * (yy)) - ((SinRoll) * (yx)))\nset [yx v] to (((CosHor) * (transformX)) + ((SinHor) * (yz)))\nset [transformz v] to (((CosHor) * (yz)) - ((SinHor) * (transformX)))\nset [yy v] to (((CosVert) * (transformY)) + ((SinVert) * (transformZ)))\nset [yz v] to (((CosVert) * (transformZ)) - ((SinVert) * (transformY)))\nset [transformx v] to (((CosRoll) * (zx)) + ((SinRoll) * (zy)))\nset [transformy v] to (((CosRoll) * (zy)) - ((SinRoll) * (zx)))\nset [zx v] to (((CosHor) * (transformX)) + ((SinHor) * (zz)))\nset [transformz v] to (((CosHor) * (zz)) - ((SinHor) * (transformX)))\nset [zy v] to (((CosVert) * (transformY)) + ((SinVert) * (transformZ)))\nset [zz v] to (((CosVert) * (transformZ)) - ((SinVert) * (transformY)))\n\ndefine None\ndelete (all) of [pointscreenx v]\ndelete (all) of [pointscreeny v]\ndelete (all) of [pointscreenz v]\ndelete (all) of [pointscreensize v]\nset [loop# v] to [1]\nrepeat until <(loop#) > (number)>\n    set [transformx v] to (item (loop#) of [pointx v])\n    set [transformy v] to (item (loop#) of [pointy v])\n    set [transformz v] to (item (loop#) of [pointz v])\n    if <(PlayerView?) = [0]> then\n        set [camx v] to (posX)\n        set [camy v] to (posY)\n        set [camz v] to (posZ)\n    else\n        set [camx v] to ((posX) + ((xz) * (-5000)))\n        set [camz v] to ((posZ) + ((zz) * (-5000)))\n        set [camy v] to ((posY) + ((yz) * (-5000)))\n    end\n    set [pointdistx v] to ((transformX) - (CamX))\n    set [pointdisty v] to ((transformY) - (CamY))\n    set [pointdistz v] to ((transformZ) - (CamZ))\n    set [transformx v] to (((xx) * (pointDistX)) + (((yx) * (pointDistY)) + ((zx) * (pointDistZ))))\n    set [transformy v] to (((xy) * (pointDistX)) + (((yy) * (pointDistY)) + ((zy) * (pointDistZ))))\n    set [transformz v] to (((xz) * (pointDistX)) + (((yz) * (pointDistY)) + ((zz) * (pointDistZ))))\n    set [transformx v] to (((270) * (transformX)) / (transformZ))\n    set [transformy v] to (((270) * (transformY)) / (transformZ))\n    add (transformZ) to [pointscreenz v]\n    add (transformX) to [pointscreenx v]\n    add (transformY) to [pointscreeny v]\n    add (((round (((540) * (30)) / (transformZ))) * (0.5)) + (0.5)) to [pointscreensize v]\n    change [loop# v] by (1)\nend\nif <(PlayerView?) = [1]> then\n    set [transformx v] to (posX)\n    set [transformy v] to (posY)\n    set [transformz v] to (posZ)\n    set [camx v] to ((posX) + ((xz) * (-5000)))\n    set [camz v] to ((posZ) + ((zz) * (-5000)))\n    set [camy v] to ((posY) + ((yz) * (-5000)))\n    set [pointdistx v] to ((transformX) - (CamX))\n    set [pointdisty v] to ((transformY) - (CamY))\n    set [pointdistz v] to ((transformZ) - (CamZ))\n    set [transformx v] to (((xx) * (pointDistX)) + (((yx) * (pointDistY)) + ((zx) * (pointDistZ))))\n    set [transformy v] to (((xy) * (pointDistX)) + (((yy) * (pointDistY)) + ((zy) * (pointDistZ))))\n    set [transformz v] to (((xz) * (pointDistX)) + (((yz) * (pointDistY)) + ((zz) * (pointDistZ))))\n    set [transformx v] to (((270) * (transformX)) / (transformZ))\n    set [transformy v] to (((270) * (transformY)) / (transformZ))\n    add (transformZ) to [pointscreenz v]\n    add (transformX) to [pointscreenx v]\n    add (transformY) to [pointscreeny v]\n    add (((round (((540) * (100)) / (transformZ))) * (0.5)) + (0.5)) to [pointscreensize v]\n    set [transformx v] to (posX)\n    set [transformy v] to ((posY) - (1000))\n    set [transformz v] to (posZ)\n    set [camx v] to ((posX) + ((xz) * (-5000)))\n    set [camz v] to ((posZ) + ((zz) * (-5000)))\n    set [camy v] to ((posY) + ((yz) * (-5000)))\n    set [pointdistx v] to ((transformX) - (CamX))\n    set [pointdisty v] to ((transformY) - (CamY))\n    set [pointdistz v] to ((transformZ) - (CamZ))\n    set [transformx v] to (((xx) * (pointDistX)) + (((yx) * (pointDistY)) + ((zx) * (pointDistZ))))\n    set [transformy v] to (((xy) * (pointDistX)) + (((yy) * (pointDistY)) + ((zy) * (pointDistZ))))\n    set [transformz v] to (((xz) * (pointDistX)) + (((yz) * (pointDistY)) + ((zz) * (pointDistZ))))\n    set [transformx v] to (((270) * (transformX)) / (transformZ))\n    set [transformy v] to (((270) * (transformY)) / (transformZ))\n    add (transformZ) to [pointscreenz v]\n    add (transformX) to [pointscreenx v]\n    add (transformY) to [pointscreeny v]\n    add (((round (((540) * (100)) / (transformZ))) * (0.5)) + (0.5)) to [pointscreensize v]\nend\n\ndefine ReadKeys\nif <(Mouse?) = [0]> then\n    if <key (up arrow v) pressed?> then\n        change [vertacc v] by (-0.8)\n    end\n    if <key (down arrow v) pressed?> then\n        change [vertacc v] by (0.8)\n    end\n    if <key (right arrow v) pressed?> then\n        change [horacc v] by (-0.8)\n    end\n    if <key (left arrow v) pressed?> then\n        change [horacc v] by (0.8)\n    end\nelse\n    set [vertacc v] to (((mouse y) - (PrevY)) / (-1))\n    if <([abs v] of (mouse x) ) > [235]> then\n        set [horacc v] to ((mouse x) / (-38))\n    else\n        set [horacc v] to (((mouse x) - (prevX)) / (-1))\n    end\n    set [prevx v] to (mouse x)\n    set [prevy v] to (mouse y)\nend\nif <key (d v) pressed?> then\n    change [sideacc v] by (-10)\nend\nif <key (a v) pressed?> then\n    change [sideacc v] by (10)\nend\nif <key (w v) pressed?> then\n    change [moveacc v] by (10)\nend\nif <key (s v) pressed?> then\n    change [moveacc v] by (-10)\nend\nif <key (space v) pressed?> then\n    if <(Collided?) = [1  ]> then\n        set [gravity v] to [200]\n    end\nend\n\ndefine None\nrepeat (number)\n    Add Point at (pick random ((0) - (range)) to (range)) (pick random ((0) - (range)) to (range)) (pick random ((0) - (range)) to (range))\nend\n\ndefine ConnectPoints\nset [object# v] to [1]\nset [loop# v] to [1]\nrepeat until <(object#) > (length of [objects v])>\n    if <[deleted v] contains (object#)?> then\n        change [object# v] by (1)\n        change [loop# v] by (8)\n    end\n    if <(item (object#) of [objects v]) = [Cube]> then\n        if <(item (object#) of [objecttype v]) = [1]> then\n            if <<[interactiveobjects v] contains (object#)?> and <not <[interacted? v] contains (object#)?>>> then\n                Set Pen Color to R: (255) G: (128) B: (0)\n            else\n                Set Pen Color to R: (0) G: (0) B: (255)\n            end\n        else\n            if <(item (object#) of [objecttype v]) = [2]> then\n                Set Pen Color to R: (255) G: (0) B: (0)\n            else\n                if <(item (object#) of [objecttype v]) = [3]> then\n                    Set Pen Color to R: (0) G: (255) B: (0)\n                else\n                    if <(item (object#) of [objecttype v]) = [4]> then\n                        Set Pen Color to R: (255) G: (255) B: (0)\n                    else\n                        Set Pen Color to R: (127) G: (0) B: (255)\n                    end\n                end\n            end\n        end\n        connect point (loop#) to point ((loop#) + (1))\n        connect point ((loop#) + (1)) to point ((loop#) + (2))\n        connect point ((loop#) + (2)) to point ((loop#) + (3))\n        connect point ((loop#) + (3)) to point (loop#)\n        connect point ((loop#) + (4)) to point ((loop#) + (5))\n        connect point ((loop#) + (5)) to point ((loop#) + (6))\n        connect point ((loop#) + (6)) to point ((loop#) + (7))\n        connect point ((loop#) + (7)) to point ((loop#) + (4))\n        connect point ((loop#) + (7)) to point (loop#)\n        connect point ((loop#) + (6)) to point ((loop#) + (1))\n        connect point ((loop#) + (5)) to point ((loop#) + (2))\n        connect point ((loop#) + (4)) to point ((loop#) + (3))\n        change [loop# v] by (8)\n    else\n        if <(item (object#) of [objects v]) = [Pyramid]> then\n            Set Pen Color to R: (255) G: (0) B: (0)\n            connect point (loop#) to point ((loop#) + (1))\n            connect point ((loop#) + (1)) to point ((loop#) + (2))\n            connect point ((loop#) + (2)) to point ((loop#) + (3))\n            connect point ((loop#) + (3)) to point (loop#)\n            connect point (loop#) to point ((loop#) + (4))\n            connect point ((loop#) + (1)) to point ((loop#) + (4))\n            connect point ((loop#) + (2)) to point ((loop#) + (4))\n            connect point ((loop#) + (3)) to point ((loop#) + (4))\n            change [loop# v] by (5)\n        else\n        end\n    end\n    change [object# v] by (1)\nend\n\ndefine None\npen up\nif <not <<(item (1) of [pointscreenz v]) < [10]> and <(item (2) of [pointscreenz v]) < [10]>>> then\n    if <not <<(item (1) of [pointscreenz v]) > [50000]> and <(item (2) of [pointscreenz v]) > [50000]>>> then\n        set [x1 v] to (item (1) of [pointscreenx v])\n        set [y1 v] to (item (1) of [pointscreeny v])\n        set [x2 v] to (item (2) of [pointscreenx v])\n        set [y2 v] to (item (2) of [pointscreeny v])\n        set [size1 v] to (item (1) of [pointscreensize v])\n        set [size2 v] to (item (2) of [pointscreensize v])\n        set [z1 v] to (item (1) of [pointscreenz v])\n        set [z2 v] to (item (2) of [pointscreenz v])\n        set [pointdistzz v] to ((z2) - (z1))\n        if <(z2) < [10]> then\n            set [transformx v] to ((item (1) of [pointx v]) + (((item (2) of [pointx v]) - (item (1) of [pointx v])) * (((10) - (z1)) / (pointDistZZ))))\n            set [transformy v] to ((item (1) of [pointy v]) + (((item (2) of [pointy v]) - (item (1) of [pointy v])) * (((10) - (z1)) / (pointDistZZ))))\n            set [transformz v] to ((item (1) of [pointz v]) + (((item (2) of [pointz v]) - (item (1) of [pointz v])) * (((10) - (z1)) / (pointDistZZ))))\n            set [pointdistx v] to ((transformX) - (CamX))\n            set [pointdisty v] to ((transformY) - (CamY))\n            set [pointdistz v] to ((transformZ) - (CamZ))\n            set [transformx v] to (((xx) * (pointDistX)) + (((yx) * (pointDistY)) + ((zx) * (pointDistZ))))\n            set [transformy v] to (((xy) * (pointDistX)) + (((yy) * (pointDistY)) + ((zy) * (pointDistZ))))\n            set [transformz v] to (((xz) * (pointDistX)) + (((yz) * (pointDistY)) + ((zz) * (pointDistZ))))\n            set [transformx v] to (((270) * (transformX)) / (transformZ))\n            set [transformy v] to (((270) * (transformY)) / (transformZ))\n            set [x2 v] to (transformX)\n            set [y2 v] to (transformY)\n            set [size2 v] to (((round (((540) * (30)) / (transformZ))) * (0.5)) + (0.5))\n        else\n            if <(z1) < [10]> then\n                set [transformx v] to ((item (2) of [pointx v]) - (((item (2) of [pointx v]) - (item (1) of [pointx v])) * (((z2) - (10)) / (pointDistZZ))))\n                set [transformy v] to ((item (2) of [pointy v]) - (((item (2) of [pointy v]) - (item (1) of [pointy v])) * (((z2) - (10)) / (pointDistZZ))))\n                set [transformz v] to ((item (2) of [pointz v]) - (((item (2) of [pointz v]) - (item (1) of [pointz v])) * (((z2) - (10)) / (pointDistZZ))))\n                set [pointdistx v] to ((transformX) - (CamX))\n                set [pointdisty v] to ((transformY) - (CamY))\n                set [pointdistz v] to ((transformZ) - (CamZ))\n                set [transformx v] to (((xx) * (pointDistX)) + (((yx) * (pointDistY)) + ((zx) * (pointDistZ))))\n                set [transformy v] to (((xy) * (pointDistX)) + (((yy) * (pointDistY)) + ((zy) * (pointDistZ))))\n                set [transformz v] to (((xz) * (pointDistX)) + (((yz) * (pointDistY)) + ((zz) * (pointDistZ))))\n                set [transformx v] to (((270) * (transformX)) / (transformZ))\n                set [transformy v] to (((270) * (transformY)) / (transformZ))\n                set [x1 v] to (transformX)\n                set [y1 v] to (transformY)\n                set [size1 v] to (((round (((540) * (30)) / (transformZ))) * (0.5)) + (0.5))\n            end\n        end\n        set [pointdistx v] to ((x2) - (x1))\n        set [pointdisty v] to ((y2) - (y1))\n        set [pointdistz v] to ((size2) - (size1))\n        if <not <<(x1) > [240]> and <(x2) > [240]>>> then\n            if <not <<(x1) < [-240]> and <(x2) < [-240]>>> then\n                if <not <<(y1) > [180]> and <(y2) > [180]>>> then\n                    if <not <<(y1) < [-180]> and <(y2) < [-180]>>> then\n                        Draw to Edge:\n                        set [pointdistx v] to ((x2) - (x1))\n                        set [pointdisty v] to ((y2) - (y1))\n                        set [pointdistz v] to ((size2) - (size1))\n                        go to x: (x1) y: (y1)\n                        set pen size to (size1)\n                        if <([floor v] of ([abs v] of (pointDistZ) ) ) = [0]> then\n                            pen down\n                            go to x: (x2) y: (y2)\n                        else\n                            repeat ([floor v] of ([abs v] of (pointDistZ) ) )\n                                pen down\n                                go to x: ((x position) + ((pointDistX) / ([floor v] of ([abs v] of (pointDistZ) ) ))) y: ((y position) + ((pointDistY) / ([floor v] of ([abs v] of (pointDistZ) ) )))\n                                change pen size by ((pointDistZ) / ([floor v] of ([abs v] of (pointDistZ) ) ))\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\npen up\n\ndefine Draw to Edge:\nif <(x1) < [-240]> then\n    set [x1 v] to [-240]\n    set [y1 v] to ((y2) - ((((x2) - (-240)) / (pointDistX)) * (pointDistY)))\n    set [size1 v] to ((size2) - ((((x2) - (-240)) / (pointDistX)) * (pointDistZ)))\nelse\n    if <(x1) > [240]> then\n        set [x1 v] to [240]\n        set [y1 v] to ((y2) - ((((x2) - (240)) / (pointDistX)) * (pointDistY)))\n        set [size1 v] to ((size2) - ((((x2) - (240)) / (pointDistX)) * (pointDistZ)))\n    end\nend\nif <(x2) < [-240]> then\n    set [x2 v] to [-240]\n    set [y2 v] to ((y1) + ((((-240) - (x1)) / (pointDistX)) * (pointDistY)))\n    set [size2 v] to ((size1) + ((((-240) - (x1)) / (pointDistX)) * (pointDistZ)))\nelse\n    if <(x2) > [240]> then\n        set [x2 v] to [240]\n        set [y2 v] to ((y1) + ((((240) - (x1)) / (pointDistX)) * (pointDistY)))\n        set [size2 v] to ((size1) + ((((240) - (x1)) / (pointDistX)) * (pointDistZ)))\n    end\nend\nif <(y1) < [-180]> then\n    set [y1 v] to [-180]\n    set [x1 v] to ((x2) - ((((y2) - (-180)) / (pointDistY)) * (pointDistX)))\n    set [size1 v] to ((size2) - ((((y2) - (-180)) / (pointDistY)) * (pointDistZ)))\nelse\n    if <(y1) > [180]> then\n        set [y1 v] to [180]\n        set [x1 v] to ((x2) - ((((y2) - (180)) / (pointDistY)) * (pointDistX)))\n        set [size1 v] to ((size2) - ((((y2) - (180)) / (pointDistY)) * (pointDistZ)))\n    end\nend\nif <(y2) < [-180]> then\n    set [y2 v] to [-180]\n    set [x2 v] to ((x1) + ((((-180) - (y1)) / (pointDistY)) * (pointDistX)))\n    set [size2 v] to ((size1) + ((((-180) - (y1)) / (pointDistY)) * (pointDistZ)))\nelse\n    if <(y2) > [180]> then\n        set [y2 v] to [180]\n        set [x2 v] to ((x1) + ((((180) - (y1)) / (pointDistY)) * (pointDistX)))\n        set [size2 v] to ((size1) + ((((180) - (y1)) / (pointDistY)) * (pointDistZ)))\n    end\nend\n\ndefine None\nchange [posx v] by ((x) * (moveAcc))\nchange [posz v] by ((z) * (moveAcc))\nchange [posx v] by (((0) - (z)) * (SideAcc))\nchange [posz v] by ((x) * (SideAcc))\nchange [posy v] by (y)\nif <(posY) < [-20000]> then\n    reset\n    change [attempts v] by (1)\nend\n\ndefine Add Points\n\ndefine resetCamAngles\nset [xx v] to [1]\nset [xy v] to [0]\nset [xz v] to [0]\nset [yy v] to [1]\nset [yx v] to [0]\nset [yz v] to [0]\nset [zz v] to [1]\nset [zx v] to [0]\nset [zy v] to [0]\n\ndefine None\nresetCamAngles\nrot (vert) (hor) (roll)\n\ndefine None\nset pen color to (((r) * (65536)) + (((g) * (256)) + ((b) * (8))))\n\ndefine None\nadd (x) to [cubex v]\nadd (y) to [cubey v]\nadd (z) to [cubez v]\nadd (h) to [cubeh v]\nadd (l) to [cubew v]\nadd (l) to [cubel v]\nadd [Pyramid] to [objects v]\nadd [2] to [objecttype v]\nAdd Point at (x) (y) (z)\nAdd Point at ((x) + (l)) (y) (z)\nAdd Point at ((x) + (l)) (y) ((z) + (l))\nAdd Point at (x) (y) ((z) + (l))\nAdd Point at ((x) + ((l) / (2))) ((y) + (h)) ((z) + ((l) / (2)))\n\ndefine None\nadd (x) to [cubex v]\nadd (y) to [cubey v]\nadd (z) to [cubez v]\nadd (h) to [cubeh v]\nadd (w) to [cubew v]\nadd (l) to [cubel v]\nadd [Cube] to [objects v]\nadd (type) to [objecttype v]\nadd [1] to [movedir v]\nadd [0] to [touchingobject v]\nAdd Point at (x) (y) (z)\nAdd Point at ((x) + (w)) (y) (z)\nAdd Point at ((x) + (w)) (y) ((z) + (l))\nAdd Point at (x) (y) ((z) + (l))\nAdd Point at (x) ((y) + (h)) ((z) + (l))\nAdd Point at ((x) + (w)) ((y) + (h)) ((z) + (l))\nAdd Point at ((x) + (w)) ((y) + (h)) (z)\nAdd Point at (x) ((y) + (h)) (z)\n\ndefine resetLists\ndelete (all) of [pointx v]\ndelete (all) of [pointy v]\ndelete (all) of [pointz v]\ndelete (all) of [objects v]\ndelete (all) of [objecttype v]\ndelete (all) of [cubex v]\ndelete (all) of [cubey v]\ndelete (all) of [cubez v]\ndelete (all) of [cubeh v]\ndelete (all) of [cubew v]\ndelete (all) of [cubel v]\ndelete (all) of [movedir v]\ndelete (all) of [interactiveobjects v]\ndelete (all) of [interacted? v]\ndelete (all) of [deleted v]\ndelete (all) of [touchingobject v]\n\ndefine resetPosAndMove\nset [gravity v] to [0]\nset [vertacc v] to [0]\nset [horacc v] to [0]\nset [rollacc v] to [0]\nset [sideacc v] to [0]\nset [moveacc v] to [0]\nset [posx v] to [0]\nset [posy v] to [6000]\nset [posz v] to [0]\nset [lookx v] to [0]\nset [looky v] to [0]\nset [lookz v] to [0]\n\ndefine LoopThroughCubesAndCollide\nset [loop# v] to [1]\nset [collided? v] to [0]\nrepeat until <(loop#) > (length of [cubex v])>\n    if <[deleted v] contains (loop#)?> then\n        change [loop# v] by (1)\n    end\n    if <<not <(posX) < (item (loop#) of [cubex v])>> and <not <(posX) > ((item (loop#) of [cubex v]) + (item (loop#) of [cubew v]))>>> then\n        if <<not <(posZ) < (item (loop#) of [cubez v])>> and <not <(posZ) > ((item (loop#) of [cubez v]) + (item (loop#) of [cubel v]))>>> then\n            if <<<((posY) - (1000)) > (item (loop#) of [cubey v])> and <((posY) - (1000)) < ((item (loop#) of [cubey v]) + (item (loop#) of [cubeh v]))>> or <<(posY) > (item (loop#) of [cubey v])> and <(posY) < ((item (loop#) of [cubey v]) + (item (loop#) of [cubeh v]))>>> then\n                if <(item (loop#) of [objecttype v]) = [1]> then\n                    if <<((posY) - (1000)) > (item (loop#) of [cubey v])> and <((posY) - (1000)) < ((item (loop#) of [cubey v]) + (item (loop#) of [cubeh v]))>> then\n                        set [collided? v] to [1]\n                    else\n                        set [collided? v] to [-1]\n                    end\n                    set [oldy v] to (posY)\n                    change [posy v] by ((0) - (gravity))\n                    if <(Collided?) = [1]> then\n                        if <((posY) - (1000)) < ((item (loop#) of [cubey v]) + (item (loop#) of [cubeh v]))> then\n                            set [posy v] to (((item (loop#) of [cubey v]) + (item (loop#) of [cubeh v])) + (1000))\n                        end\n                        if <((posY) - (1500)) > (oldY)> then\n                            change [posx v] by ((0) - ((xz) * (moveAcc)))\n                            change [posz v] by ((0) - ((zz) * (moveAcc)))\n                            change [posx v] by ((0) - (((0) - (zz)) * (SideAcc)))\n                            change [posz v] by ((0) - ((xz) * (SideAcc)))\n                            set [posy v] to ((oldY) + (10))\n                            set [moveacc v] to [0]\n                            set [sideacc v] to [0]\n                            set [collided? v] to [0]\n                        end\n                    else\n                        if <(posY) > (item (loop#) of [cubey v])> then\n                            set [posy v] to (item (loop#) of [cubey v])\n                        end\n                    end\n                    set [gravity v] to [0]\n                else\n                    if <(item (loop#) of [objecttype v]) = [3]> then\n                        change [score v] by ([ceiling v] of (((1000) * (level)) / (attempts)) )\n                        change [level v] by (1)\n                        set [attempts v] to [1]\n                        reset\n                    else\n                        if <(item (loop#) of [objecttype v]) = [2]> then\n                            change [attempts v] by (1)\n                            reset\n                        else\n                            if <(item (loop#) of [objecttype v]) = [4]> then\n                                set [gravity v] to [400]\n                            else\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [loop# v] by (1)\nend\n\ndefine Add Objects\nif <(level) = [1]> then\n    Create Cube Left Bottom Corner- X: (-5000) Y: (-2000) Z: (-5000) H: (1000) W: (10000) L: (10000) type: (1)\n    Create Cube Left Bottom Corner- X: (-2000) Y: (-300) Z: (7500) H: (500) W: (4000) L: (4000) type: (1)\n    Create Cube Left Bottom Corner- X: (-5000) Y: (600) Z: (14500) H: (500) W: (4000) L: (4000) type: (1)\n    Create Cube Left Bottom Corner- X: (-14000) Y: (-2200) Z: (15000) H: (500) W: (4000) L: (4000) type: (1)\n    Create Cube Left Bottom Corner- X: (-19000) Y: (-500) Z: (15000) H: (500) W: (4000) L: (4000) type: (1)\n    Create Cube Left Bottom Corner- X: (-19000) Y: (-500) Z: (22000) H: (500) W: (4000) L: (4000) type: (1)\n    Create Cube Left Bottom Corner- X: (-25000) Y: (1250) Z: (23000) H: (500) W: (4000) L: (4000) type: (1)\n    Create Cube Left Bottom Corner- X: (-19000) Y: (2750) Z: (23000) H: (500) W: (4000) L: (4000) type: (1)\n    Create Cube Left Bottom Corner- X: (-19000) Y: (4000) Z: (29000) H: (500) W: (4000) L: (4000) type: (3)\nelse\n    if <(level) = [2]> then\n        Create Cube Left Bottom Corner- X: (-2000) Y: (-2000) Z: (-2000) H: (1000) W: (4000) L: (5750) type: (1)\n        Create Cube Left Bottom Corner- X: (-3000) Y: (-2000) Z: (4000) H: (2000) W: (6000) L: (1000) type: (2)\n        Create Cube Left Bottom Corner- X: (-2000) Y: (-2000) Z: (5250) H: (1000) W: (4000) L: (5000) type: (1)\n        Create Cube Left Bottom Corner- X: (-6000) Y: (-2000) Z: (11500) H: (2000) W: (9000) L: (1500) type: (2)\n        Create Cube Left Bottom Corner- X: (-6000) Y: (-2000) Z: (13250) H: (1000) W: (8000) L: (4000) type: (1)\n        Create Cube Left Bottom Corner- X: (-9000) Y: (-2000) Z: (13250) H: (1000) W: (2000) L: (4000) type: (2)\n        Create Cube Left Bottom Corner- X: (-9000) Y: (-2000) Z: (17250) H: (2000) W: (11000) L: (4000) type: (2)\n        Create Cube Left Bottom Corner- X: (-11000) Y: (-5000) Z: (13250) H: (1000) W: (2000) L: (6000) type: (1)\n        Create Cube Left Bottom Corner- X: (-12000) Y: (-5000) Z: (19500) H: (2000) W: (4000) L: (1000) type: (2)\n        Create Cube Left Bottom Corner- X: (-11000) Y: (-5000) Z: (20750) H: (1000) W: (2000) L: (1750) type: (1)\n        Create Cube Left Bottom Corner- X: (-12000) Y: (-5000) Z: (22750) H: (2000) W: (4000) L: (1000) type: (2)\n        Create Cube Left Bottom Corner- X: (-12000) Y: (-5000) Z: (24000) H: (1000) W: (4000) L: (1000) type: (3)\n    else\n        if <(level) = [3]> then\n            Create Cube Left Bottom Corner- X: (-5000) Y: (-2000) Z: (-5000) H: (1000) W: (10000) L: (10000) type: (1)\n            Create Cube Left Bottom Corner- X: (-8000) Y: (-1000) Z: (-500) H: (1000) W: (1000) L: (1000) type: (1)\n            Create Cube Left Bottom Corner- X: (-10500) Y: (500) Z: (0) H: (1000) W: (1000) L: (1000) type: (1)\n            Create Cube Left Bottom Corner- X: (-10500) Y: (2750) Z: (2500) H: (500) W: (2000) L: (2000) type: (4)\n            Create Cube Left Bottom Corner- X: (-17000) Y: (6000) Z: (6000) H: (500) W: (2000) L: (2000) type: (4)\n            Create Cube Left Bottom Corner- X: (-13000) Y: (8000) Z: (13000) H: (500) W: (2000) L: (2000) type: (4)\n            Create Cube Left Bottom Corner- X: (-5000) Y: (10000) Z: (18000) H: (500) W: (2000) L: (2000) type: (4)\n            Create Cube Left Bottom Corner- X: (5500) Y: (10000) Z: (18000) H: (500) W: (2000) L: (2000) type: (3)\n        else\n            if <(level) = [4]> then\n                Create Cube Left Bottom Corner- X: (-5000) Y: (-2000) Z: (-5000) H: (1000) W: (10000) L: (10000) type: (1)\n                Create Cube Left Bottom Corner- X: (-500) Y: (-1000) Z: (8000) H: (500) W: (1000) L: (1000) type: (1)\n                Create Cube Left Bottom Corner- X: (-500) Y: (-1000) Z: (9000) H: (1000) W: (1000) L: (1000) type: (2)\n                Create Cube Left Bottom Corner- X: (2000) Y: (0) Z: (11000) H: (500) W: (1000) L: (1000) type: (1)\n                Create Cube Left Bottom Corner- X: (2000) Y: (0) Z: (12000) H: (1000) W: (1000) L: (1000) type: (2)\n                Create Cube Left Bottom Corner- X: (-1000) Y: (1000) Z: (13000) H: (500) W: (1000) L: (1000) type: (1)\n                Create Cube Left Bottom Corner- X: (-1000) Y: (1000) Z: (14000) H: (1000) W: (1000) L: (1000) type: (2)\n                Create Cube Left Bottom Corner- X: (-1000) Y: (1000) Z: (17500) H: (1000) W: (1000) L: (1000) type: (4)\n                Create Cube Left Bottom Corner- X: (-10000) Y: (15000) Z: (17500) H: (1000) W: (20000) L: (20000) type: (2)\n                Create Cube Left Bottom Corner- X: (-1000) Y: (8000) Z: (22500) H: (500) W: (1000) L: (1000) type: (1)\n                Create Cube Left Bottom Corner- X: (-1000) Y: (8000) Z: (23500) H: (1000) W: (1000) L: (1000) type: (4)\n                Create Cube Left Bottom Corner- X: (-1000) Y: (9000) Z: (25500) H: (500) W: (1000) L: (1000) type: (3)\n            else\n                if <(level) = [5]> then\n                    Create Cube Left Bottom Corner- X: (-250) Y: (-2000) Z: (-500) H: (1000) W: (500) L: (1000) type: (1)\n                    Create Cube Left Bottom Corner- X: (-250) Y: (-2000) Z: (500) H: (1500) W: (500) L: (1000) type: (1)\n                    Create Cube Left Bottom Corner- X: (-250) Y: (-2000) Z: (1500) H: (2000) W: (500) L: (1000) type: (1)\n                    Create Cube Left Bottom Corner- X: (-250) Y: (-2000) Z: (2500) H: (2500) W: (500) L: (1000) type: (1)\n                    Create Cube Left Bottom Corner- X: (-250) Y: (-2000) Z: (3500) H: (3000) W: (500) L: (1000) type: (1)\n                    Create Cube Left Bottom Corner- X: (-250) Y: (-2000) Z: (4500) H: (3500) W: (500) L: (1000) type: (1)\n                    Create Cube Left Bottom Corner- X: (-1250) Y: (-2000) Z: (5000) H: (4000) W: (1000) L: (500) type: (1)\n                    Create Cube Left Bottom Corner- X: (-2250) Y: (-2000) Z: (5000) H: (4500) W: (1000) L: (500) type: (1)\n                    Create Cube Left Bottom Corner- X: (-3250) Y: (-2000) Z: (5000) H: (5000) W: (1000) L: (500) type: (1)\n                    Create Cube Left Bottom Corner- X: (-4250) Y: (-2000) Z: (5000) H: (5500) W: (1000) L: (500) type: (1)\n                    Create Cube Left Bottom Corner- X: (-5250) Y: (-2000) Z: (5000) H: (6000) W: (1000) L: (500) type: (1)\n                    Create Cube Left Bottom Corner- X: (-6250) Y: (-2000) Z: (5000) H: (6500) W: (1000) L: (500) type: (1)\n                    Create Cube Left Bottom Corner- X: (-6250) Y: (-2000) Z: (2000) H: (8000) W: (500) L: (1000) type: (1)\n                    Create Cube Left Bottom Corner- X: (-6250) Y: (-2000) Z: (1000) H: (10500) W: (500) L: (1000) type: (1)\n                    Create Cube Left Bottom Corner- X: (-6250) Y: (-2000) Z: (0) H: (13000) W: (500) L: (1000) type: (1)\n                    Create Cube Left Bottom Corner- X: (-6250) Y: (11500) Z: (-3000) H: (500) W: (500) L: (1000) type: (4)\n                    Create Cube Left Bottom Corner- X: (-6250) Y: (12500) Z: (-8000) H: (1000) W: (1000) L: (1000) type: (3)\n                else\n                    if <(level) = [6]> then\n                        Create Cube Left Bottom Corner- X: (-5000) Y: (-2000) Z: (-5000) H: (1000) W: (10000) L: (10000) type: (1)\n                        Create Cube Left Bottom Corner- X: (-5000) Y: (-2000) Z: (7000) H: (1000) W: (3000) L: (3000) type: (1)\n                        Create Cube Left Bottom Corner- X: (-10000) Y: (-2000) Z: (23000) H: (1000) W: (10000) L: (10000) type: (1)\n                        Create Cube Left Bottom Corner- X: (-16000) Y: (-2000) Z: (23000) H: (1000) W: (3000) L: (3000) type: (1)\n                        Create Cube Left Bottom Corner- X: (-25000) Y: (-1000) Z: (22000) H: (1250) W: (500) L: (5000) type: (2)\n                        Create Cube Left Bottom Corner- X: (-45000) Y: (-2000) Z: (22000) H: (1000) W: (10000) L: (10000) type: (1)\n                        Create Cube Left Bottom Corner- X: (-45000) Y: (-2000) Z: (2000) H: (1000) W: (1000) L: (20000) type: (1)\n                        Create Cube Left Bottom Corner- X: (-45500) Y: (1000) Z: (2000) H: (1000) W: (2000) L: (20000) type: (2)\n                        Create Cube Left Bottom Corner- X: (-45000) Y: (1000) Z: (15000) H: (3000) W: (1000) L: (1000) type: (2)\n                        Create Cube Left Bottom Corner- X: (-45000) Y: (-2000) Z: (10000) H: (3000) W: (1000) L: (1000) type: (2)\n                        Create Cube Left Bottom Corner- X: (-45000) Y: (0) Z: (5000) H: (3000) W: (1000) L: (1000) type: (2)\n                        Create Cube Left Bottom Corner- X: (-45000) Y: (-2000) Z: (0) H: (3000) W: (1000) L: (1000) type: (3)\n                    else\n                        if <(level) = [7]> then\n                            Create Cube Left Bottom Corner- X: (-750) Y: (-1000) Z: (5000) H: (2250) W: (1500) L: (500) type: (2)\n                            Create Cube Left Bottom Corner- X: (10000000) Y: (-1000) Z: (6500) H: (2250) W: (1500) L: (500) type: (2)\n                            Create Cube Left Bottom Corner- X: (-750) Y: (-1000) Z: (8000) H: (2250) W: (1500) L: (500) type: (2)\n                            Create Cube Left Bottom Corner- X: (-5000) Y: (-2000) Z: (-2000) H: (1000) W: (10000) L: (15000) type: (1)\n                            Create Cube Left Bottom Corner- X: (-500) Y: (-1000) Z: (9500) H: (2000) W: (1000) L: (500) type: (3)\n                            Create Cube Left Bottom Corner- X: (750) Y: (-1000) Z: (5000) H: (2250) W: (500) L: (6000) type: (2)\n                            Create Cube Left Bottom Corner- X: (-1250) Y: (-1000) Z: (5000) H: (2220) W: (500) L: (6000) type: (2)\n                            Create Cube Left Bottom Corner- X: (-750) Y: (-1000) Z: (10500) H: (2250) W: (1500) L: (500) type: (2)\n                            Create Cube Left Bottom Corner- X: (-1250) Y: (1250) Z: (5000) H: (500) W: (2500) L: (6000) type: (2)\n                            Create Cube Left Bottom Corner- X: (7500) Y: (0) Z: (2000) H: (500) W: (11000) L: (7000) type: (1)\n                            Create Cube Left Bottom Corner- X: (9000) Y: (2000) Z: (2000) H: (500) W: (8000) L: (7000) type: (2)\n                            Create Cube Left Bottom Corner- X: (10000) Y: (500) Z: (2000) H: (2000) W: (500) L: (500) type: (2)\n                            Create Cube Left Bottom Corner- X: (10000) Y: (500) Z: (8500) H: (2000) W: (500) L: (500) type: (2)\n                            Create Cube Left Bottom Corner- X: (21500) Y: (0) Z: (4500) H: (500) W: (2000) L: (2000) type: (1)\n                            Create Cube Left Bottom Corner- X: (-9000) Y: (-500) Z: (4500) H: (500) W: (1000) L: (1500) type: (1)\n                            Create Cube Left Bottom Corner- X: (-12000) Y: (0) Z: (1500) H: (500) W: (1000) L: (1500) type: (1)\n                            Create Cube Left Bottom Corner- X: (-15000) Y: (500) Z: (3000) H: (500) W: (1000) L: (1000) type: (1)\n                        else\n                            Create Cube Left Bottom Corner- X: (-5000) Y: (-2000) Z: (-2000) H: (1000) W: (10000) L: (10000) type: (1)\n                            Create Cube Left Bottom Corner- X: (-5000) Y: (-1000) Z: (3000) H: (2500) W: (10000) L: (500) type: (2)\n                            Create Cube Left Bottom Corner- X: (2000) Y: (-1000) Z: (7500) H: (2000) W: (1000) L: (500) type: (5)\n                            Create Cube Left Bottom Corner- X: (2000) Y: (-2000) Z: (20000) H: (1000) W: (3000) L: (3000) type: (1)\n                            Create Cube Left Bottom Corner- X: (4500) Y: (-1000) Z: (20000) H: (2000) W: (500) L: (1000) type: (5)\n                            Create Cube Left Bottom Corner- X: (-6000) Y: (-2000) Z: (20000) H: (1000) W: (3500) L: (3000) type: (1)\n                            Create Cube Left Bottom Corner- X: (-9000) Y: (-2000) Z: (20000) H: (2750) W: (3000) L: (3000) type: (1)\n                            Create Cube Left Bottom Corner- X: (-12000) Y: (-2000) Z: (20000) H: (4750) W: (3000) L: (3000) type: (1)\n                            Create Cube Left Bottom Corner- X: (-15000) Y: (-2000) Z: (20000) H: (6750) W: (3000) L: (3000) type: (1)\n                            Create Cube Left Bottom Corner- X: (-21000) Y: (4750) Z: (19000) H: (1000) W: (3000) L: (3000) type: (1)\n                            Create Cube Left Bottom Corner- X: (-22000) Y: (5750) Z: (13000) H: (1000) W: (3000) L: (3000) type: (1)\n                            Create Cube Left Bottom Corner- X: (-22000) Y: (6750) Z: (7000) H: (1000) W: (3000) L: (3000) type: (1)\n                            Create Cube Left Bottom Corner- X: (-22000) Y: (7750) Z: (1000) H: (1000) W: (3000) L: (3000) type: (1)\n                            Create Cube Left Bottom Corner- X: (-21000) Y: (4500) Z: (19000) H: (1000) W: (3000) L: (3000) type: (2)\n                            Create Cube Left Bottom Corner- X: (-22000) Y: (5500) Z: (13000) H: (1000) W: (3000) L: (3000) type: (2)\n                            Create Cube Left Bottom Corner- X: (-22000) Y: (6500) Z: (7000) H: (1000) W: (3000) L: (3000) type: (2)\n                            Create Cube Left Bottom Corner- X: (-3000) Y: (-1000) Z: (7500) H: (2000) W: (1000) L: (500) type: (5)\n                            Create Cube Left Bottom Corner- X: (-3500) Y: (-1000) Z: (7000) H: (2500) W: (2000) L: (1500) type: (2)\n                            Create Cube Left Bottom Corner- X: (2000) Y: (-2000) Z: (-20000) H: (1000) W: (3000) L: (3000) type: (1)\n                            Create Cube Left Bottom Corner- X: (2500) Y: (-1000) Z: (-20000) H: (2000) W: (500) L: (1000) type: (5)\n                            Create Cube Left Bottom Corner- X: (2500) Y: (-7000) Z: (-25000) H: (1000) W: (3000) L: (3000) type: (4)\n                            Create Cube Left Bottom Corner- X: (2500) Y: (-7000) Z: (-37000) H: (1000) W: (3000) L: (3000) type: (4)\n                            Create Cube Left Bottom Corner- X: (2500) Y: (-7000) Z: (-71000) H: (8000) W: (7000) L: (30000) type: (2)\n                            Create Cube Left Bottom Corner- X: (10500) Y: (-7000) Z: (-71000) H: (8000) W: (7000) L: (30000) type: (2)\n                            Create Cube Left Bottom Corner- X: (9500) Y: (-7000) Z: (-49500) H: (1000) W: (1000) L: (7000) type: (1)\n                            Create Cube Left Bottom Corner- X: (9500) Y: (-6500) Z: (-56500) H: (1000) W: (500) L: (3000) type: (1)\n                            Create Cube Left Bottom Corner- X: (9500) Y: (-6500) Z: (1000000000000000) H: (1500) W: (500) L: (3000) type: (1)\n                            Create Cube Left Bottom Corner- X: (10000) Y: (-6500) Z: (1000000000000) H: (2500) W: (500) L: (3000) type: (1)\n                            Create Cube Left Bottom Corner- X: (10000) Y: (-6500) Z: (-62000) H: (1000) W: (500) L: (3000) type: (3)\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine None\nset [loop# v] to ((((number) - (1)) * (8)) + (1))\nreplace item (number) of [cubex v] with ((item (number) of [cubex v]) + ((x) * (item (number) of [movedir v])))\nreplace item (number) of [cubey v] with ((item (number) of [cubey v]) + ((y) * (item (number) of [movedir v])))\nreplace item (number) of [cubez v] with ((item (number) of [cubez v]) + ((z) * (item (number) of [movedir v])))\nrepeat (8)\n    replace item (loop#) of [pointx v] with ((item (loop#) of [pointx v]) + ((x) * (item (number) of [movedir v])))\n    replace item (loop#) of [pointy v] with ((item (loop#) of [pointy v]) + ((y) * (item (number) of [movedir v])))\n    replace item (loop#) of [pointz v] with ((item (loop#) of [pointz v]) + ((z) * (item (number) of [movedir v])))\n    change [loop# v] by (1)\nend\nif <<not <(posX) < (item (number) of [cubex v])>> and <not <(posX) > ((item (number) of [cubex v]) + (item (number) of [cubew v]))>>> then\n    if <<not <(posZ) < (item (number) of [cubez v])>> and <not <(posZ) > ((item (number) of [cubez v]) + (item (number) of [cubel v]))>>> then\n        if <<<not <((posY) - (1000)) < (item (number) of [cubey v])>> and <not <((posY) - (1000)) > ((item (number) of [cubey v]) + (item (number) of [cubeh v]))>>> or <<(posY) > (item (number) of [cubey v])> and <(posY) < ((item (number) of [cubey v]) + (item (number) of [cubeh v]))>>> then\n            if <(item (number) of [objecttype v]) = [1]> then\n                change [posx v] by ((x) * (item (number) of [movedir v]))\n                change [posy v] by ((y) * (item (number) of [movedir v]))\n                change [posz v] by ((z) * (item (number) of [movedir v]))\n            end\n        end\n    end\nend\nif <<<(item (number) of [cubex v]) > (mx)> or <(item (number) of [cubey v]) > (my)>> or <(item (number) of [cubez v]) > (mz)>> then\n    replace item (number) of [movedir v] with [-1]\nend\nif <<<(item (number) of [cubex v]) < (mx)> or <(item (number) of [cubey v]) < (my)>> or <(item (number) of [cubez v]) < (mz)>> then\n    replace item (number) of [movedir v] with [1]\nend\n\ndefine moveObjects\nif <(level) = [6]> then\n    move object (2) by (0) (0) (100) max (0) (0) (20000) min (-7000) (-7000) (7000)\n    move object (4) by (100) (0) (0) max (-15000) (50000) (50000) min (-35000) (-10000) (0)\n    move object (9) by (0) (100) (0) max (0) (3000) (50000) min (-50000) (-2000) (-50000)\n    move object (10) by (0) (75) (0) max (0) (3000) (50000) min (-50000) (-2000) (-50000)\n    move object (11) by (0) (100) (0) max (0) (3000) (50000) min (-50000) (-2000) (-50000)\nelse\n    if <(level) = [7]> then\n        move object (12) by (200) (0) (200) max (50000) (50000) (8500) min (-50000) (-50000) (2000)\n        move object (13) by (-200) (0) (200) max (50000) (50000) (8500) min (-50000) (-50000) (2000)\n        move object (15) by (0) (0) (40) max (50000) (50000) (4500) min (-50000) (-50000) (1500)\n        move object (16) by (0) (0) (40) max (50000) (50000) (4500) min (-50000) (-50000) (1500)\n    else\n        if <(level) = [8]> then\n            move object (14) by (0) (10) (0) max (50000) (5750) (50000) min (-50000) (4000) (-50000)\n            move object (15) by (0) (10) (0) max (50000) (6750) (50000) min (-50000) (5000) (-50000)\n            move object (16) by (0) (10) (0) max (50000) (7750) (50000) min (-50000) (6000) (-50000)\n        end\n    end\nend\n\ndefine Interact\nif <(level) = [7]> then\n    if touching object (14) then delete object (1)\n    if touching object (17) then delete object (3)\nend\nif <(level) = [8]> then\n    if touching object (13) then delete object (18)\nend\n\ndefine None\nif <not <[interactiveobjects v] contains (number)?>> then\n    add (number) to [interactiveobjects v]\nend\nif <<not <(posX) < (item (number) of [cubex v])>> and <not <(posX) > ((item (number) of [cubex v]) + (item (number) of [cubew v]))>>> then\n    if <<not <(posZ) < (item (number) of [cubez v])>> and <not <(posZ) > ((item (number) of [cubez v]) + (item (number) of [cubel v]))>>> then\n        if <<<not <((posY) - (1000)) < (item (number) of [cubey v])>> and <not <((posY) - (1000)) > ((item (number) of [cubey v]) + (item (number) of [cubeh v]))>>> or <<(posY) > (item (number) of [cubey v])> and <(posY) < ((item (number) of [cubey v]) + (item (number) of [cubeh v]))>>> then\n            if <not <[interacted? v] contains (number)?>> then\n                add (number) to [interacted? v]\n                add (number2) to [deleted v]\n            end\n        end\n    end\nend\n\ndefine None\nif <<not <(posX) < (item (number) of [cubex v])>> and <not <(posX) > ((item (number) of [cubex v]) + (item (number) of [cubew v]))>>> then\n    if <<not <(posZ) < (item (number) of [cubez v])>> and <not <(posZ) > ((item (number) of [cubez v]) + (item (number) of [cubel v]))>>> then\n        if <<<not <((posY) - (1000)) < (item (number) of [cubey v])>> and <not <((posY) - (1000)) > ((item (number) of [cubey v]) + (item (number) of [cubeh v]))>>> or <<(posY) > (item (number) of [cubey v])> and <(posY) < ((item (number) of [cubey v]) + (item (number) of [cubeh v]))>>> then\n            if <(item (number) of [touchingobject v]) = [0]> then\n                replace item (number) of [touchingobject v] with [0]\n                set [posx v] to ((item (number2) of [cubex v]) + ((item (number2) of [cubew v]) / (2)))\n                set [posy v] to ((item (number2) of [cubey v]) + ((item (number2) of [cubeh v]) / (2)))\n                set [posz v] to ((item (number2) of [cubez v]) + ((item (number2) of [cubel v]) / (2)))\n                replace item (number2) of [touchingobject v] with [1]\n            end\n        else\n            if <not <(item (number) of [touchingobject v]) = [0]>> then\n                replace item (number) of [touchingobject v] with [0]\n            end\n        end\n    else\n        if <not <(item (number) of [touchingobject v]) = [0]>> then\n            replace item (number) of [touchingobject v] with [0]\n        end\n    end\nelse\n    if <not <(item (number) of [touchingobject v]) = [0]>> then\n        replace item (number) of [touchingobject v] with [0]\n    end\nend\n\ndefine teleportPlayer\nif <(level) = [8]> then\n    teleport from object (3) to object (5)\n    teleport from object (17) to object (20)\nend\n\ndefine None\nif touching object (number) then teleport to (number2)\nif touching object (number2) then teleport to (number)\n\n@Paused\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\ngo to [front v] layer\nset [ghost v] effect to (30)\nforever\n    if <(pause) = [0]> then\n        hide\n    else\n        set [ghost v] effect to (30)\n        show\n    end\nend\n\nwhen flag clicked\n\n@Cloud\n\ndefine None\ndelete (all) of [usercloudlist v]\ndelete (all) of [users v]\nset [textmarker v] to [1]\nrepeat until <(textMarker) > (length of (text))>\n    set [decodedtext v] to []\n    set [length v] to []\n    repeat (3)\n        set [length v] to (join (length) (letter (textMarker) of (text)))\n        add (letter (textMarker) of (text)) to [usercloudlist v]\n        change [textmarker v] by (1)\n    end\n    repeat (length)\n        add (letter (textMarker) of (text)) to [usercloudlist v]\n        add (letter ((textMarker) + (1)) of (text)) to [usercloudlist v]\n        set [letter# v] to (join (letter (textMarker) of (text)) (letter ((textMarker) + (1)) of (text)))\n        set [decodedtext v] to (join (DecodedText) (letter (letter#) of (char)))\n        change [textmarker v] by (2)\n    end\n    add (DecodedText) to [users v]\nend\n\ndefine encodeUser []\nset [encodedtext v] to []\nset [text# v] to [1]\nset [char# v] to (length of (text))\nset [char1 v] to (letter (1) of (char#))\nset [char2 v] to (letter (2) of (char#))\nset [char3 v] to (letter (3) of (char#))\nif <(length of (char#)) = [1]> then\n    add [0] to [usercloudlist v]\n    add [0] to [usercloudlist v]\n    add (char1) to [usercloudlist v]\nelse\n    if <(length of (char#)) = [2]> then\n        add [0] to [usercloudlist v]\n        add (char1) to [usercloudlist v]\n        add (char2) to [usercloudlist v]\n    else\n        add (char1) to [usercloudlist v]\n        add (char2) to [usercloudlist v]\n        add (char3) to [usercloudlist v]\n    end\nend\nrepeat (length of (text))\n    set [char# v] to [1]\n    repeat until <<(letter (char#) of (char)) = (letter (text#) of (text))> or <(char#) > (length of (char))>>\n        change [char# v] by (1)\n    end\n    if <(char#) > (length of (char))> then\n        set [char# v] to [1]\n    end\n    if <<(char#) > [1]> and <(char#) < [28]>> then\n        switch costume to (cloud v)\n        switch costume to (letter (text#) of (text))\n        if <(costume [number v]) = [27]> then\n            set [char# v] to ((char#) + (26))\n        end\n    end\n    set [char1 v] to (letter (1) of (char#))\n    set [char2 v] to (letter (2) of (char#))\n    if <(length of (char#)) = [1]> then\n        add [0] to [usercloudlist v]\n        add (char1) to [usercloudlist v]\n    else\n        add (char1) to [usercloudlist v]\n        add (char2) to [usercloudlist v]\n    end\n    change [text# v] by (1)\nend\n\nwhen flag clicked\nset [score v] to [0]\nset [attempts v] to [1]\nset [mypos v] to []\nhide\nswitch costume to (cloud v)\ndelete (all) of [usercloudlist v]\ndelete (all) of [scorecloudlist v]\ndelete (all) of [users v]\ndelete (all) of [scores v]\nset [char v] to [ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890~`!@#$%^&*\(\)-_+={}\[\].,?/:;"'|\<>]\nencode Username (username)\ndecodeUsers (☁ UserStorage)\ndecodeScores (☁ ScoreStorage)\nMake Leaderboard\nif <[users v] contains (username)?> then\n    set [mypos v] to [1]\n    repeat until <(item (myPos) of [users v]) = (username)>\n        change [mypos v] by (1)\n    end\nelse\n    wait until <(Score) > (item (item (last) of [ranks v]) of [scores v])>\n    repeat until <not <(myPos) = []>>\n        wait until <(☁ loading) = []>\n        if <(☁ loading) = []> then\n            set [☁ loading v] to (userCode)\n        end\n        decodeUsers (☁ UserStorage)\n        decodeScores (☁ ScoreStorage)\n        if <(Score) > (item (item (last) of [ranks v]) of [scores v])> then\n            wait (0.1) seconds\n            if <(☁ loading) = (userCode)> then\n                delete (item (last) of [ranks v]) of [scores v]\n                delete (item (last) of [ranks v]) of [users v]\n                Encode All Users\n                Encode All Scores\n                if <(☁ loading) = (userCode)> then\n                    encodeUser (username)\n                    encodeScore (Score)\n                    set [☁ userstorage v] to (UserCloudList)\n                    set [☁ scorestorage v] to (ScoreCloudList)\n                    decodeUsers (☁ UserStorage)\n                    decodeScores (☁ ScoreStorage)\n                    set [mypos v] to (length of [users v])\n                    set [☁ loading v] to []\n                end\n            end\n        end\n    end\nend\nMake Leaderboard\nforever\n    if <(Score) > (item (myPos) of [scores v])> then\n        if <(item (myPos) of [users v]) = (username)> then\n            wait until <(☁ loading) = []>\n            if <(☁ loading) = []> then\n                set [☁ loading v] to (userCode)\n            end\n            decodeUsers (☁ UserStorage)\n            decodeScores (☁ ScoreStorage)\n            if <(item (myPos) of [users v]) = (username)> then\n                if <(Score) > (item (item (last) of [ranks v]) of [scores v])> then\n                    wait (0.1) seconds\n                    if <(☁ loading) = (userCode)> then\n                        replace item (myPos) of [scores v] with (Score)\n                        Encode All Scores\n                        if <(☁ loading) = (userCode)> then\n                            set [☁ scorestorage v] to (ScoreCloudList)\n                            decodeUsers (☁ UserStorage)\n                            decodeScores (☁ ScoreStorage)\n                            Make Leaderboard\n                            set [☁ loading v] to []\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nreset timer\nset [timedout? v] to (☁ loading)\nforever\n    if <(☁ loading) = []> then\n        reset timer\n    else\n        if <not <(☁ loading) = (TimedOut?)>> then\n            set [timedout? v] to (☁ loading)\n            reset timer\n        else\n            if <(timer) > [12]> then\n                if <not <(☁ loading) = (userCode)>> then\n                    set [☁ loading v] to []\n                    reset timer\n                end\n            end\n        end\n    end\nend\n\ndefine encode Username []\nset [text# v] to [1]\nset [usercode v] to []\nrepeat (length of (text))\n    set [char# v] to [1]\n    repeat until <<(letter (char#) of (char)) = (letter (text#) of (text))> or <(char#) > (length of (char))>>\n        change [char# v] by (1)\n    end\n    if <(char#) > (length of (char))> then\n        set [char# v] to [1]\n    end\n    if <<(char#) > [1]> and <(char#) < [28]>> then\n        switch costume to (cloud v)\n        switch costume to (letter (text#) of (text))\n        if <(costume [number v]) = [27]> then\n            set [char# v] to ((char#) + (26))\n        end\n    end\n    set [char1 v] to (letter (1) of (char#))\n    set [char2 v] to (letter (2) of (char#))\n    if <(length of (char#)) = [1]> then\n        set [usercode v] to (join (userCode) (join [0] (char1)))\n    else\n        set [usercode v] to (join (userCode) (char#))\n    end\n    change [text# v] by (1)\nend\n\nwhen flag clicked\nforever\n    if <(☁ loading) = (userCode)> then\n        show\n    else\n        hide\n    end\nend\n\ndefine None\nset [nummarker v] to [1]\ndelete (all) of [scorecloudlist v]\ndelete (all) of [scores v]\nrepeat until <(numMarker) > (length of (number))>\n    set [decodednum v] to []\n    set [numlength v] to (letter (numMarker) of (number))\n    add (NumLength) to [scorecloudlist v]\n    change [nummarker v] by (1)\n    repeat (NumLength)\n        set [decodednum v] to (join (decodedNum) (letter (numMarker) of (number)))\n        add (letter (numMarker) of (number)) to [scorecloudlist v]\n        change [nummarker v] by (1)\n    end\n    add (decodedNum) to [scores v]\nend\n\ndefine None\nset [num v] to (length of (number))\nset [num# v] to (letter (1) of (num))\nadd (num#) to [scorecloudlist v]\nset [num# v] to [1]\nrepeat (length of (number))\n    set [num v] to (letter (num#) of (number))\n    add (num) to [scorecloudlist v]\n    change [num# v] by (1)\nend\n\ndefine reset\nset [☁ userstorage v] to []\nset [☁ scorestorage v] to []\ndelete (all) of [scores v]\ndelete (all) of [scorecloudlist v]\ndelete (all) of [users v]\ndelete (all) of [usercloudlist v]\n\ndefine Encode All Scores\ndelete (all) of [scorecloudlist v]\nset [encode# v] to [1]\nrepeat (length of [scores v])\n    encodeScore (item (encode#) of [scores v])\n    change [encode# v] by (1)\nend\n\ndefine Make Leaderboard\ndelete (all) of [ranks v]\nrepeat until <(length of [ranks v]) = (length of [scores v])>\n    set [rank# v] to [1]\n    set [greatest# v] to [0]\n    repeat until <(rank#) > (length of [scores v])>\n        if <<not <[ranks v] contains (rank#)?>> and <(item (rank#) of [scores v]) > (item (greatest#) of [scores v])>> then\n            set [greatest# v] to (rank#)\n        end\n        change [rank# v] by (1)\n    end\n    add (greatest#) to [ranks v]\nend\nset [rank# v] to [1]\ndelete (all) of [leaderboard v]\nrepeat until <(rank#) > (length of [ranks v])>\n    add (join (join (join (item (item (rank#) of [ranks v]) of [users v]) [:]) [ ]) (item (item (rank#) of [ranks v]) of [scores v])) to [leaderboard v]\n    change [rank# v] by (1)\nend\nset [position# v] to [1]\nrepeat until <<(item (position#) of [ranks v]) = (myPos)> or <(position#) > (length of [ranks v])>>\n    change [position# v] by (1)\nend\n\nwhen flag clicked\nforever\n    set [scoredisplay v] to (join [Your Current Score is: ] (Score))\n    set [highest score display v] to (join [Your Highest Score is: ] (item (myPos) of [scores v]))\n    set [leaderboardpos v] to (join [Your Leaderboard Position is: ] (position#))\n    if <(pause) = [0]> then\n        hide variable [scoredisplay v]\n        hide variable [highest score display v]\n        hide variable [leaderboardpos v]\n        show list [leaderboard v]\n    else\n        hide list [leaderboard v]\n        show variable [scoredisplay v]\n        if <[users v] contains (username)?> then\n            show variable [highest score display v]\n            show variable [leaderboardpos v]\n        else\n            hide variable [highest score display v]\n            hide variable [leaderboardpos v]\n        end\n    end\nend\n\nset [level v] to [8]\n\ndefine Upload to Backup\nset [backupscores v] to (☁ ScoreStorage)\nset [backupusers v] to (☁ UserStorage)\n\ndefine download from backup\nset [☁ userstorage v] to (backupUsers)\nset [☁ scorestorage v] to (backupScores)\n\ndefine Encode All Users\ndelete (all) of [usercloudlist v]\nset [encode# v] to [1]\nrepeat (length of [users v])\n    encodeUser (item (encode#) of [users v])\n    change [encode# v] by (1)\nend\n\n@Leaderboard\n\nwhen flag clicked\nhide\nset size to (30) %\ngo to x: (214) y: (147)\nset [ghost v] effect to (100)\n\nwhen I receive [show settings v]\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\nwhen flag clicked\npoint in direction (90)\nforever\n    go to [front v] layer\n    if <(distance to [mouse-pointer v]) < [25]> then\n        set size to (35) %\n    else\n        set size to (30) %\n    end\nend\n\nwhen this sprite clicked\nif <(pause) = [0]> then\n    set [pause v] to [1]\nelse\n    set [pause v] to [0]\nend\nwait (0.5) seconds\n\nwhen flag clicked\nset [level v] to [1]\nset [pause v] to [0]\nforever\n    if <(level) > [8]> then\n        erase all\n        set [pause v] to [1]\n        hide\n    end\nend\n\n@Player\n\ndefine start position\nset size to (70) %\ngo to x: (-204) y: (-55)\nset rotation style [left-right v]\nset [x v] to [0]\nset [y v] to [0]\ngo to [back v] layer\ngo [forward v] (3) layers\n\nwhen flag clicked\nset [stage v] to [1]\nstart position\nhide\nforever\n    if <<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>> then\n        change [x v] by (1)\n        point in direction (90)\n        create clone of (_myself_ v)\n    end\n    if <<key (left arrow v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>> then\n        change [x v] by (-1)\n        point in direction (-90)\n        create clone of (_myself_ v)\n    end\n    set [x v] to ((x) * (0.9))\n    change x by (x)\n    if <touching (stage v)?> then\n        change y by (1)\n        if <touching (stage v)?> then\n            change y by (1)\n            if <touching (stage v)?> then\n                change y by (1)\n                if <touching (stage v)?> then\n                    change y by (1)\n                    if <touching (stage v)?> then\n                        change y by (1)\n                        if <touching (stage v)?> then\n                            change x by ((x) * (-1))\n                            change y by (-5)\n                            if <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> then\n                                start sound [じゃんぷ v]\n                                if <(x) > [0]> then\n                                    set [x v] to [-7]\n                                else\n                                    set [x v] to [7]\n                                end\n                                set [y v] to [15]\n                                change [x v] by (1)\n                            else\n                                set [x v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [y v] by (-1)\n    change y by (y)\n    if <touching (stage v)?> then\n        change y by ((y) * (-1))\n        set [y v] to [0]\n    end\n    change y by (-1)\n    if <<touching (stage v)?> and <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n        start sound [じゃんぷ v]\n        change [y v] by (16)\n    end\n    change y by (1)\n    if <not <(STAGE) = [16]>> then\n        if <(x position) > [200]> then\n            change [stage v] by (1)\n            wait (0.05) seconds\n            start position\n        end\n    end\n    if <<touching (とげ・まぐま v)?> or <(y position) < [-160]>> then\n        start sound [死 v]\n        wait (0.05) seconds\n        start position\n    end\nend\n\nwhen I start as a clone\nswitch costume to (２ v)\nrepeat (7)\n    change size by (-5)\n    change [ghost v] effect by (8)\nend\ndelete this clone\n\nwhen flag clicked\ngo to [front v] layer\nforever\n    if <touching (バネ v)?> then\n        change [x v] by (2)\n    end\nend\n\nwhen flag clicked\nforever\n    hide variable [☁ 世界記録/world record v]\nend\n\nwhen I receive [プラフォ v]\nforever\n    show\nend\n\n@とげ・まぐま\n\nwhen flag clicked\nset size to (100) %\ngo to x: (0) y: (0)\nhide\ngo [backward v] (1) layers\nforever\n    switch costume to (STAGE)\nend\n\nwhen I receive [プラフォ v]\nshow\n\n@Stage\n\nwhen flag clicked\nset [stage v] to [1]\nswitch costume to (コスチューム1 v)\ngo to x: (0) y: (0)\nset size to (100) %\nhide\nforever\n    set [ghost v] effect to (0)\n    switch costume to (STAGE)\nend\n\nwhen flag clicked\ngo to [front v] layer\ngo [backward v] (1) layers\n\n\n\nwhen flag clicked\nforever\n    hide variable [☁ 世界記録/world record v]\n    hide variable [time v]\nend\n\nwhen I receive [プラフォ v]\nshow\n\n@スプライト1\n\nwhen flag clicked\ngo to x: (-100) y: (-25)\nshow\nset [ghost v] effect to (100)\nwait (0.5) seconds\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\nwhen this sprite clicked\nbroadcast (プラフォ v)\nhide\n\nwhen I receive [プラフォ v]\nhide\n\nwhen I receive [３d v]\nhide\n\n@スプライト2\n\nwhen flag clicked\nshow\ngo to x: (100) y: (-25)\nset [ghost v] effect to (100)\nwait (0.5) seconds\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\nwhen I receive [プラフォ v]\nhide\n\nwhen this sprite clicked\nbroadcast (３d v)\n\nwhen I receive [３d v]\nhide\n\nwhen I receive [３d v]\nset [start v] to [1]\n\n@スプライト3\n\nwhen flag clicked\nshow\nset [ghost v] effect to (100)\nwait (0.5) seconds\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\nwhen I receive [３d v]\nhide\n\nwhen I receive [プラフォ v]\nhide\n\n@サムネ\n\nwhen flag clicked\nhide\n\n
~FEATUERD AS WHAT THE COMMUNITY IS LOVING~ TYSM (Feb 15th 2024)\n\nMovement: WASD or Arrow Keys\nmy score is: 68 secs BEAT THAT >:)\nCheck out my new project: \nhttps://scratch.mit.edu/projects/1013705415\nNEW STUDIO: https://scratch.mit.edu/studios/34620431\n\n5 views: ✔\n10 views: ✔\n15 views: ✔\n20 views: ✔\n50 views: ✔\n100 VIEWS (also my followers goal): ✔\n2000 views?:HOW✔\n3k views: impossible without any of you :)✔\n5k?!: ✔\n6k: seriously?!✔\n24k:✔