escape! 4 ( platformer)

Instructions: You are playing as the irrational number, Pi, who is on a quest to finally become a rational number.\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nControls:\nUse the arrow keys to move around and jump.\nPress the "R" key if you get stuck!\nHold down the mouse to draw, once holding the pencil.

@Stage\n\nwhen flag clicked\nforever\n    play sound [Vexento_-_Sunrise\[Converterino v] until done\nend\n\n@player\n\ndefine Platform Physics jump height: (y) move speed: (speed) fricton: (friction)\ngo to [front v] layer\nswitch costume to (ball v)\nif <<<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>> or <key (d v) pressed?>> then\n    change [x vel. v] by (speed)\n    point in direction (90)\nend\nif <<<key (left arrow v) pressed?> or <<mouse down?> and <(x position) > (mouse x)>>> or <key (a v) pressed?>> then\n    change [x vel. v] by ((speed) * (-1))\n    point in direction (-90)\nend\nset [x vel. v] to ((x vel.) * (friction))\nchange x by (x vel.)\nif <<touching (level v)?> or <touching (door v)?>> then\n    set [slope v] to [0]\n    repeat until <<not <<touching (level v)?> or <touching (door v)?>>> or <(slope) = [8]>>\n        change [slope v] by (1)\n        change y by (1)\n    end\n    if <<touching (level v)?> or <touching (door v)?>> then\n        change y by ((slope) * (-1))\n        repeat ([ceiling v] of ([abs v] of (x vel.) ) )\n            if <<touching (level v)?> or <touching (door v)?>> then\n                change x by ((([abs v] of (x vel.) ) / (x vel.)) * (-1))\n            end\n        end\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> then\n            set [y vel. v] to [10]\n            if <(x vel.) > [0]> then\n                set [x vel. v] to [-8]\n            else\n                set [x vel. v] to [8]\n            end\n        else\n            set [x vel. v] to [0]\n        end\n    end\nend\nchange y by (y vel.)\nif <<touching (level v)?> or <touching (door v)?>> then\n    repeat ([ceiling v] of ([abs v] of (y vel.) ) )\n        if <<touching (level v)?> or <touching (door v)?>> then\n            change y by ((([abs v] of (y vel.) ) / (y vel.)) * (-1))\n        end\n    end\n    if <<(([abs v] of (y vel.) ) / (y vel.)) = [-1]> and <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n        set [y vel. v] to (y)\n    else\n        set [y vel. v] to [0]\n    end\nelse\n    change [y vel. v] by (-1)\nend\n\nwhen flag clicked\ngo to x: (-200) y: (-100)\nset rotation style [left-right v]\npoint in direction (90)\nset [y vel. v] to [0]\nset [x vel. v] to [0]\nset [level v] to [1]\nset size to (100) %\nwait (2) seconds\nshow\nclear graphic effects\nforever\n    Platform Physics jump height: [11] move speed: [1.5] fricton: [0.85]\n    tick\nend\n\nwhen I start as a clone\nrepeat (16)\n    change size by (-5)\n    change [ghost v] effect by (6.25)\nend\ndelete this clone\n\nwhen flag clicked\nforever\n    create clone of (_myself_ v)\n    wait (0.02) seconds\nend\n\nwhen flag clicked\ngo to x: (-200) y: (-100)\nset rotation style [left-right v]\npoint in direction (90)\nset [y vel. v] to [0]\nset [x vel. v] to [0]\nset [level v] to [1]\nset size to (100) %\nclear graphic effects\nset [spawn x v] to [-182]\nset [spawn y v] to [-125]\n\ndefine tick\nif <<<touching (spikes v)?> or <touching (hidden spikes v)?>> or <key (r v) pressed?>> then\n    broadcast (door lock v)\n    go to x: (spawn x) y: (spawn y)\n    set [x vel. v] to [0]\n    set [y vel. v] to [0]\nend\nif <touching (key v)?> then\n    broadcast (key found v)\n    start sound [Collect v]\nend\nif <touching (portal v)?> then\n    wait until <not <key (s v) pressed?>>\n    broadcast (transist v)\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    hide\n    wait (2) seconds\n    spawn update\n    go to x: (spawn x) y: (spawn y)\n    set [x vel. v] to [0]\n    set [y vel. v] to [0]\n    show\n    repeat (10)\n        change [ghost v] effect by (-10)\n    end\nend\n\ndefine spawn update\nif <(LEVEL) = [6]> then\n    set [spawn x v] to [182]\nelse\n    if <(LEVEL) = [8]> then\n        set [spawn x v] to [-182]\n        set [spawn y v] to [115]\n    else\n        if <(LEVEL) = [9]> then\n            set [spawn x v] to [-182]\n            set [spawn y v] to [-125]\n        else\n            if <(LEVEL) = [10]> then\n                set [spawn x v] to [185]\n                set [spawn y v] to [115]\n            else\n                if <(LEVEL) = [11]> then\n                    set [spawn x v] to [-182]\n                    set [spawn y v] to [-125]\n                else\n                    if <(LEVEL) = [13]> then\n                        set [spawn x v] to [180]\n                        set [spawn y v] to [25]\n                    else\n                        if <(LEVEL) = [14]> then\n                            set [spawn x v] to [-182]\n                            set [spawn y v] to [-125]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nif <(LEVEL) > [9]> then\n\n@LEVEL\n\nwhen flag clicked\ngo to x: (0) y: (0)\nwait (1.5) seconds\nforever\n    go to [front v] layer\n    switch costume to (LEVEL)\nend\n\n@SPIKES\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    go to [front v] layer\n    switch costume to (LEVEL)\nend\n\n@Hidden Spikes\n\nwhen flag clicked\ngo to [back v] layer\nhide\nwait (1) seconds\nforever\n    wait until <(LEVEL) = [6]>\n    Clone at x: [0] y: [-15] spike count: [5] beat [0]\n    Clone at x: [-155] y: [-140] spike count: [5] beat [1]\n    wait until <(LEVEL) = [7]>\n    Clone at x: [-150] y: [-160] spike count: [5] beat [0]\n    wait until <(LEVEL) = [8]>\n    Clone at x: [-45] y: [-160] spike count: [5] beat [0]\n    wait until <(LEVEL) = [9]>\n    Clone at x: [-75] y: [85] spike count: [5] beat [1]\n    Clone at x: [0] y: [-160] spike count: [1] beat [1]\n    Clone at x: [100] y: [-160] spike count: [1] beat [1]\n    Clone at x: [-100] y: [-160] spike count: [1] beat [1]\n    Clone at x: [50] y: [-160] spike count: [1] beat [0]\n    Clone at x: [-50] y: [-160] spike count: [1] beat [0]\n    wait until <(LEVEL) = [10]>\n    Clone at x: [110] y: [-85] spike count: [1] beat [0]\n    wait until <(LEVEL) = [11]>\n    Clone at x: [-20] y: [-140] spike count: [3] beat [0]\n    Clone at x: [55] y: [-140] spike count: [3] beat [1]\n    wait until <(LEVEL) = [12]>\n    Clone at x: [17] y: [-140] spike count: [5] beat [0]\n    Clone at x: [166] y: [-140] spike count: [3] beat [1]\n    wait until <(LEVEL) = [13]>\n    Clone at x: [-65] y: [-140] spike count: [5] beat [0]\n    wait until <(LEVEL) = [14]>\n    Clone at x: [-125] y: [150] spike count: [1] beat [0]\n    Clone at x: [-60] y: [-140] spike count: [3] beat [0]\n    Clone at x: [80] y: [-140] spike count: [3] beat [0]\n    Clone at x: [15] y: [-140] spike count: [3] beat [1]\n    wait until <(LEVEL) = [15]>\n    Clone at x: [0] y: [-140] spike count: [DIE] beat [0]\nend\n\ndefine Clone at x: (x) y: (y) spike count: (#) beat (0-3)\ngo to x: (x) y: (y)\nswitch costume to (#)\nset [beat v] to (0-3)\ncreate clone of (_myself_ v)\n\nwhen flag clicked\nforever\n    set [mouse v] to (join (mouse x) (join [,] (mouse y)))\nend\n\nwhen I start as a clone\nposition [-1]\nshow\nwait (beat) seconds\nforever\n    repeat until <touching color (#e6e6e6)?>\n        change y by (2)\n    end\n    repeat (10)\n        change y by (2)\n    end\n    wait (.1) seconds\n    repeat until <not <touching color (#e6e6e6)?>>\n        change y by (-2)\n    end\n    wait (1) seconds\nend\n\nwhen I receive [setup v]\ndelete this clone\n\ndefine position (speed)\nrepeat until <not <touching color (#e6e6e6)?>>\n    change y by (speed)\nend\n\nClone at x: [-125] y: [150] spike count: [1] beat [0]\n\n@transition \n\ndefine transist\nclear graphic effects\nshow\ngo to x: (0) y: (400)\nrepeat until <(round (y position)) = [0]>\n    change y by (((y position) / (7)) * (-1))\n    go to [front v] layer\nend\nchange [level v] by (1)\nbroadcast (door lock v)\nbroadcast (setup v)\nwait (.1) seconds\nrepeat until <(y position) > [324]>\n    change y by (((325) - (round (y position))) / (7))\nend\nhide\n\nwhen I receive [transist v]\ntransist\n\nwhen flag clicked\nhide\n\n@PORTAL\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    go to [front v] layer\n    turn right (1) degrees\n    if <(LEVEL) = [1]> then\n        go to x: (175) y: (-130)\n    else\n        if <(LEVEL) = [2]> then\n            go to x: (175) y: (-130)\n        else\n            if <(LEVEL) = [3]> then\n                go to x: (175) y: (-130)\n            else\n                if <(LEVEL) = [4]> then\n                    go to x: (-190) y: (100)\n                else\n                    if <(LEVEL) = [5]> then\n                        go to x: (185) y: (-130)\n                    else\n                        if <(LEVEL) = [6]> then\n                            go to x: (-185) y: (120)\n                        else\n                            if <(LEVEL) = [7]> then\n                                go to x: (-40) y: (-135)\n                            else\n                                if <(LEVEL) = [8]> then\n                                    go to x: (90) y: (30)\n                                else\n                                    if <(LEVEL) = [9]> then\n                                        go to x: (-185) y: (110)\n                                    else\n                                        if <(LEVEL) = [10]> then\n                                            go to x: (185) y: (-60)\n                                        else\n                                            if <(LEVEL) = [11]> then\n                                                go to x: (165) y: (120)\n                                            else\n                                                if <(LEVEL) = [12]> then\n                                                    go to x: (181) y: (120)\n                                                else\n                                                    if <(LEVEL) = [13]> then\n                                                        go to x: (-183) y: (-125)\n                                                    else\n                                                        if <(LEVEL) = [14]> then\n                                                            go to x: (183) y: (-125)\n                                                        else\n                                                            if <(LEVEL) = [15]> then\n                                                                go to x: (183) y: (-125)\n                                                            else\n                                                            end\n                                                        end\n                                                    end\n                                                end\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <(LEVEL) = [16]> then\n        hide\n    else\n        show\n    end\nend\n\n@PORTAL2\n\nwhen flag clicked\nforever\n    go to [front v] layer\n    turn right (-1) degrees\n    if <(LEVEL) = [1]> then\n        go to x: (175) y: (-130)\n    else\n        if <(LEVEL) = [2]> then\n            go to x: (175) y: (-130)\n        else\n            if <(LEVEL) = [3]> then\n                go to x: (175) y: (-130)\n            else\n                if <(LEVEL) = [4]> then\n                    go to x: (-190) y: (100)\n                else\n                    if <(LEVEL) = [5]> then\n                        go to x: (185) y: (-130)\n                    else\n                        if <(LEVEL) = [6]> then\n                            go to x: (-185) y: (120)\n                        else\n                            if <(LEVEL) = [7]> then\n                                go to x: (-40) y: (-135)\n                            else\n                                if <(LEVEL) = [8]> then\n                                    go to x: (90) y: (30)\n                                else\n                                    if <(LEVEL) = [9]> then\n                                        go to x: (-185) y: (110)\n                                    else\n                                        if <(LEVEL) = [10]> then\n                                            go to x: (185) y: (-60)\n                                        else\n                                            if <(LEVEL) = [11]> then\n                                                go to x: (165) y: (120)\n                                            else\n                                                if <(LEVEL) = [12]> then\n                                                    go to x: (181) y: (120)\n                                                else\n                                                    if <(LEVEL) = [13]> then\n                                                        go to x: (-183) y: (-125)\n                                                    else\n                                                        if <(LEVEL) = [14]> then\n                                                            go to x: (183) y: (-125)\n                                                        else\n                                                            if <(LEVEL) = [15]> then\n                                                                go to x: (183) y: (-125)\n                                                            else\n                                                            end\n                                                        end\n                                                    end\n                                                end\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <(LEVEL) = [16]> then\n        hide\n    else\n        show\n    end\nend\n\n@door\n\nwhen flag clicked\ngo to x: (0) y: (0)\npoint in direction (90)\ngo to [back v] layer\nhide\nswitch costume to (10 v)\nwait (.1) seconds\n\nswitch costume to (LEVEL)\n\nwhen I receive [transist v]\nif <(LEVEL) > [9]> then\n    next costume\nend\n\nwhen I receive [door lock v]\nif <(LEVEL) > [9]> then\n    show\nend\n\nwhen I receive [key found v]\nif <(LEVEL) > [9]> then\n    hide\nend\n\n@key\n\nwhen flag clicked\ngo to x: (0) y: (0)\npoint in direction (90)\ngo to [back v] layer\nhide\nswitch costume to (10 v)\nset [function v] to [0]\nwait (.1) seconds\nwait until <(LEVEL) = [10]>\nforever\n    animation [10]\nend\n\nwhen I receive [transist v]\nif <(LEVEL) > [9]> then\n    next costume\nend\n\ndefine animation (speed)\nchange [function v] by (speed)\nchange y by (([sin v] of (function) ) / (3))\n\nwhen I receive [door lock v]\nif <(LEVEL) > [9]> then\n    show\nend\n\nwhen I receive [key found v]\nif <(LEVEL) > [9]> then\n    hide\nend\n\n@deco\n\nwhen flag clicked\nhide\nforever\n    create clone of (_myself_ v)\n    wait (0.02) seconds\nend\n\nwhen I start as a clone\nset [distance v] to [0]\ngo to x: (pick random (-120) to (120)) y: (-125)\nset [ghost v] effect to (60)\npoint in direction (pick random (-45) to (45))\nforever\n    if <<not <(LEVEL) = [16]>> or <(distance) > [100]>> then\n        delete this clone\n    else\n        show\n    end\n    move (1) steps\n    change [distance v] by (1)\n    change [ghost v] effect by (.5)\n    go to [back v] layer\nend\n\n@title\n\nwhen flag clicked\nforever\n    go to x: (0) y: ((([sin v] of ((timer) * (200)) ) * (3)) + (75))\n    if <touching (mouse-pointer v)?> then\n        change size by (((110) - (size)) / (5))\n    else\n        point in direction (90)\n        change size by (((100) - (size)) / (5))\n    end\n    if <(LEVEL) = [1]> then\n        show\n    else\n        hide\n    end\nend\n\n@starter\n\nwhen flag clicked\nforever\n    go to x: (0) y: (([sin v] of (((timer) + (2.5)) * (200)) ) * (3))\n    if <(LEVEL) = [1]> then\n        show\n    else\n        hide\n    end\nend\n\n@TB\n\nwhen flag clicked\nshow\nclear graphic effects\ngo to x: (0) y: (0)\ngo to [front v] layer\nwait (1) seconds\nrepeat (25)\n    change [ghost v] effect by (4)\nend\nhide\n\nwhen flag clicked\nwait (.1) seconds\nwait until <(LEVEL) > [1]>\nforever\n    reset timer\nend\n\nwhen [timer v] > (0.1)\nshow\ngo to [front v] layer\nrepeat (25)\n    change [ghost v] effect by (-4)\nend\nclear graphic effects\n\n