Winter - a Scrolling Platformer

Instructions: New Game: https://scratch.mit.edu/projects/415526555\n\n\n- Arrow keys to move\n- jump over the stones and the gorges\nYou can see your time in the top left  corner. You can see the World Record in the top right.\nIt is possible!

@Stage\n\nwhen [m v] key pressed\nset [mouse v] to (join ((mouse x) + (scrolllx)) (join [,] ((mouse y) + (scrolly))))\nshow variable [mouse v]\n\nwhen flag clicked\nforever\n    play sound [All I Want for Christmas Is You v] until done\nend\n\n@player\n\nwhen flag clicked\nhide\nset [time v] to [0]\nhide variable [☁ world record v]\nhide variable [time v]\nbroadcast (thumbnail v)\nwait (1.5) seconds\nbroadcast (green flag v) and wait\nbroadcast (play game v) and wait\nshow\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\n\nwhen I receive [play game v]\nset [level v] to [1]\nforever\n    broadcast (reset v) and wait\n    broadcast (setup v) and wait\n    game on\n    repeat until <(exit) > []>\n        tick\n        broadcast (tick v) and wait\n    end\n    if <(exit) = [win]> then\n        Game-win\n    else\n        Game-die\n    end\nend\n\ndefine game on\nset [x v] to [0]\nset [y v] to [0]\nset [scrolllx v] to [0]\nset [scrolly v] to [0]\nset [sy v] to [0]\nset [in air v] to [0]\nset [exit v] to []\nshow variable [☁ world record v]\nset size to (50) %\nset [ghost v] effect to (0)\nshow\n\ndefine tick\nif <key (right arrow v) pressed?> then\n    change player x by [9]\nend\nif <key (left arrow v) pressed?> then\n    change player x by [-9]\nend\nif <key (up arrow v) pressed?> then\n    if <(in air) < [4]> then\n        set [sy v] to [16]\n    end\nend\nchange [sy v] by (-2)\nchange player y by (sy)\nset [scrolllx v] to (x)\nif <(scrolllx) < [0]> then\n    set [scrolllx v] to [0]\nend\nchange [scrolly v] by (round (((y) - (scrolly)) / (12)))\nif <(scrolly) < [0]> then\n    set [scrolly v] to [0]\nend\nposition\nif <(y) < [-180]> then\n    set [exit v] to [die]\nend\n\ndefine change player y by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nposition\nTest-die\nrepeat until <not <touching (platforms v)?>>\n    if <(sy) > [0]> then\n        change [y v] by (-1)\n    else\n        change [y v] by (1)\n        set [in air v] to [0]\n    end\n    position\n    set [sy v] to [0]\nend\n\ndefine position\ngo to x: ((x) - (scrolllx)) y: ((y) - (scrolly))\n\ndefine change player x by (sx)\nchange [x v] by (sx)\nposition\nTest-die\nif <touching (platforms v)?> then\n    repeat (12)\n        change [y v] by (1)\n        position\n        if <not <touching (platforms v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-12)\n    repeat until <not <touching (platforms v)?>>\n        if <(sx) > [0]> then\n            change [x v] by (-1)\n        else\n            change [x v] by (1)\n        end\n        position\n    end\nend\n\ndefine Game-die\nset [exit v] to []\nrepeat (5)\n    hide\n    wait (0.1) seconds\n    show\n    wait (0.1) seconds\nend\nhide\nwait (0.5) seconds\n\ndefine Test-die\nif <touching color (#7c9292)?> then\n    set [exit v] to [die]\n    broadcast (die v)\nend\n\ndefine Game-win\nrepeat (50)\n    point towards (ende v)\n    turn right (65) degrees\n    move ((distance to [ende v]) / (2)) steps\n    change size by (-1)\n    change [ghost v] effect by (2)\nend\nhide\nchange [level v] by (1)\nwait (1) seconds\n\nwhen I receive [play game v]\nshow variable [time v]\n\nwhen flag clicked\nset [die v] to [1]\nforever\n    wait until <<(y) < [-20]> and <<(x) > [0]> or <(x) < [0]>>>\n    reset timer\n    repeat until <<(die) = [2]> or <touching (_edge_ v)?>>\n    end\n    wait until <<(y) < [-20]> and <<(x) > [0]> or <(x) < [0]>>>\nend\n\nwhen I receive [die v]\nset [time v] to [0]\nset [die v] to [2]\nwait (2) seconds\nset [die v] to [1]\n\nwhen flag clicked\nset [die v] to [1]\nwait until <<(y) < [-20]> and <<(x) > [0]> or <(x) < [0]>>>\nreset timer\nrepeat until <(exit) = [win]>\n    time\nend\nstop [this script v]\n\ndefine time\nwait (0.1) seconds\nset [time v] to (timer)\n\n@platforms\n\nwhen I receive [green flag v]\nhide\ngo to [back v] layer\nwait (1) seconds\nshow\n\nwhen I receive [tick v]\nposition ((x) - (scrolllx)) ((y) - (scrolly))\n\nwhen I receive [setup v]\nset [x v] to [0]\nset [y v] to [0]\ngo to [front v] layer\nif <(Level) = [1]> then\n    switch costume to (1 v)\n    repeat (11)\n        clone at [360] [0]\n    end\n    clone at [0] [200]\n    clone at [360] [200]\n    clone at [360] [100]\n    repeat (9)\n        clone at [360] [0]\n    end\n    clone at [0] [200]\n    clone at [250] [200]\n    clone at [300] [50]\nelse\n    if <(Level) = [2]> then\n        switch costume to (kostüm10 v)\n    end\nend\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine clone at (x) (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\n@snow\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\n\ngo to x: (pick random (-200) to (200)) y: (130)\nshow\nrepeat until <touching (_edge_ v)?>\n    change y by (pick random (-5) to (-10))\nend\ndelete this clone\n\nrepeat (100)\n    create clone of (_myself_ v)\nend\n\n@Ende\n\nwhen I receive [green flag v]\nshow\n\nwhen I receive [tick v]\nposition ((x) - (scrolllx)) ((y) - (scrolly))\nif <touching (player v)?> then\n    set [exit v] to [win]\n    if <(time) < (☁ World record)> then\n        set [☁ world record v] to (timer)\n    end\nend\n\nwhen I receive [setup v]\nset [x v] to [0]\nset [y v] to [0]\nif <(Level) = [1]> then\n    switch costume to (1 v)\n    clone at [8743] [851]\nelse\n    set [x v] to [-99999]\nend\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine clone at (x) (y)\nset [x v] to (x)\nset [y v] to (y)\n\n@thumbnail\n\nwhen I receive [thumbnail v]\ngo to [front v] layer\ngo to x: (0) y: (0)\nshow\nwait (1.5) seconds\nforever\n    hide\nend\n\nshow\ngo to x: (0) y: (0)\n\n@background\n\nwhen I receive [green flag v]\ngo to [back v] layer\nshow\n\nwhen I receive [tick v]\nposition ((x) - (scrolllx)) ((y) - (scrolly))\n\nwhen I receive [setup v]\nset [x v] to [0]\nset [y v] to [0]\ngo to [back v] layer\nif <(Level) = [1]> then\n    switch costume to (1 v)\n    repeat (17)\n        clone at [360] [0]\n    end\nelse\n    if <(Level) = [2]> then\n        switch costume to (kostüm10 v)\n    end\nend\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine clone at (x) (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\n