an emoji platformer

Instructions: all credit goes to @-Nexus85-\n\nwasd to move or arrow keys

@Stage\n\nwhen flag clicked\nset [level v] to [1]\nswitch backdrop to (backdrop1 v)\nwait (3.15) seconds\n\nswitch backdrop to (backdrop1 v)\n\n@Player\n\nwhen flag clicked\ngo to x: (-200) y: (-30)\nset [x velocity v] to [0]\nset [y velocity v] to [0]\nhide\nwait (3.1) seconds\nshow\nforever\n    if <not <<(Level) = [3]> or <(Level) = [4]>>> then\n        Platform (10) (-1) (0.7) (3)\n    end\n    if <touching (obstacles v)?> then\n        go to x: (-200) y: (-30)\n        if <(Level) = [4]> then\n            go to x: (-220) y: (-95)\n        end\n        if <(Level) = [8]> then\n            go to x: (-220) y: (-95)\n        end\n    end\n    if <touching (endlevel v)?> then\n        change [level v] by (1)\n        go to x: (-200) y: (-30)\n        if <(Level) = [4]> then\n            go to x: (-220) y: (-95)\n        end\n        if <(Level) = [8]> then\n            go to x: (-220) y: (-95)\n        end\n        if <(Level) = [9]> then\n            go to x: (-220) y: (-125)\n        end\n    end\n    if <(Level) = [3]> then\n        Platform (18) (-0.25) (0.7) (3)\n    end\n    if <(Level) = [4]> then\n        Platform (10) (-1) (0.7) (8)\n    end\nend\n\nif <(distance to [portal 1 v]) < [100]> then\n    say [Let's jump into that portal!] for (2) seconds\nend\nif <(distance to [portal 2 v]) < [75]> then\n    say [Woah!] for (2) seconds\nend\n\ndefine Platform (jump height) (gravity) (friction) (running speed)\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    point in direction (90)\n    change [x velocity v] by (running speed)\nend\nif <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n    point in direction (-90)\n    change [x velocity v] by ((running speed) * (-1))\nend\nset [x velocity v] to ((x velocity) * (friction))\nchange x by (x velocity)\nif <<touching (level v)?> or <touching (movinglevel v)?>> then\n    set [slope v] to [0]\n    repeat until <<(slope) = [8]> or <not <<touching (level v)?> or <touching (movinglevel v)?>>>>\n        change [slope v] by (1)\n        change y by (1)\n    end\n    if <<touching (level v)?> or <touching (movinglevel v)?>> then\n        change y by ((slope) * (-1))\n        repeat ([ceiling v] of ([abs v] of (x velocity) ) )\n            if <<touching (level v)?> or <touching (movinglevel v)?>> then\n                change x by ((([abs v] of (x velocity) ) / (x velocity)) * (-1))\n            end\n        end\n        set [x velocity v] to [0]\n    end\nend\nchange y by (y velocity)\nif <<touching (level v)?> or <touching (movinglevel v)?>> then\n    repeat ([ceiling v] of ([abs v] of (y velocity) ) )\n        if <<touching (level v)?> or <touching (movinglevel v)?>> then\n            change y by ((([abs v] of (y velocity) ) / (y velocity)) * (-1))\n        end\n    end\n    if <<(([abs v] of (y velocity) ) / (y velocity)) = [-1]> and <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n        set [y velocity v] to (jump height)\n    else\n        set [y velocity v] to [0]\n    end\nelse\n    change [y velocity v] by (-1)\nend\n\n@Level\n\nwhen flag clicked\nhide\nwait (3.15) seconds\nshow\nforever\n    go to x: (0) y: (0)\n    switch costume to (Level)\nend\n\n@EndLevel\n\nwhen flag clicked\ngo to x: (185) y: (140)\nhide\nwait (3.1) seconds\nforever\n    show\n    if <not <<(Level) = [5]> or >> then\n        set y to ((142.5) + (([cos v] of (((timer) - (3)) * (500)) ) * (2.5)))\n    end\n    if <(Level) = [5]> then\n        go to x: (185) y: (140)\n        set y to ((140) + (([cos v] of (((timer) - (3)) * (500)) ) * (2.5)))\n    end\n    if <(Level) = [6]> then\n        go to x: (200) y: (127)\n        set y to ((127) + (([cos v] of (((timer) - (3)) * (500)) ) * (2.5)))\n    end\n    if <(Level) = [9]> then\n        hide\n    end\nend\n\n@Obstacles\n\nwhen flag clicked\ngo to x: (-97) y: (-146)\nhide\nwait (3.1) seconds\nshow\nforever\n    switch costume to (Level)\nend\n\n@Music\n\nwhen flag clicked\nforever\n    play sound [Flint-L - White Peaks v] until done\nend\n\n@Intro\n\nwhen flag clicked\ngo to x: (20) y: (0)\nshow\nset [ghost v] effect to (100)\nrepeat (50)\n    change [ghost v] effect by (-2)\nend\nwait (1.45) seconds\nhide\n\n