Jupiter - A platformer

Instructions:               <============================>\n=========<  -------------------------------------  >=========\n====<  WELCOME TO 50-LEVEL PLATFORMER  >===\n    ♦  Use the arrow keys or WASD to move!\n    ♦  Red lava kills you!\n    ♦  Blue bounces you up!\n    ♦  Green is anti-gravity!\n    ♦  Pink makes you small!\n    ♦  Press R to replay level if you are stuck!\n    ♦  Press M to turn the music on and off!\n    ♦  ALL LEVELS ARE POSSIBLE!\n=========<  -------------------------------------  >=========\n              <============================>

@Stage\n\n@EXIT\n\nwhen I receive [open portal v]\nswitch costume to (open v)\n\nset [exit v] to []\n\nset [x v] to [-999999]\n\nswitch costume to (open v)\nclone at x [689] y [-122]\n\nset [x v] to [-999999]\n\nswitch costume to (open v)\n\nclone at x [5000000000000000000000000000000000000000000000000000000000000000] y [-122]\n\nhide\n\nif <(level) = [3]> then\n\nswitch costume to (open v)\nclone at x [2179] y [-92]\n\nif <(level) = [4]> then\n\nswitch costume to (open v)\nclone at x [100000000000000000000] y [-50]\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((x) - (scroll x)) ((y) - (scroll y))\nif <<(costume [name v]) = [OPEN]> and <touching (player v)?>> then\n    set [exit v] to [win]\nend\n\nwhen I receive [setup v]\nhide\nhide variable [mouse v]\nset [collected v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nif <(level) = [1]> then\n    switch costume to (open v)\n    clone at x [1350] y [600]\nelse\n    if <(level) = [2]> then\n        switch costume to (open v)\n        clone at x [2250] y [-80]\n    else\n        if <(level) = [3]> then\n            switch costume to (open v)\n            clone at x [3200] y [400]\n        else\n            if <(level) = [4]> then\n                switch costume to (open v)\n                clone at x [4000] y [400]\n            else\n                switch costume to (open v)\n                clone at x [100000000000000000000] y [-50]\n            end\n        end\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 (x) y (y)\nset [x v] to (x)\nset [y v] to (y)\n\nshow\n\n@Platforms\n\nclone at x [0] y [300]\nclone at x [360] y [0]\n\nclone at x [450] y [10]\nclone at x [450] y [20]\n\nclone at x [450] y [0]\nclone at x [450] y [300]\nclone at x [450] y [0]\nclone at x [450] y [0]\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((x) - (scroll x)) ((y) - (scroll y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(level) = [1]> then\n    switch costume to (level 1 1 v)\n    clone at x [450] y [0]\n    clone at x [450] y [0]\n    clone at x [450] y [0]\n    clone at x [450] y [0]\n    clone at x [-900] y [300]\n    clone at x [450] y [200]\n    clone at x [-1350] y [-190]\n    clone at x [1000000000000] y [300]\nelse\n    if <(level) = [2]> then\n        switch costume to (level 2 1 v)\n        clone at x [450] y [300]\n        clone at x [450] y [0]\n        clone at x [-450] y [-300]\n        clone at x [450] y [0]\n        clone at x [450] y [0]\n        clone at x [450] y [0]\n        clone at x [450] y [0]\n        clone at x [10000000000000] y [0]\n    else\n        if <(level) = [3]> then\n            switch costume to (level 3 1 v)\n            clone at x [600] y [0]\n            clone at x [450] y [0]\n            clone at x [450] y [0]\n            clone at x [450] y [0]\n            clone at x [450] y [300]\n            clone at x [450] y [0]\n            clone at x [1000000000000000000] y [0]\n        else\n            if <(level) = [4]> then\n                switch costume to (level 4 1 v)\n                clone at x [600] y [0]\n                clone at x [400] y [400]\n                clone at x [50] y [-400]\n                clone at x [200] y [0]\n                clone at x [450] y [0]\n                clone at x [450] y [0]\n                clone at x [450] y [0]\n                clone at x [450] y [300]\n                clone at x [450] y [0]\n                clone at x [450] y [0]\n                clone at x [100000000] y [0]\n            else\n                switch costume to (end v)\n            end\n        end\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 (x) y (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nshow\n\n@player\n\nwhen flag clicked\nbroadcast (Green flag v) and wait\nbroadcast (play game v) and wait\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 [scroll x v] to [0]\nset [scroll y v] to [0]\nset [sy v] to [0]\nset [in air v] to [0]\nset [exit v] to []\nset size to (100) %\nset [ghost v] effect to (0)\nshow\n\ndefine Tick\nif <key (left arrow v) pressed?> then\n    change player x by [-8]\nend\nif <key (right arrow v) pressed?> then\n    change player x by [8]\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)\ntest-die\nset [scroll x v] to (x)\nif <(scroll x) < [0]> then\n    set [scroll x v] to [0]\nend\nchange [scroll y v] by (round (((y) - (scroll y)) / (10)))\nif <(scroll y) < [0]> then\n    set [scroll y 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\nrepeat until <not <touching (platforms v)?>>\n    if <touching color (#2700ff)?> then\n        broadcast (egg v)\n    end\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) - (scroll x)) y: ((y) - (scroll y))\n\ndefine change player x by (sx)\nchange [x v] by (sx)\nposition\nif <touching (platforms v)?> then\n    if <touching color (#2700ff)?> then\n        broadcast (egg v)\n    end\n    if <touching color (#00fd63)?> then\n        broadcast (egg v)\n    end\n    repeat until <not <touching (platforms v)?>>\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        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 (.5) seconds\n\ndefine test-die\nif <touching (danger v)?> then\n    set [exit v] to [die]\nend\n\ndefine game - win\nrepeat (50)\n    point towards (exit v)\n    turn right (65) degrees\n    move ((distance to [exit 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\nset [scroll y v] to [0]\n\nwhen I receive [bounce v]\nchange player y by [200]\n\n@Egg\n\nwhen I receive [egg v]\nshow\nclear graphic effects\ngo to x: (0) y: (0)\nset size to (10) %\nrepeat (100)\n    change size by (2)\n    change [color v] effect by (5)\n    change [ghost v] effect by (1)\nend\n\nwhen flag clicked\nhide\n\n@Sprite1\n\nwhen flag clicked\ngo to x: (00) y: (0)\ngo to [front v] layer\nshow\nhide\n\n