3d platformer
@Stage\n\n@3D\n\ndefine draw line from (x1) (y1) (z1) to (x2) (y2) (z2)\nset point 1 ((x1) - (CamX)) ((y1) - (CamY)) ((z1) - (CamZ))\nset point 2 ((x2) - (CamX)) ((y2) - (CamY)) ((z2) - (CamZ))\nset point 1 (((z1) * (triangulate4)) + ((x1) * (triangulate2))) (y1) (((z1) * (triangulate2)) - ((x1) * (triangulate4)))\nset point 2 (((z2) * (triangulate4)) + ((x2) * (triangulate2))) (y2) (((z2) * (triangulate2)) - ((x2) * (triangulate4)))\nset point 1 (x1) (((y1) * (triangulate1)) - ((z1) * (triangulate3))) (((y1) * (triangulate3)) + ((z1) * (triangulate1)))\nset point 2 (x2) (((y2) * (triangulate1)) - ((z2) * (triangulate3))) (((y2) * (triangulate3)) + ((z2) * (triangulate1)))\nif <not <<(z1) < (camDist)> and <(z2) < (camDist)>>> then\n    Camera Clipping\n    find position\n    set 2D point1 ((field of view) * ((x1) / (z1))) ((field of view) * ((y1) / (z1)))\n    set 2D point2 ((field of view) * ((x2) / (z2))) ((field of view) * ((y2) / (z2)))\n    go to x: (x1) y: (y1)\n    pen down\n    go to x: (x2) y: (y2)\n    pen up\nend\n\ndefine set point 1 (x1) (y1) (z1)\nset [x1 v] to (x1)\nset [y1 v] to (y1)\nset [z1 v] to (z1)\n\ndefine set point 2 (x2) (y2) (z2)\nset [x2 v] to (x2)\nset [y2 v] to (y2)\nset [z2 v] to (z2)\n\ndefine set 2D point1 (x1) (y1)\nset [x1 v] to (x1)\nset [y1 v] to (y1)\n\ndefine set 2D point2 (x2) (y2)\nset [x2 v] to (x2)\nset [y2 v] to (y2)\n\ndefine find position\nset [triangulate3 v] to ([sin v] of (Rotation X) )\nset [triangulate1 v] to ([cos v] of (Rotation X) )\nset [triangulate4 v] to ([sin v] of (Rotation Y) )\nset [triangulate2 v] to ([cos v] of (Rotation Y) )\n\ndefine Camera Clipping\nif <<(z1) < (camDist)> or <(z2) < (camDist)>> then\n    set [cutlines v] to (((camDist) - (z1)) / ((z2) - (z1)))\n    if <(z1) < (camDist)> then\n        set point 1 ((x1) + (((x2) - (x1)) * (cutlines))) ((y1) + (((y2) - (y1)) * (cutlines))) (camDist)\n    else\n        set point 2 ((x1) + (((x2) - (x1)) * (cutlines))) ((y1) + (((y2) - (y1)) * (cutlines))) (camDist)\n    end\nend\n\ndefine ROTATION AND MOVEMENT (rotation velocity) (friction) (side movement) (move friction)\nif <(mouselooking) = [0]> then\n    set [ryvel v] to (((RYvel) + ((<key (left arrow v) pressed?> * (rotation velocity)) + (<key (right arrow v) pressed?> * ((rotation velocity) * (-1))))) * (friction))\n    change [rotation y v] by (RYvel)\n    set [rxvel v] to (((RXvel) + ((<key (down arrow v) pressed?> * ((rotation velocity) * (-1))) + (<key (up arrow v) pressed?> * (rotation velocity)))) * (friction))\n    change [rotation x v] by (RXvel)\nelse\n    set [rotation y v] to ((mouse x) * (-1))\n    set [rotation x v] to (mouse y)\nend\n\nwhen flag clicked\nerase all\nforever\n    if <(Rotation X) < [-80]> then\n        set [rotation x v] to [-80]\n    end\n    if <(Rotation X) > [80]> then\n        set [rotation x v] to [80]\n    end\nend\n\nwhen flag clicked\nhide\nforever\n    ROTATION AND MOVEMENT [1] [.8] [1.5] [.75]\nend\n\nwhen flag clicked\nforever\n    if <(CamY) < [-300]> then\n        set [xvel v] to [0]\n        set [yvel v] to [0]\n        set [camx v] to [-10]\n        set [camy v] to [100]\n        set [camz v] to [-10]\n        set [rotation x v] to [0]\n        set [rotation y v] to [0]\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Rotation X) < [-80]> then\n        set [rotation x v] to [-79]\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Rotation X) > [80]> then\n        set [rotation x v] to [79]\n    end\nend\n\nwhen I receive [button v]\nswitch costume to (background v)\nset [level v] to [1]\nset [block x v] to [0]\nset [block y v] to [0]\nset [block z v] to [0]\nset pen size to (5)\nset [ghost v] effect to (100)\nset [help with lag v] to [0]\nset [xvel v] to [0]\nset [yvel v] to [0]\nset [camx v] to [-10]\nset [camy v] to [100]\nset [camz v] to [-10]\nset [rotation x v] to [-80]\nset [rotation y v] to [0]\nset [field of view v] to [400]\nforever\n    delete all of [platforms x v]\n    delete all of [platforms y v]\n    delete all of [platforms z v]\n    delete all of [bounce x v]\n    delete all of [bounce y v]\n    delete all of [bounce z v]\n    delete all of [blocks x v]\n    delete all of [blocks y v]\n    delete all of [blocks z v]\n    delete all of [end x v]\n    delete all of [end y v]\n    delete all of [end z v]\n    delete all of [red x v]\n    delete all of [red y v]\n    delete all of [red z v]\n    if <(Level) = [1]> then\n        Draw Block At [] [] [4] type [4]\n        Draw Block At [] [] [] type [1]\n        Draw Block At [] [] [1] type [1]\n        Draw Block At [] [] [2] type [1]\n        Draw Block At [] [] [3] type [1]\n    end\n    if <(Level) = [2]> then\n        Draw Block At [0] [0] [12] type [4]\n        Draw Block At [0] [0] [0] type [1]\n        Draw Block At [1] [0] [0] type [1]\n        Draw Block At [-1] [0] [0] type [1]\n        Draw Block At [0] [0] [1] type [1]\n        Draw Block At [1] [0] [1] type [1]\n        Draw Block At [-1] [0] [1] type [1]\n        Draw Block At [0] [0] [2] type [1]\n        Draw Block At [0] [0] [3] type [1]\n        Draw Block At [1] [0] [3] type [1]\n        Draw Block At [-1] [0] [3] type [1]\n        Draw Block At [0] [0] [4] type [1]\n        Draw Block At [1] [0] [4] type [1]\n        Draw Block At [-1] [0] [4] type [1]\n        Draw Block At [0] [0] [5] type [1]\n        Draw Block At [0] [0] [6] type [1]\n        Draw Block At [0] [0] [7] type [1]\n        Draw Block At [0] [1] [2] type [3]\n        Draw Block At [1] [1] [2] type [3]\n        Draw Block At [-1] [1] [2] type [3]\n        Draw Block At [0] [1] [6] type [3]\n        Draw Block At [1] [1] [6] type [3]\n        Draw Block At [-1] [1] [6] type [3]\n        Draw Block At [0] [0] [7] type [1]\n        Draw Block At [0] [0] [8] type [1]\n        Draw Block At [0] [0] [9] type [1]\n        Draw Block At [0] [0] [10] type [1]\n        Draw Block At [0] [0] [11] type [1]\n    end\n    if <(Level) = [3]> then\n        Draw Block At [] [] [] type [1]\n        Draw Block At [] [] [1] type [1]\n        Draw Block At [] [] [-1] type [1]\n        Draw Block At [1] [] [] type [1]\n        Draw Block At [-1] [] [] type [1]\n        Draw Block At [1] [] [1] type [1]\n        Draw Block At [-1] [] [1] type [1]\n        Draw Block At [1] [] [-1] type [1]\n        Draw Block At [-1] [] [-1] type [1]\n        Draw Block At [] [] [10] type [4]\n        Draw Block At [1] [] [10] type [4]\n        Draw Block At [-1] [] [10] type [4]\n        Draw Block At [] [] [11] type [4]\n        Draw Block At [1] [] [11] type [4]\n        Draw Block At [-1] [] [11] type [4]\n        Draw Block At [] [] [12] type [4]\n        Draw Block At [1] [] [12] type [4]\n        Draw Block At [-1] [] [12] type [4]\n        Draw Block At (movingX) [] [4] type [1]\n        Draw Block At ((movingX) + (1)) [] [4] type [1]\n        Draw Block At ((movingX) - (1)) [] [4] type [1]\n        Draw Block At (movingX) [] [8] type [1]\n        Draw Block At ((movingX) - (1)) [] [8] type [1]\n        Draw Block At ((movingX) - (-1)) [] [8] type [1]\n    end\n    if <(Level) = [4]> then\n        Draw Block At [0] [0] [15] type [1]\n        Draw Block At [1] [0] [15] type [1]\n        Draw Block At [-1] [0] [15] type [1]\n        Draw Block At [1] [0] [16] type [1]\n        Draw Block At [-1] [0] [16] type [1]\n        Draw Block At [0] [0] [17] type [1]\n        Draw Block At [1] [0] [17] type [1]\n        Draw Block At [-1] [0] [17] type [1]\n        Draw Block At [0] [0] (movingZ) type [5]\n        Draw Block At [1] [0] (movingZ) type [5]\n        Draw Block At [-1] [0] (movingZ) type [5]\n        Draw Block At [0] [0] ((movingZ) + (1)) type [5]\n        Draw Block At [0] [0] ((movingZ) + (-1)) type [5]\n        Draw Block At [0] [0] [0] type [1]\n        Draw Block At [0] [0] [1] type [1]\n        Draw Block At [0] [0] [-1] type [1]\n        Draw Block At [1] [0] [1] type [1]\n        Draw Block At [1] [0] [0] type [1]\n        Draw Block At [1] [0] [-1] type [1]\n        Draw Block At [-1] [0] [1] type [1]\n        Draw Block At [-1] [0] [0] type [1]\n        Draw Block At [-1] [0] [-1] type [1]\n        Draw Block At [-1] [1] [17] type [1]\n        Draw Block At [0] [1] [17] type [1]\n        Draw Block At [0] [2] [17] type [1]\n        Draw Block At [1] [3] [17] type [1]\n        Draw Block At [1] [3] [30] type [4]\n        Draw Block At [1] [3] ((movingZ) + (18)) type [5]\n        Draw Block At [1] [3] ((movingZ) + (17)) type [5]\n        Draw Block At [1] [3] ((movingZ) + (16)) type [5]\n    end\n    if <(Level) = [5]> then\n        Draw Block At [0] [0] [0] type [1]\n        Draw Block At [0] [0] [1] type [1]\n        Draw Block At [0] [0] [2] type [1]\n        Draw Block At [0] [0] [3] type [1]\n        Draw Block At [0] [0] [4] type [1]\n        Draw Block At [0] [0] [5] type [1]\n        Draw Block At [0] [0] [6] type [1]\n        Draw Block At [0] [0] [7] type [1]\n        Draw Block At [1] [0] [0] type [1]\n        Draw Block At [1] [0] [1] type [1]\n        Draw Block At [1] [0] [2] type [1]\n        Draw Block At [1] [0] [3] type [1]\n        Draw Block At [1] [0] [4] type [1]\n        Draw Block At [1] [0] [5] type [1]\n        Draw Block At [1] [0] [6] type [1]\n        Draw Block At [1] [0] [7] type [1]\n        Draw Block At [0] [1] [3] type [3]\n        Draw Block At [1] [1] [3] type [3]\n        Draw Block At [0] [1] [6] type [2]\n        Draw Block At [1] [1] [6] type [2]\n        Draw Block At [0] [1] [7] type [1]\n        Draw Block At [1] [1] [7] type [1]\n        Draw Block At [1] [2] [7] type [1]\n        Draw Block At [0] [2] [7] type [1]\n        Draw Block At [1] [3] [7] type [1]\n        Draw Block At [0] [9] [7] type [1]\n        Draw Block At [0] [9] [8] type [4]\n    end\n    if <(Level) = [6]> then\n        Draw Block At [] [] [] type [1]\n        Draw Block At [] [] [1] type [2]\n        Draw Block At [] [10] [3] type [2]\n        Draw Block At [1] [18] [1] type [2]\n        Draw Block At [0] [26] [3] type [2]\n        Draw Block At [] [35] [4] type [4]\n    end\n    if <(Level) = [7]> then\n        Draw Block At [] [18] [28] type [3]\n        Draw Block At [] [16] [25] type [1]\n        Draw Block At [] [16] [26] type [1]\n        Draw Block At [] [16] [27] type [1]\n        Draw Block At [] [17] [28] type [4]\n        Draw Block At [] [17] [27] type [3]\n        Draw Block At [] [8] [24] type [2]\n        Draw Block At [] [] [23] type [2]\n        Draw Block At [] [] [] type [1]\n        Draw Block At [] [] [-1] type [1]\n        Draw Block At [] [] [-2] type [4]\n        Draw Block At [] [] [1] type [1]\n        Draw Block At [] [] [2] type [1]\n        Draw Block At [1] [] [2] type [1]\n        Draw Block At [-1] [] [2] type [1]\n        Draw Block At [] [] [18] type [1]\n        Draw Block At [] [1] [21] type [3]\n        Draw Block At [] [1] [19] type [3]\n        Draw Block At [] [] [20] type [1]\n        Draw Block At [] [] [22] type [1]\n        Draw Block At [] [] ((movingZ) + (1)) type [5]\n        Draw Block At [1] [] ((movingZ) + (1)) type [5]\n        Draw Block At [-1] [] ((movingZ) + (1)) type [5]\n    end\n    if <(Level) = [8]> then\n        Draw Block At [] [] [17] type [1]\n        Draw Block At [] [] [18] type [2]\n        Draw Block At [] [8] [19] type [2]\n        Draw Block At [] [14] [20] type [3]\n        Draw Block At [] [16] [21] type [2]\n        Draw Block At [] [24] [18] type [2]\n        Draw Block At [] [30] [14] type [4]\n        Draw Block At [] [] [] type [1]\n        Draw Block At [] [] [1] type [1]\n        Draw Block At [] [] [2] type [1]\n        Draw Block At [] [] ((movingZ) + (2)) type [5]\n    end\n    if <(Level) = [9]> then\n        broadcast (Finish v)\n    end\nend\n\nwhen I start as a clone\nforever\n    if <(costume [number v]) = [1]> then\n        draw line from (((20) * (Block X)) - (20)) ((20) * (Block Y)) ((Block Z) * (20)) to ((20) * (Block X)) ((20) * (Block Y)) ((Block Z) * (20))\n        draw line from (((20) * (Block X)) - (20)) ((20) * (Block Y)) (((Block Z) * (20)) - (20)) to ((20) * (Block X)) ((20) * (Block Y)) (((Block Z) * (20)) - (20))\n        draw line from (((20) * (Block X)) - (20)) ((20) * (Block Y)) (((Block Z) * (20)) - (20)) to (((20) * (Block X)) - (20)) ((20) * (Block Y)) ((Block Z) * (20))\n        draw line from ((20) * (Block X)) ((20) * (Block Y)) (((Block Z) * (20)) - (20)) to ((20) * (Block X)) ((20) * (Block Y)) ((Block Z) * (20))\n        if <(help with lag) = [0]> then\n            draw line from (((20) * (Block X)) - (20)) (((20) * (Block Y)) - (20)) ((Block Z) * (20)) to ((20) * (Block X)) (((20) * (Block Y)) - (20)) ((Block Z) * (20))\n            draw line from (((20) * (Block X)) - (20)) (((20) * (Block Y)) - (20)) (((Block Z) * (20)) - (20)) to ((20) * (Block X)) (((20) * (Block Y)) - (20)) (((Block Z) * (20)) - (20))\n            draw line from (((20) * (Block X)) - (20)) (((20) * (Block Y)) - (20)) (((Block Z) * (20)) - (20)) to (((20) * (Block X)) - (20)) (((20) * (Block Y)) - (20)) ((Block Z) * (20))\n            draw line from ((20) * (Block X)) (((20) * (Block Y)) - (20)) (((Block Z) * (20)) - (20)) to ((20) * (Block X)) (((20) * (Block Y)) - (20)) ((Block Z) * (20))\n            draw line from ((20) * (Block X)) (((20) * (Block Y)) - (20)) (((Block Z) * (20)) - (20)) to ((20) * (Block X)) ((20) * (Block Y)) (((Block Z) * (20)) - (20))\n            draw line from ((20) * (Block X)) (((20) * (Block Y)) - (20)) ((Block Z) * (20)) to ((20) * (Block X)) ((20) * (Block Y)) ((Block Z) * (20))\n            draw line from (((20) * (Block X)) - (20)) (((20) * (Block Y)) - (20)) (((Block Z) * (20)) - (20)) to (((20) * (Block X)) - (20)) ((20) * (Block Y)) (((Block Z) * (20)) - (20))\n            draw line from (((20) * (Block X)) - (20)) (((20) * (Block Y)) - (20)) ((Block Z) * (20)) to (((20) * (Block X)) - (20)) ((20) * (Block Y)) ((Block Z) * (20))\n        end\n        delete this clone\n    end\nend\n\ndefine Draw Block At (x) (y) (z) type (id)\nif <(id) = [1]> then\n    set pen color to (#0043ff)\n    erase all\n    find position\n    set [block x v] to (x)\n    set [block y v] to (y)\n    set [block z v] to (z)\n    create clone of (_myself_ v)\n    add ((20) * (Block X)) to [blocks x v]\n    add ((20) * (Block Y)) to [blocks y v]\n    add ((20) * (Block Z)) to [blocks z v]\nend\nif <(id) = [2]> then\n    set pen color to (#59ff00)\n    erase all\n    find position\n    set [block x v] to (x)\n    set [block y v] to (y)\n    set [block z v] to (z)\n    create clone of (_myself_ v)\n    add ((20) * (Block X)) to [bounce x v]\n    add ((20) * (Block Y)) to [bounce y v]\n    add ((20) * (Block Z)) to [bounce z v]\nend\nif <(id) = [3]> then\n    set pen color to (#ff0000)\n    erase all\n    find position\n    set [block x v] to (x)\n    set [block y v] to (y)\n    set [block z v] to (z)\n    create clone of (_myself_ v)\n    add ((20) * (Block X)) to [red x v]\n    add ((20) * (Block Y)) to [red y v]\n    add ((20) * (Block Z)) to [red z v]\nend\nif <(id) = [4]> then\n    set pen color to (#faff00)\n    erase all\n    find position\n    set [block x v] to (x)\n    set [block y v] to (y)\n    set [block z v] to (z)\n    create clone of (_myself_ v)\n    add ((20) * (Block X)) to [end x v]\n    add ((20) * (Block Y)) to [end y v]\n    add ((20) * (Block Z)) to [end z v]\nend\nif <(id) = [5]> then\n    set pen color to (#ff7b00)\n    erase all\n    find position\n    set [block x v] to (x)\n    set [block y v] to (y)\n    set [block z v] to (z)\n    create clone of (_myself_ v)\n    add ((20) * (Block X)) to [platforms x v]\n    add ((20) * (Block Y)) to [platforms y v]\n    add ((20) * (Block Z)) to [platforms z v]\nend\n\ndefine Platform (gravity) (jump) (movement) (friction)\nchange [yvel v] by (gravity)\nchange [camy v] by (Yvel)\nset [block# v] to [1]\nset [friction v] to [.7]\nset [move v] to [1]\nrepeat (length of [blocks y v])\n    if <<<(CamY) < ((item (block#) of [blocks y v]) + (40))> and <(CamY) > ((item (block#) of [blocks y v]) + (20))>> and <<<(CamX) > ((item (block#) of [blocks x v]) - (20))> and <(CamX) < (item (block#) of [blocks x v])>> and <<(CamZ) > ((item (block#) of [blocks z v]) - (20))> and <(CamZ) < (item (block#) of [blocks z v])>>>> then\n        set [camy v] to ((item (block#) of [blocks y v]) + (40))\n        set [yvel v] to (<<key (space v) pressed?> and <(Yvel) < [0]>> * (jump))\n        if <key (space v) pressed?> then\n            start sound [jump v]\n        end\n        set [friction v] to [.9]\n        set [move v] to [.5]\n    end\n    change [block# v] by (1)\nend\nset [block# v] to [1]\nrepeat (length of [blocks y v])\n    if <<<(CamY) < ((item (block#) of [blocks y v]) + (20))> and <(CamY) > ((item (block#) of [blocks y v]) - (40))>> and <<<(CamX) > ((item (block#) of [blocks x v]) - (20))> and <(CamX) < (item (block#) of [blocks x v])>> and <<(CamZ) > ((item (block#) of [blocks z v]) - (20))> and <(CamZ) < (item (block#) of [blocks z v])>>>> then\n        set [camy v] to ((item (block#) of [blocks y v]) - (40))\n        set [yvel v] to [0]\n    end\n    change [block# v] by (1)\nend\nset [xvel v] to (((Xvel) + ((<key (d v) pressed?> * (movement)) + (<key (a v) pressed?> * ((movement) * (-1))))) * (friction))\nchange [camz v] by ((1) * ((Xvel) * (triangulate4)))\nchange [camx v] by ((1) * ((Xvel) * (triangulate2)))\nset [block# v] to [1]\nrepeat (length of [blocks x v])\n    if <<<(CamY) < ((item (block#) of [blocks y v]) + (40))> and <(CamY) > (item (block#) of [blocks y v])>> and <<<(CamX) > ((item (block#) of [blocks x v]) - (24))> and <(CamX) < ((item (block#) of [blocks x v]) - (10))>> and <<(CamZ) > ((item (block#) of [blocks z v]) - (20))> and <(CamZ) < (item (block#) of [blocks z v])>>>> then\n        set [camx v] to ((item (block#) of [blocks x v]) - (24))\n        set [xvel v] to [0]\n    end\n    change [block# v] by (1)\nend\nset [block# v] to [1]\nrepeat (length of [blocks x v])\n    if <<<(CamY) < ((item (block#) of [blocks y v]) + (40))> and <(CamY) > (item (block#) of [blocks y v])>> and <<<(CamX) > ((item (block#) of [blocks x v]) - (10))> and <(CamX) < ((item (block#) of [blocks x v]) + (4))>> and <<(CamZ) > ((item (block#) of [blocks z v]) - (20))> and <(CamZ) < (item (block#) of [blocks z v])>>>> then\n        set [camx v] to ((item (block#) of [blocks x v]) + (4))\n        set [xvel v] to [0]\n    end\n    change [block# v] by (1)\nend\nset [zvel v] to (((Zvel) + ((<key (w v) pressed?> * (movement)) + (<key (s v) pressed?> * ((movement) * (-1))))) * (friction))\nchange [camz v] by ((1) * ((Zvel) * (triangulate2)))\nchange [camx v] by ((-1) * ((Zvel) * (triangulate4)))\nset [block# v] to [1]\nrepeat (length of [blocks z v])\n    if <<<(CamY) < ((item (block#) of [blocks y v]) + (40))> and <(CamY) > (item (block#) of [blocks y v])>> and <<<(CamX) > ((item (block#) of [blocks x v]) - (20))> and <(CamX) < (item (block#) of [blocks x v])>> and <<(CamZ) > ((item (block#) of [blocks z v]) - (10))> and <(CamZ) < ((item (block#) of [blocks z v]) + (4))>>>> then\n        set [camz v] to ((item (block#) of [blocks z v]) + (4))\n        set [zvel v] to [0]\n    end\n    change [block# v] by (1)\nend\nset [block# v] to [1]\nrepeat (length of [blocks z v])\n    if <<<(CamY) < ((item (block#) of [blocks y v]) + (40))> and <(CamY) > (item (block#) of [blocks y v])>> and <<<(CamX) > ((item (block#) of [blocks x v]) - (20))> and <(CamX) < (item (block#) of [blocks x v])>> and <<(CamZ) > ((item (block#) of [blocks z v]) - (24))> and <(CamZ) < ((item (block#) of [blocks z v]) - (10))>>>> then\n        set [camz v] to ((item (block#) of [blocks z v]) - (24))\n        set [zvel v] to [0]\n    end\n    change [block# v] by (1)\nend\nset [block# v] to [1]\nrepeat (length of [bounce y v])\n    if <<<(CamY) < ((item (block#) of [bounce y v]) + (40))> and <(CamY) > (item (block#) of [bounce y v])>> and <<<(CamX) > ((item (block#) of [bounce x v]) - (20))> and <(CamX) < (item (block#) of [bounce x v])>> and <<(CamZ) > ((item (block#) of [bounce z v]) - (20))> and <(CamZ) < (item (block#) of [bounce z v])>>>> then\n        set [yvel v] to [15]\n        start sound [bouncer v]\n    end\n    change [block# v] by (1)\nend\nset [block# v] to [1]\nrepeat (length of [red y v])\n    if <<<(CamY) < ((item (block#) of [red y v]) + (40))> and <(CamY) > (item (block#) of [red y v])>> and <<<(CamX) > ((item (block#) of [red x v]) - (20))> and <(CamX) < (item (block#) of [red x v])>> and <<(CamZ) > ((item (block#) of [red z v]) - (20))> and <(CamZ) < (item (block#) of [red z v])>>>> then\n        broadcast (Restart v)\n    end\n    change [block# v] by (1)\nend\nset [block# v] to [1]\nrepeat (length of [end y v])\n    if <<<(CamY) < ((item (block#) of [end y v]) + (40))> and <(CamY) > (item (block#) of [end y v])>> and <<<(CamX) > ((item (block#) of [end x v]) - (20))> and <(CamX) < (item (block#) of [end x v])>> and <<(CamZ) > ((item (block#) of [end z v]) - (20))> and <(CamZ) < (item (block#) of [end z v])>>>> then\n        broadcast (Level Complete v)\n        start sound [level end v]\n    end\n    change [block# v] by (1)\nend\nrepeat (length of [red y v])\n    if <<<(CamY) < ((item (block#) of [red y v]) + (40))> and <(CamY) > (item (block#) of [red y v])>> and <<<(CamX) > ((item (block#) of [red x v]) - (20))> and <(CamX) < (item (block#) of [red x v])>> and <<(CamZ) > ((item (block#) of [red z v]) - (20))> and <(CamZ) < (item (block#) of [red z v])>>>> then\n        broadcast (Restart v)\n    end\n    change [block# v] by (1)\nend\nset [block# v] to [1]\nrepeat (length of [platforms y v])\n    if <<<(CamY) < ((item (block#) of [platforms y v]) + (40))> and <(CamY) > (item (block#) of [platforms y v])>> and <<<(CamX) > ((item (block#) of [platforms x v]) - (23))> and <(CamX) < ((item (block#) of [platforms x v]) + (3))>> and <<(CamZ) > ((item (block#) of [platforms z v]) - (23))> and <(CamZ) < ((item (block#) of [platforms z v]) + (3))>>>> then\n        set [camy v] to ((item (block#) of [platforms y v]) + (40))\n        set [yvel v] to (<<key (space v) pressed?> and <(Yvel) < [0]>> * (jump))\n        change [camz v] by (ZPvel)\n        if <key (space v) pressed?> then\n            start sound [jump v]\n        end\n    end\n    change [block# v] by (1)\nend\n\nset [camy v] to ((item (block#) of [bounce y v]) + (40))\n\nwhen I receive [level complete v]\nset [xvel v] to [0]\nset [yvel v] to [0]\nset [camx v] to [-10]\nset [camy v] to [100]\nset [camz v] to [-10]\nset [rotation x v] to [0]\nset [rotation y v] to [0]\nchange [level v] by (1)\n\nwhen I receive [button v]\nset [gamemode v] to [0]\nforever\n    if <(Gamemode) = [0]> then\n        Platform [-.5] [8] (Move) (Friction)\n    end\nend\n\nwhen I receive [restart v]\nset [xvel v] to [0]\nset [yvel v] to [0]\nset [camx v] to [-10]\nset [camy v] to [100]\nset [camz v] to [-10]\nset [rotation x v] to [0]\nset [rotation y v] to [0]\n\nset [level v] to [5]\n\nwhen I receive [button v]\nset [movingx v] to [-1]\nforever\n    repeat (2)\n        wait (1) seconds\n        change [movingx v] by (1)\n    end\n    repeat (2)\n        wait (1) seconds\n        change [movingx v] by (-1)\n    end\nend\n\nswitch costume to (lag reducer2 v)\n\nset [gamemode v] to [0]\n\nwhen I receive [button v]\nset [movingz v] to [3]\nforever\n    repeat (100)\n        change [movingz v] by (.1)\n        set [zpvel v] to [2]\n    end\n    repeat (100)\n        change [movingz v] by (-.1)\n        set [zpvel v] to [-2]\n    end\nend\n\nset [camz v] to [290]\n\nwhen I receive [finish v]\nstop [other scripts in sprite v]\nbroadcast (real fin v)\n\ndefine renderXY: (x) (y) (renderammount)\nset [helperx1 v] to (((((renderammount) * (triangulate2)) - ((x) * (triangulate4))) * (x)) * ())\nset [helperx2 v] to (((((renderammount) * (triangulate2)) - ((x) * (triangulate4))) * (x)) * ())\n\n@extras\n\nwhen flag clicked\nstart sound [\[8-BIT_One_Republic_-_Counting_Stars v]\nhide\nset [stage v] to [1]\nset [cloneid v] to [1]\ncreate clone of (_myself_ v)\nset [cloneid v] to [2]\ncreate clone of (_myself_ v)\nwait (1) seconds\nset [cloneid v] to [3]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nshow\nif <(CLONEID) = [1]> then\n    go to x: (3) y: (104)\n    show\n    switch costume to (coollogo_com-130184099 v)\n    set size to (1) %\n    point in direction (90)\n    repeat (11)\n        change size by (9)\n    end\n    forever\n        repeat (10)\n            turn right (1) degrees\n        end\n        repeat (10)\n            turn right (-1) degrees\n        end\n    end\nelse\n    if <(CLONEID) = [2]> then\n        show\n        switch costume to (coollogo_com-182861151 v)\n        go to x: (6) y: (-207)\n        set [xv v] to [44]\n        repeat (30)\n            change y by (xv)\n            set [xv v] to ((xv) * (0.8))\n        end\n        wait until <(STAGE) = [2]>\n        delete this clone\n    else\n        if <(CLONEID) = [3]> then\n            show\n            switch costume to (costume1 v)\n            go to x: (-2) y: (-108)\n            set size to (10) %\n            repeat (45)\n                change size by (2)\n            end\n            forever\n                if <<touching (mouse-pointer v)?> and <mouse down?>> then\n                    broadcast (start v)\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [start v]\nstop all sounds\nstop [other scripts in sprite v]\nbroadcast (Button v)\ndelete this clone\n\nwhen I receive [button v]\nforever\n    play sound [\[8-BIT_One_Republic_-_Counting_Stars v] until done\nend\n\nwhen I receive [real fin v]\nerase all\nshow\ngo to [front v] layer\nswitch costume to (costume3 v)\nreset timer\nforever\n    go to x: (([sin v] of ((timer) * (1000)) ) + (98)) y: ([cos v] of ((timer) * (1000)) )\nend\n\n@thumbnail\n\nwhen flag clicked\nforever\n    show\n    go to [front v] layer\n    set [ghost v] effect to (100)\nend\n\n@lag reducer\n\nwhen flag clicked\nforever\n    show\n    go to [front v] layer\nend\n\n@Sprite1\n\nwhen flag clicked\nset [mouselooking v] to [0]\nhide\n\nwhen I receive [button v]\nshow\ngo to [front v] layer\nset [mouselooking v] to [0]\nforever\n    switch costume to (mouselooking)\n    if <touching (mouse-pointer v)?> then\n        set [ghost v] effect to (40)\n        if <mouse down?> then\n            if <(mouselooking) = [0]> then\n                set [mouselooking v] to [1]\n            else\n                set [mouselooking v] to [0]\n            end\n            wait until <not <mouse down?>>\n        end\n    else\n        set [ghost v] effect to (0)\n    end\nend\n\n
-------------------------instructions----------------------------\n•WASD to move\n•arrow keys to look around, or, when mouse looking is on, use the mouse :P\n•space to jump\n•the objective is to get to the yellow box to finish the level.\n•the red kills you\n•the green is bounce-pad\n•orange is moving platform\n\n•if you think I should add anything else, say so in the comments.\n------------------------------------------------------------------\n\n\nif its lagging a lot, play on forkphorus: https://forkphorus.github.io/#397892347\n------------------------------------------------------------------