Day in the Life of Me (Scrolling Platformer)

Instructions: https://scratch.mit.edu/projects/302371963/ https://scratch.mit.edu/projects/301116267/ !\nUse arrow keys to move.\nI hope you like this scrolling platformer.\nMade for SDS DAY IN THE LIFE OF...\nGo to my profile for much much more.\nI have like 30 platformers on this account.\n@cool-deo - 1st love\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\nif <(level) = [4]> then\n\nset [x v] to [-999999]\n\nswitch costume to (open v)\n\nclone at x [5000000000000000000000000000000000000000000000000000000000000000] y [-122]\n\nhide\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 [2550] y [84]\nelse\n    if <(level) = [2]> then\n        switch costume to (open v)\n        clone at x [2179] y [-80]\n        if <(level) = [2]> then\n            switch costume to (open v)\n            clone at x [2179] y [-80]\n        else\n        end\n    else\n        switch costume to (open v)\n        clone at x [2179] y [-92]\n    end\nend\n\nif <(level) = [3]> then\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\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 [450] y [0]\nelse\n    if <(level) = [2]> then\n        switch costume to (level 2 1 v)\n        clone at x [450] y [0]\n        clone at x [450] y [0]\n        clone at x [450] y [10]\n        clone at x [450] y [20]\n    else\n        if <(level) = [3]> then\n            switch costume to (level 3 1 v)\n            clone at x [450] y [30]\n            clone at x [450] y [20]\n            clone at x [450] y [30]\n            clone at x [450] y [20]\n        else\n            switch costume to (end v)\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 <(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 (#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\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@Sometime\n\nwhen flag clicked\nhide\nforever\n    play sound [Sometime v] until done\nend\n\n