3D Pen Platformer

Instructions: This platformer is 90% pen! Simply click the green (sadly not pen) flag. Some computers are a little lagy. sorry.\nINSTRUCTIONS:\nArrow keys to look, W.A.S.D to move around. Don't touch red (DUH) Green is finish. Orange is bouncy. White is speed. \nIMPORTANT!!!\nPress settings to change modes, including the experimental VR mode. (warning, only works with a camera, probably not with an actual VR)\n\nSorry its short. Any levels made by YOU will be added to this game! There is a tutorial inside on how to do this! So get making and post your link below!\n\n@MathMathMath for the tutorial\n\nUse https://forkphorus.github.io/app.html?id=347270189 \nto get rid of lag. VR doesn't work on it though.\n\n\n\n\n\n\n\n\n\n\n\n#3D #3d #pen #platformer #neon #trigonometry #hard #yeet #VR #controls #rotation #x #y #z #spidertest

@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop2 v)\nforever\n    play sound [Unstoppable v] until done\nend\n\nwhen I receive [backdrop v]\nswitch backdrop to (backdrop1 v)\n\n@Sprite1\n\nwhen flag clicked\npoint in direction (0)\nturn video (on-flipped v)\nset video transparency to (100)\ngo to x: (0) y: (0)\nhide\nforever\n    point in direction (video (direction v) on (this sprite v))\n    if <(video (motion v) on (this sprite v)) > [10]> then\n        move ((video (motion v) on (this sprite v)) / (20)) steps\n    end\nend\n\n@game\n\ndefine Go to x: (x) y: (y) z: (z) with shift\ngo to x: ((view factor) * (((x) - (cam x)) / ((z) - (cam z)))) y: ((view factor) * (((y) - (cam y)) / ((z) - (cam z))))\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 Screen Point 1 (x1) (y1)\nset [x1 v] to (x1)\nset [y1 v] to (y1)\n\ndefine Set Screen Point 2 (x2) (y2)\nset [x2 v] to (x2)\nset [y2 v] to (y2)\n\ndefine Draw Line (x1) (y1) (z1) to (x2) (y2) (z2)\nif <(shadow?) = [0]> then\n    set pen (brightness v) to (100)\nelse\n    set pen (brightness v) to ((20000) / ([sqrt v] of (((((cam x) - (x1)) * ((cam x) - (x2))) + (((cam y) - (y1)) * ((cam y) - (y2)))) + (((cam z) - (z1)) * ((cam z) - (z2)))) ))\nend\nset point 1 ((x1) - (cam x)) ((y1) - (cam y)) ((z1) - (cam z))\nset point 2 ((x2) - (cam x)) ((y2) - (cam y)) ((z2) - (cam z))\nset point 1 (((z1) * (Sin X)) + ((x1) * (cos X))) (y1) (((z1) * (cos X)) - ((x1) * (Sin X)))\nset point 2 (((z2) * (Sin X)) + ((x2) * (cos X))) (y2) (((z2) * (cos X)) - ((x2) * (Sin X)))\nset point 1 (x1) (((y1) * (cos Y)) - ((z1) * (Sin Y))) (((y1) * (Sin Y)) + ((z1) * (cos Y)))\nset point 2 (x2) (((y2) * (cos Y)) - ((z2) * (Sin Y))) (((y2) * (Sin Y)) + ((z2) * (cos Y)))\nif <not <<(z1) < (near plane)> and <(z2) < (near plane)>>> then\n    z clipping\n    Set Screen Point 1 ((view factor) * ((x1) / (z1))) ((view factor) * ((y1) / (z1)))\n    Set Screen Point 2 ((view factor) * ((x2) / (z2))) ((view factor) * ((y2) / (z2)))\n    X Y Clipping\n    go to x: (x1) y: (y1)\n    pen down\n    go to x: (x2) y: (y2)\n    pen up\nend\n\ndefine X Y Clipping\nset [m v] to (((y2) - (y1)) / ((x2) - (x1)))\nif <(x1) > [240]> then\n    if <(x2) > [240]> then\n        stop [this script v]\n    else\n        Set Screen Point 1 (240) ((y1) + (((240) - (x1)) * (M)))\n    end\nend\nif <(y1) > [180]> then\n    if <(y2) > [180]> then\n        stop [this script v]\n    else\n        Set Screen Point 1 ((x1) + (((180) - (y1)) / (M))) (180)\n    end\nend\nif <(x1) < [-240]> then\n    if <(x2) < [-240]> then\n        stop [this script v]\n    else\n        Set Screen Point 1 (-240) ((y1) + (((-240) - (x1)) * (M)))\n    end\nend\nif <(y1) < [-180]> then\n    if <(y2) < [-180]> then\n        stop [this script v]\n    else\n        Set Screen Point 1 ((x1) + (((-180) - (y1)) / (M))) (-180)\n    end\nend\nif <(x2) > [240]> then\n    Set Screen Point 2 (240) ((y1) + (((240) - (x1)) * (M)))\nend\nif <(y2) > [180]> then\n    Set Screen Point 2 ((x1) + (((180) - (y1)) / (M))) (180)\nend\nif <(x2) < [-240]> then\n    Set Screen Point 2 (-240) ((y1) + (((-240) - (x1)) * (M)))\nend\nif <(y2) < [-180]> then\n    Set Screen Point 2 ((x1) + (((-180) - (y1)) / (M))) (-180)\nend\n\ndefine Calculate Trig Values\nset [move z v] to [0]\nset [movex v] to [0]\nset [sin x v] to ([sin v] of (rot X) )\nset [cos x v] to ([cos v] of (rot X) )\nset [sin y v] to ([sin v] of (rot Y) )\nset [cos y v] to ([cos v] of (rot Y) )\n\ndefine ------ (input)\n\ndefine z clipping\nif <<(z1) < (near plane)> or <(z2) < (near plane)>> then\n    set [percent v] to (((near plane) - (z1)) / ((z2) - (z1)))\n    if <(z1) < (near plane)> then\n        set point 1 ((x1) + (((x2) - (x1)) * (Percent))) ((y1) + (((y2) - (y1)) * (Percent))) (near plane)\n    else\n        if <(z2) < (near plane)> then\n            set point 2 ((x1) + (((x2) - (x1)) * (Percent))) ((y1) + (((y2) - (y1)) * (Percent))) (near plane)\n        end\n    end\nend\n\nwhen flag clicked\nset [mouse control? v] to [0]\nset [cube twist v] to [0]\nforever\n    change [cam y v] by (cam y vel)\n    if <not <<(username) = [kaylorb]> and <key (u v) pressed?>>> then\n        change [cam y vel v] by (-1)\n    end\n    if <(cam y) < [-1000]> then\n        set [xv v] to [0]\n        set [cam y vel v] to [0]\n        set [turn y v] to [0]\n        set [turn x v] to [0]\n        switch costume to (costume3 v)\n        set [near plane v] to [49]\n        set [rot x v] to [0]\n        set [rot y v] to [0]\n        set [cam z v] to [-200]\n        set [cam x v] to [200]\n        set [camspeed v] to [4]\n        set [cam y v] to [0]\n        set [near plane v] to [10]\n    end\n    change [cam z v] by (zv)\n    change [cam x v] by (xv)\n    set [xv v] to ((xv) * (0.91))\n    set [zv v] to ((zv) * (0.91))\n    set [view factor v] to (FOV)\nend\n\ndefine draw cube x: (x) y: (y) z: (z) XL: (xl) YL: (yl:) ZL: (zl) color (color)\nif <not <<(color) = [green]> or <<(color) = [yellow]> or <(color) = [red]>>>> then\n    if <<<<(cam x) < (((x) + (xl)) + (25))> and <(cam x) > ((x) - (75))>> and <<(cam z) < (((z) + (zl)) + (25))> and <(cam z) > ((z) - (75))>>> and <<(cam y) > (((yl:) + (y)) + (10))> and <(cam y) < (((yl:) + (y)) + (50))>>> then\n        if <not <<(cam y) = (((yl:) + (y)) + (49))> or <(cam y) > (((yl:) + (y)) + (49))>>> then\n            repeat until <(cam y) > (((yl:) + (y)) + (50))>\n                change [cam y v] by (0.01)\n            end\n        end\n        set [cam y vel v] to [0]\n        change [cam y v] by (0)\n        if <key (space v) pressed?> then\n            set [cam y vel v] to [20]\n            change [cam y v] by (cam y vel)\n            change [cam y vel v] by (-0.5)\n        end\n        if <(color) = [blueZ]> then\n            change [cam z v] by (change Z)\n        end\n        if <(color) = [blueX]> then\n            change [cam x v] by (change X)\n        end\n        if <(color) = [white]> then\n            change [xv v] by ((xv) / (8))\n            change [zv v] by ((zv) / (8))\n        end\n    end\nend\nif <<<<(cam x) < ((x) + (xl))> and <(cam x) > ((x) - (50))>> and <<(cam z) < ((z) + (zl))> and <(cam z) > ((z) - (50))>>> and <<not <(cam y) > (((yl:) + (y)) + (0))>> and <not <(cam y) < ((y) + (-50))>>>> then\n    if <(color) = [green]> then\n        broadcast (next level v)\n        change [level v] by (1)\n        set [xv v] to [0]\n        set [cam y vel v] to [0]\n        set [turn y v] to [0]\n        set [turn x v] to [0]\n        switch costume to (costume3 v)\n        set [near plane v] to [49]\n        set [view factor v] to [150]\n        set [rot x v] to [0]\n        set [rot y v] to [0]\n        set [cam z v] to [-200]\n        set [cam x v] to [200]\n        set [camspeed v] to [4]\n        set [cam y v] to [0]\n        set [near plane v] to [10]\n    else\n        if <(color) = [red]> then\n            set [xv v] to [0]\n            set [cam y vel v] to [0]\n            set [turn y v] to [0]\n            set [turn x v] to [0]\n            switch costume to (costume3 v)\n            set [near plane v] to [49]\n            set [view factor v] to [150]\n            set [rot x v] to [0]\n            set [rot y v] to [0]\n            set [cam z v] to [-200]\n            set [cam x v] to [200]\n            set [camspeed v] to [4]\n            set [cam y v] to [0]\n            set [near plane v] to [10]\n        else\n            if <(color) = [yellow]> then\n                set [cam y vel v] to [30]\n                change [cam y v] by (cam y vel)\n                change [cam y vel v] by (-0.5)\n            else\n                get off wall (x) (y) (z) (xl) (yl:) (zl)\n            end\n        end\n    end\nelse\n    if <<<(color) = [blue]> or <(color) = [blueX]>> or <(color) = [blueZ]>> then\n        set pen color to (#179fd7)\n    else\n        if <(color) = [green]> then\n            set pen color to (#17ff1d)\n        else\n            if <(color) = [yellow]> then\n                set pen color to (#ff8e27)\n            else\n                if <(color) = [red]> then\n                    set pen color to (#ff1717)\n                else\n                    set pen color to (#ffffff)\n                end\n            end\n        end\n    end\nend\n------ [back of cube1]\nDraw Line (((xl) + (x)) + (cube twist)) ((yl:) + (y)) ((-50) + (z)) to (((xl) + (x)) - (cube twist)) ((-50) + (y)) ((-50) + (z))\nDraw Line (((-50) + (x)) - (cube twist)) ((-50) + (y)) ((-50) + (z)) to (((-50) + (x)) + (cube twist)) ((yl:) + (y)) ((-50) + (z))\nDraw Line (((xl) + (x)) + (cube twist)) ((yl:) + (y)) ((-50) + (z)) to (((-50) + (x)) + (cube twist)) ((yl:) + (y)) ((-50) + (z))\nDraw Line (((xl) + (x)) - (cube twist)) ((-50) + (y)) ((-50) + (z)) to (((-50) + (x)) - (cube twist)) ((-50) + (y)) ((-50) + (z))\n------ [front of cube1]\nDraw Line (((xl) + (x)) + (cube twist)) ((yl:) + (y)) ((zl) + (z)) to (((xl) + (x)) - (cube twist)) ((-50) + (y)) ((zl) + (z))\nDraw Line (((-50) + (x)) - (cube twist)) ((-50) + (y)) ((zl) + (z)) to (((-50) + (x)) + (cube twist)) ((yl:) + (y)) ((zl) + (z))\nDraw Line (((xl) + (x)) - (cube twist)) ((-50) + (y)) ((zl) + (z)) to (((-50) + (x)) - (cube twist)) ((-50) + (y)) ((zl) + (z))\nDraw Line (((xl) + (x)) + (cube twist)) ((yl:) + (y)) ((zl) + (z)) to (((-50) + (x)) + (cube twist)) ((yl:) + (y)) ((zl) + (z))\n------ [top of cube]\nDraw Line (((xl) + (x)) + (cube twist)) ((yl:) + (y)) ((zl) + (z)) to (((xl) + (x)) + (cube twist)) ((yl:) + (y)) ((-50) + (z))\nDraw Line (((-50) + (x)) + (cube twist)) ((yl:) + (y)) ((zl) + (z)) to (((-50) + (x)) + (cube twist)) ((yl:) + (y)) ((-50) + (z))\n------ [bottom of cube]\nDraw Line (((xl) + (x)) - (cube twist)) ((-50) + (y)) ((zl) + (z)) to (((xl) + (x)) - (cube twist)) ((-50) + (y)) ((-50) + (z))\nDraw Line (((-50) + (x)) - (cube twist)) ((-50) + (y)) ((zl) + (z)) to (((-50) + (x)) - (cube twist)) ((-50) + (y)) ((-50) + (z))\nset [linex v] to (x)\nset [linex2 v] to ((x) + (xl))\n\ndefine Render\nCalculate Trig Values\nif <(level) = [1]> then\n    draw cube x: (0) y: (400) z: (700) XL: (150) YL: (0) ZL: (150) color [yellow]\n    draw cube x: (0) y: (700) z: (400) XL: (150) YL: (0) ZL: (150) color [blue]\n    draw cube x: (100) y: (600) z: (70) XL: (150) YL: (0) ZL: (150) color [blue]\n    draw cube x: (-660) y: (100) z: (700) XL: (150) YL: (0) ZL: (150) color [blue]\n    draw cube x: (-300) y: (300) z: (670) XL: (150) YL: (0) ZL: (150) color [blue]\n    draw cube x: (-300) y: (-60) z: (670) XL: (150) YL: (0) ZL: (150) color [blue]\n    draw cube x: (-400) y: (0) z: (300) XL: (150) YL: (0) ZL: (150) color [blue]\n    draw cube x: (-260) y: (-200) z: (0) XL: (150) YL: (0) ZL: (150) color [blue]\n    draw cube x: (200) y: (-100) z: (-220) XL: (150) YL: (0) ZL: (150) color [blue]\n    draw cube x: (200) y: (300) z: (-220) XL: (150) YL: (0) ZL: (150) color [green]\nelse\n    if <(level) = [2]> then\n        draw cube x: (250) y: (-50) z: (750) XL: (150) YL: (400) ZL: (100) color [blue]\n        draw cube x: (400) y: (-50) z: (600) XL: (0) YL: (250) ZL: (0) color [blue]\n        draw cube x: (300) y: (-50) z: (600) XL: (0) YL: (200) ZL: (0) color [blue]\n        draw cube x: (250) y: (-50) z: (450) XL: (0) YL: (100) ZL: (0) color [blue]\n        draw cube x: (150) y: (-50) z: (300) XL: () YL: (0) ZL: (0) color [blue]\n        draw cube x: (440) y: (500) z: (600) XL: (0) YL: (0) ZL: (0) color [blue]\n        draw cube x: (500) y: (600) z: (600) XL: (0) YL: (0) ZL: (0) color [green]\n        draw cube x: (200) y: (0) z: (0) XL: (100) YL: (0) ZL: (100) color [blue]\n        draw cube x: (200) y: (-100) z: (-200) XL: (100) YL: (0) ZL: (100) color [blue]\n    else\n        if <(level) = [3]> then\n            draw cube x: (100) y: (1100) z: (-200) XL: (0) YL: (0) ZL: (0) color [green]\n            draw cube x: (300) y: (700) z: (-500) XL: (30) YL: (30) ZL: (30) color [yellow]\n            draw cube x: (0) y: (1000) z: (-400) XL: (300) YL: (0) ZL: (300) color [blue]\n            draw cube x: (0) y: (-200) z: (-400) XL: (300) YL: (0) ZL: (300) color [blue]\n            draw cube x: (300) y: (-200) z: (70) XL: (30) YL: (30) ZL: (30) color [yellow]\n            draw cube x: (0) y: (200) z: (-400) XL: (300) YL: (0) ZL: (300) color [blue]\n            draw cube x: (0) y: (600) z: (-400) XL: (300) YL: (0) ZL: (300) color [blue]\n            draw cube x: (300) y: (250) z: (-400) XL: () YL: (300) ZL: (200) color [red]\n            draw cube x: (200) y: (250) z: (-300) XL: () YL: (300) ZL: (0) color [red]\n            draw cube x: (250) y: (250) z: (-200) XL: () YL: (300) ZL: (0) color [red]\n            draw cube x: (0) y: (250) z: (-400) XL: (250) YL: (300) ZL: (0) color [red]\n            draw cube x: (150) y: (250) z: (-300) XL: () YL: (300) ZL: (200) color [red]\n            draw cube x: () y: (250) z: (-350) XL: () YL: (300) ZL: (250) color [red]\n            draw cube x: (50) y: (250) z: (-250) XL: (50) YL: (60) ZL: (0) color [red]\n            draw cube x: (50) y: (350) z: (-150) XL: (50) YL: (60) ZL: (0) color [red]\n            draw cube x: (-120) y: (250) z: (70) XL: (30) YL: (30) ZL: (30) color [yellow]\n            Moving Block [0] [650] [-400] [0] [0] [300] Color [red] Z? [0] X? [1] Y? [0] Speed [0.6]\n            Moving Block [460] [650] [-400] [0] [0] [300] Color [red] Z? [0] X? [-1] Y? [0] Speed [0.6]\n            Moving Block [] [650] [-640] [300] [0] [0] Color [red] Z? [1] X? [0] Y? [0] Speed [0.6]\n            Moving Block [] [650] [-150] [300] [0] [0] Color [red] Z? [-1] X? [0] Y? [0] Speed [0.6]\n        else\n            if <(level) = [4]> then\n                Moving Block [400] [300] [1000] [100] [] [100] Color [yellow] Z? [0] X? [-1] Y? [0] Speed [1]\n                Moving Block [-100] [300] [1400] [100] [] [100] Color [yellow] Z? [0] X? [1] Y? [0] Speed [1]\n                Moving Block [400] [300] [1400] [100] [] [100] Color [yellow] Z? [0] X? [-1] Y? [0] Speed [1]\n                draw cube x: [135] y: [300] z: [1600] XL: [100] YL: [] ZL: [100] color [green]\n                draw cube x: (200) y: (-100) z: (-220) XL: (100) YL: (0) ZL: (100) color [blue]\n                draw cube x: [230] y: [-50] z: [] XL: [100] YL: [] ZL: [100] color [yellow]\n                draw cube x: [130] y: [-400] z: [600] XL: [100] YL: [] ZL: [100] color [yellow]\n                draw cube x: [130] y: [400] z: [600] XL: [100] YL: [] ZL: [100] color [yellow]\n                Moving Block [-200] [-300] [550] [100] [] [100] Color [blue] Z? [0] X? [0] Y? [1] Speed [2]\n                Moving Block [-100] [300] [1000] [100] [] [100] Color [yellow] Z? [0] X? [1] Y? [0] Speed [1]\n            else\n                if <(level) = [5]> then\n                    draw cube x: (1100) y: (-100) z: (-220) XL: (200) YL: (0) ZL: (200) color [blue]\n                    Moving Block [1350] [-100] [-180] [100] [0] [100] Color [blueX] Z? [0] X? [1] Y? [0] Speed [1]\n                    draw cube x: [2000] y: [] z: [1200] XL: [100] YL: [] ZL: [200] color [green]\n                    Moving Block [2000] [-100] [500] [100] [0] [100] Color [yellow] Z? [1] X? [0] Y? [0] Speed [1]\n                    Moving Block [2000] [-100] [30] [100] [0] [100] Color [yellow] Z? [1] X? [0] Y? [0] Speed [1]\n                    draw cube x: (1650) y: (-50) z: (-220) XL: (0) YL: (80) ZL: (200) color [red]\n                    draw cube x: (2000) y: (-100) z: (-220) XL: (200) YL: (0) ZL: (200) color [blue]\n                    draw cube x: (1200) y: (-100) z: (-220) XL: (0) YL: (80) ZL: (200) color [red]\n                    Moving Block [450] [-100] [-180] [100] [0] [100] Color [blueX] Z? [0] X? [1] Y? [0] Speed [1]\n                    draw cube x: (200) y: (-100) z: (-220) XL: (200) YL: (0) ZL: (200) color [blue]\n                else\n                    if <(level) = [6]> then\n                        draw cube x: [1990] y: [-600] z: [-1500] XL: [50] YL: [0] ZL: [50] color [green]\n                        set [-i v] to [30]\n                        draw cube x: [1200] y: [-100] z: [-300] XL: [0] YL: [50] ZL: [200] color [yellow]\n                        draw cube x: [350] y: [-100] z: [-300] XL: [600] YL: [0] ZL: [200] color [white]\n                        draw cube x: [100] y: [-100] z: [-300] XL: [200] YL: [0] ZL: [200] color [blue]\n                        draw cube x: [1800] y: [-100] z: [-300] XL: [200] YL: [0] ZL: [200] color [blue]\n                        repeat (5)\n                            draw cube x: [1800] y: [-100] z: ((-300) - (-i)) XL: [0] YL: (-i) ZL: [-20] color [blue]\n                            change [-i v] by (30)\n                        end\n                        repeat (5)\n                            draw cube x: [2000] y: [-100] z: ((-300) - (-i)) XL: [0] YL: (-i) ZL: [-20] color [blue]\n                            change [-i v] by (30)\n                        end\n                        set [-i v] to [0]\n                        repeat (5)\n                            draw cube x: [2000] y: [-100] z: ((-900) - (-i)) XL: [0] YL: (-i) ZL: [-20] color [blue]\n                            change [-i v] by (30)\n                        end\n                    else\n                        if <(level) = [7]> then\n                            Moving Block [-450] [-100] [730] [100] [0] [100] Color [blueX] Z? [0] X? [1] Y? [0] Speed [1]\n                            draw cube x: (200) y: (-100) z: (680) XL: (200) YL: (0) ZL: (200) color [blue]\n                            draw cube x: (200) y: (-100) z: (-220) XL: (200) YL: (0) ZL: (200) color [blue]\n                            draw cube x: (-700) y: (-100) z: (680) XL: (200) YL: (0) ZL: (200) color [blue]\n                            Moving Block [250] [-100] [30] [100] [0] [100] Color [blueZ] Z? [1] X? [0] Y? [0] Speed [1]\n                            draw cube x: (-700) y: (-100) z: (680) XL: (200) YL: (0) ZL: (200) color [blue]\n                            draw cube x: (-675) y: (-100) z: (-270) XL: (150) YL: (0) ZL: (900) color [blue]\n                            Moving Block [-675] [-100] [-170] [150] [100] [100] Color [red] Z? [0] X? [0] Y? [1] Speed [0.5]\n                            Moving Block [-675] [400] [-20] [150] [100] [100] Color [red] Z? [0] X? [0] Y? [-1] Speed [0.5]\n                            Moving Block [-675] [-100] [130] [150] [100] [100] Color [red] Z? [0] X? [0] Y? [1] Speed [0.5]\n                            Moving Block [-675] [400] [280] [150] [100] [100] Color [red] Z? [0] X? [0] Y? [-1] Speed [0.5]\n                            Moving Block [-600] [-50] [280] [150] [100] [100] Color [red] Z? [0] X? [1] Y? [0] Speed [2]\n                            draw cube x: (-675) y: (-30) z: (-270) XL: (150) YL: (0) ZL: (0) color [green]\n                        else\n                            draw cube x: (200) y: (-100) z: (-220) XL: (300) YL: (0) ZL: (200) color [blue]\n                            Draw Line (200) (100) (0) to (200) (0) (0)\n                            Draw Line (200) (100) (0) to (250) (100) (0)\n                            Draw Line (200) (50) (0) to (250) (50) (0)\n                            Draw Line (200) (0) (0) to (250) (0) (0)\n                            Draw Line (300) (100) (0) to (300) (0) (0)\n                            Draw Line (300) (100) (0) to (350) (0) (0)\n                            Draw Line (350) (100) (0) to (350) (0) (0)\n                            Draw Line (400) (100) (0) to (400) (0) (0)\n                            Draw Line (400) (100) (0) to (410) (100) (0)\n                            Draw Line (410) (100) (0) to (430) (80) (0)\n                            Draw Line (430) (80) (0) to (430) (20) (0)\n                            Draw Line (410) (0) (0) to (430) (20) (0)\n                            Draw Line (400) (0) (0) to (410) (0) (0)\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine touch\nmove camra by (1) (1) (1)\n\ndefine move camra by (x) (y) (z)\nchange [xv v] by ((x) / (6))\nchange [zv v] by ((z) / (6))\n\ndefine detector\n\ndefine get off wall (x) (y) (z) (xl) (yl) (zl)\nrepeat until <not <<<<(cam x) < (((x) + (xl)) - (25))> and <(cam x) > ((x) - (-25))>> and <<(cam z) < (((z) + (zl)) + (25))> and <(cam z) > ((z) - (-25))>>> and <<(cam y) > (((yl:) + (y)) + (10))> and <(cam y) < (((yl:) + (y)) + (50))>>>>\n    change [cam x v] by ((xv) / (-0.9))\n    change [cam z v] by ((zv) / (-0.9))\nend\n\nforever\n    if <(level) = [2]> then\n        set [view changer v] to [0]\n        repeat until <not <(level) = [2]>>\n            set [view factor v] to [150]\n            repeat (15)\n                change [view changer v] by (1)\n                change [view factor v] by (view changer)\n            end\n            repeat (15)\n                change [view changer v] by (-1)\n                change [view factor v] by (view changer)\n            end\n            repeat (15)\n                change [view changer v] by (-1)\n                change [view factor v] by (view changer)\n            end\n            repeat (15)\n                change [view changer v] by (1)\n                change [view factor v] by (view changer)\n            end\n        end\n        set [view factor v] to [200]\n    end\n    if <(level) = [3]> then\n        set [view changer v] to [0]\n        repeat until <not <(level) = [3]>>\n            set [cube twist v] to [-20]\n            repeat (10)\n                change [view changer v] by (twist number)\n                change [cube twist v] by (view changer)\n            end\n            repeat (10)\n                change [view changer v] by (() - (twist number))\n                change [cube twist v] by (view changer)\n            end\n            repeat (10)\n                change [view changer v] by (() - (twist number))\n                change [cube twist v] by (view changer)\n            end\n            repeat (10)\n                change [view changer v] by (twist number)\n                change [cube twist v] by (view changer)\n            end\n        end\n        set [cube twist v] to [0]\n    end\nend\n\ndefine Moving Block (x) (y) (z) (xl) (yl) (zl) Color (color) Z? (z?) X? (x?) Y? (y?) Speed (speed)\nif <not <(z?) = [0]>> then\n    set [move z v] to (z?)\nend\nif <not <(x?) = [0]>> then\n    set [movex v] to (x?)\nend\nif <(z?) = [1]> then\n    draw cube x: (x) y: (y) z: (((z) + (Moving)) * (speed)) XL: (xl) YL: (yl) ZL: (zl) color (color)\nelse\n    if <(z?) = [-1]> then\n        draw cube x: (x) y: (y) z: (((z) - (Moving)) * (speed)) XL: (xl) YL: (yl) ZL: (zl) color (color)\n    else\n        if <(x?) = [1]> then\n            draw cube x: (((x) + (Moving)) * (speed)) y: (y) z: (z) XL: (xl) YL: (yl) ZL: (zl) color (color)\n        else\n            if <(x?) = [-1]> then\n                draw cube x: (((x) - (Moving)) * (speed)) y: (y) z: (z) XL: (xl) YL: (yl) ZL: (zl) color (color)\n            else\n                if <(y?) = [-1]> then\n                    draw cube x: (x) y: (((y) - (Moving)) * (speed)) z: (z) XL: (xl) YL: (yl) ZL: (zl) color (color)\n                else\n                    if <(y?) = [1]> then\n                        draw cube x: (x) y: (((y) + (Moving)) * (speed)) z: (z) XL: (xl) YL: (yl) ZL: (zl) color (color)\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nset [moving v] to [0]\nforever\n    set [change x v] to [0]\n    set [change z v] to [0]\n    wait (0) seconds\n    repeat (100)\n        change [moving v] by (5)\n        set [change x v] to ((5) * (MoveX))\n        set [change z v] to ((5) * (Move Z))\n    end\n    set [change x v] to [0]\n    set [change z v] to [0]\n    wait (0) seconds\n    repeat (100)\n        change [moving v] by (-5)\n        set [change x v] to ((-5) * (MoveX))\n        set [change z v] to ((-5) * (Move Z))\n    end\nend\n\nwhen [1 v] key pressed\nif <(Mouse Control?) = [1]> then\n    set [mouse control? v] to [0]\nelse\n    set [mouse control? v] to [1]\nend\n\ndraw cube x: [] y: [] z: [] XL: [] YL: [] ZL: [] color []\n\nMoving Block [] [] [] [] [] [] Color [] Z? [] X? [] Y? [] Speed []\n\nwhen [2 v] key pressed\nif <(VR?) = [1]> then\n    set [vr? v] to [0]\nelse\n    set [vr? v] to [1]\nend\n\nset [moving v] to [0]\nforever\n    set [change x v] to [0]\n    set [change z v] to [0]\n    wait (1) seconds\n    repeat (100)\n        change [moving v] by (5)\n        set [change x v] to ((5) * ())\n        set [change z v] to ((5) * (Move Z))\n    end\n    set [change x v] to [0]\n    set [change z v] to [0]\n    wait (1) seconds\n    repeat (100)\n        change [moving v] by (-5)\n        set [change x v] to ((-5) * ())\n        set [change z v] to ((-5) * (Move Z))\n    end\nend\n\nerase all\nbroadcast (backdrop v)\nforever\n    set [level v] to [5]\n    set [cam y vel v] to [0]\n    set [cam y v] to [200]\n    set [cam z v] to [500]\n    set [cam x v] to [1000]\n    set [shadow? v] to [0]\n    erase all\n    draw cube x: (1100) y: (-100) z: (-220) XL: (200) YL: (0) ZL: (200) color [blue]\n    Moving Block [1350] [-100] [-180] [100] [0] [100] Color [blueZ] Z? [0] X? [1] Y? [] Speed []\n    draw cube x: [2000] y: [] z: [1200] XL: [100] YL: [] ZL: [200] color [green]\n    Moving Block [2000] [-100] [500] [100] [0] [100] Color [yellow] Z? [1] X? [0] Y? [] Speed []\n    Moving Block [2000] [-100] [30] [100] [0] [100] Color [yellow] Z? [1] X? [0] Y? [] Speed []\n    draw cube x: (1650) y: (-50) z: (-220) XL: (0) YL: (80) ZL: (200) color [red]\n    draw cube x: (2000) y: (-100) z: (-220) XL: (200) YL: (0) ZL: (200) color [blue]\n    draw cube x: (1200) y: (-100) z: (-220) XL: (0) YL: (80) ZL: (200) color [red]\n    Moving Block [450] [-100] [-180] [100] [0] [100] Color [blueZ] Z? [0] X? [1] Y? [] Speed []\n    draw cube x: (200) y: (-100) z: (-220) XL: (200) YL: (0) ZL: (200) color [blue]\nend\n\nif <(shadow?) = [0]> then\n    set pen (brightness v) to (100)\nelse\n    set pen (brightness v) to ((20000) / ([sqrt v] of (((((cam x) - (x)) * ((cam x) - (x))) + (((cam y) - (y)) * ((cam y) - (y)))) + (((cam z) - (z)) * ((cam z) - (z)))) ))\nend\n\nwhen I receive [start v]\nset [fov v] to [150]\nset [level v] to [1]\nset [zv v] to [0]\nset [xv v] to [0]\nset [cam y vel v] to [0]\nset [turn y v] to [0]\nset [turn x v] to [0]\nswitch costume to (costume3 v)\nset [near plane v] to [49]\nset [view factor v] to [150]\nset [rot x v] to [0]\nset [rot y v] to [0]\nset [shadow? v] to [1]\nset [cam z v] to [-200]\nset [cam x v] to [200]\nset [camspeed v] to [4]\nset [cam y v] to [0]\nset [near plane v] to [10]\nset pen size to (3)\nset pen color to (#179fd7)\nforever\n    erase all\n    Render\n    if <<key (up arrow v) pressed?> and <not <(turn y) > [90]>>> then\n        change [turn y v] by (5)\n    end\n    if <<key (down arrow v) pressed?> and <not <(turn y) < [-90]>>> then\n        change [turn y v] by (-5)\n    end\n    if <key (left arrow v) pressed?> then\n        change [turn x v] by (5)\n    end\n    if <key (right arrow v) pressed?> then\n        change [turn x v] by (-5)\n    end\n    detector\n    if <key (w v) pressed?> then\n        move camra by ((0) - ((camspeed) * (Sin X))) (0) ((camspeed) * (cos X))\n    end\n    if <key (a v) pressed?> then\n        move camra by ((0) - ((camspeed) * (cos X))) (0) ((0) - ((camspeed) * (Sin X)))\n    end\n    if <key (s v) pressed?> then\n        move camra by ((camspeed) * (Sin X)) (0) ((0) - ((camspeed) * (cos X)))\n    end\n    if <key (d v) pressed?> then\n        move camra by ((camspeed) * (cos X)) (0) ((camspeed) * (Sin X))\n    end\n    if <(VR?) = [0]> then\n        set [rot x v] to (turn X)\n        set [rot y v] to (turn y)\n    else\n        set [rot x v] to ([x position v] of [sprite1 v])\n        set [rot y v] to ([y position v] of [sprite1 v])\n    end\n    if <key (h v) pressed?> then\n        show variable [vr? v]\n    else\n        hide variable [vr? v]\n    end\n    if <(Mouse Control?) = [1]> then\n        set [rot x v] to ((mouse x) * (-0.7))\n        set [rot y v] to ((mouse y) * (0.5))\n    end\nend\n\nset [level v] to [3]\n\nstop [all v]\n\nmove (10) steps\n\nchange pen size by (1)\n\n@Sprite2\n\nwhen flag clicked\nerase all\nhide\nswitch backdrop to (backdrop2 v)\nswitch costume to (kaylorb v)\nset [ghost v] effect to (100)\nshow\nwait (1) seconds\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (2) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nwait (1) seconds\nswitch costume to (3d v)\nset [ghost v] effect to (100)\nshow\nwait (2) seconds\nrepeat (5)\n    change [ghost v] effect by (-20)\nend\nwait (2) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nwait (1) seconds\nbroadcast (start v)\nswitch costume to (level1 v)\nset [ghost v] effect to (100)\nshow\nwait (1) seconds\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (1) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nswitch costume to (wasd v)\nset [ghost v] effect to (100)\nshow\nwait (0) seconds\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait until <<key (w v) pressed?> or <<key (a v) pressed?> or <<key (s v) pressed?> or <key (d v) pressed?>>>>\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nswitch costume to (arrow v)\nset [ghost v] effect to (100)\nshow\nwait (0) seconds\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait until <<key (up arrow v) pressed?> or <<key (down arrow v) pressed?> or <<key (right arrow v) pressed?> or <key (left arrow v) pressed?>>>>\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nswitch costume to (arrow2 v)\nset [ghost v] effect to (100)\nshow\nwait (0) seconds\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait until <key (space v) pressed?>\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nswitch costume to (arrow3 v)\nset [ghost v] effect to (100)\nshow\nwait (2) seconds\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (1) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nswitch costume to (level1 v)\n\nwhen I receive [next level v]\nwait (1) seconds\nswitch costume to (join [level] (level))\nset [ghost v] effect to (100)\nshow\nwait (1) seconds\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (1) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\n@Settings\n\nwhen I receive [start v]\nset [settings v] to [off]\nshow\nforever\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        if <(settings) = [on]> then\n            set [settings v] to [off]\n        else\n            set [settings v] to [on]\n        end\n        broadcast (settings v)\n        wait until <not <<touching (mouse-pointer v)?> and <mouse down?>>>\n    end\nend\n\nwhen flag clicked\nhide\n\n@Mouse control\n\nwhen I receive [settings v]\nif <(settings) = [on]> then\n    go to x: (-188) y: (10)\n    switch costume to (Mouse Control?)\n    show\n    glide (1) secs to x: (21) y: (10)\n    repeat until <(settings) = [off]>\n        if <<touching (mouse-pointer v)?> and <mouse down?>> then\n            if <(Mouse Control?) = [1]> then\n                set [mouse control? v] to [0]\n            else\n                set [mouse control? v] to [1]\n            end\n            switch costume to (Mouse Control?)\n            wait until <not <<touching (mouse-pointer v)?> and <mouse down?>>>\n        end\n    end\nend\nif <(settings) = [off]> then\n    glide (1) secs to x: (-188) y: (10)\n    hide\nend\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\n@VR\n\nwhen I receive [settings v]\nif <(settings) = [on]> then\n    go to x: (-188) y: (-38)\n    switch costume to (VR?)\n    show\n    glide (1) secs to x: (21) y: (-38)\n    repeat until <(settings) = [off]>\n        if <<touching (mouse-pointer v)?> and <mouse down?>> then\n            if <(VR?) = [1]> then\n                set [vr? v] to [0]\n            else\n                set [vr? v] to [1]\n            end\n            switch costume to (VR?)\n            wait until <not <<touching (mouse-pointer v)?> and <mouse down?>>>\n        end\n    end\nend\nif <(settings) = [off]> then\n    glide (1) secs to x: (-188) y: (-38)\n    hide\nend\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\n@sdw\n\nwhen I receive [settings v]\nif <(settings) = [on]> then\n    show variable [fov v]\nend\nif <(settings) = [off]> then\n    hide variable [fov v]\nend\n\ngo to x: (-188) y: (-80)\nshow\nglide (1) secs to x: (21) y: (-80)\nswitch costume to (1 v)\ncreate clone of (_myself_ v)\nglide (1) secs to x: ((FOV) - (180)) y: (-80)\nrepeat until <(settings) = [off]>\n    go to x: ((FOV) - (180)) y: (-80)\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        if <<(mouse x) < [-90]> and <(mouse x) > [-200]>> then\n            set [fov v] to ((mouse x) - (-180))\n        end\n    end\nend\n\nglide (1) secs to x: (-188) y: (-80)\nhide\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I start as a clone\nswitch costume to (0 v)\nwait until <(settings) = [off]>\ndelete this clone\n\nforever\n    say ((mouse x) - (-180))\nend\n\n