Dark factory - a platformer

Instructions: Use the arrow keys to move and get past each level.\nPress space to skip the intro.\n\nHere is the in progress sequel: https://scratch.mit.edu/projects/552212382/\n\n⚠️This project may be glitchy on some computers.⚠️\n\nThis is for the Scratch Design Studio: Expect the unexpected.\n\nStory: You are a lost cube from a group of cubes called the Suncubes. You have to find your way back home over a long journey through the factory.\n\nWill you survive???\n\n\nShoutout to @Jonas_W20 for 50th love\nShoutout to @aravs1615 for 100th love\nShoutout to someone who beat this game in 10 seconds (I'm still not sure it actually happened)...\nCode 100% by me, @bunnygold.\nThanks to Viproxi for the song Frantic Factory.\nAdded new intro\n\n#Games  #All  #Platformer  #Fun  #bunnygold 

@Stage\n\nwhen I receive [escape v]\nswitch backdrop to (backdrop2 v)\n\nwhen I receive [start v]\nswitch backdrop to (backdrop1 v)\n\nwhen flag clicked\nswitch backdrop to (backdrop6 v)\n\nwhen I receive [text hide v]\nswitch backdrop to (backdrop4 v)\n\nwhen I receive [ice place v]\nswitch backdrop to (backdrop6 v)\n\nwhen I receive [start 3 ice v]\nswitch backdrop to (backdrop7 v)\n\n@Player\n\nwhen I start as a clone\nrepeat (10)\n    change [ghost v] effect by (10)\n    change size by (-2)\nend\ndelete this clone\n\ndefine sx\nrepeat until <<not <touching (levels v)?>> and <not <touching color (#ff0000)?>>>\n    if <(x) > [0]> then\n        change x by (-1)\n    else\n        change x by (1)\n    end\nend\n\ndefine speed\nrepeat (6)\n    if <<touching (levels v)?> and <not <touching color (#ff0000)?>>> then\n        change y by (1)\n    end\nend\n\ndefine sy\nrepeat until <<not <touching (levels v)?>> and <not <touching color (#ff0000)?>>>\n    if <(y) > [0]> then\n        change y by (-1)\n    else\n        change y by (1)\n    end\nend\n\nwhen I receive [start 2 v]\nset [exit v] to []\nset [level v] to [1]\nshow\ngo to x: (-200) y: (-85)\npoint in direction (90)\nset rotation style [left-right v]\nset [x v] to [0]\nset [y v] to [0]\nforever\n    change [y v] by (-1)\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n        change [x v] by (1)\n    end\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n        change [x v] by (-1)\n    end\n    set [x v] to ((x) * (0.9))\n    change x by (x)\n    if <<touching (levels v)?> and <not <<touching color (#ff0000)?> or <touching color (#29ff00)?>>>> then\n        speed\n        if <<touching (levels v)?> and <not <<touching color (#ff0000)?> or <touching color (#29ff00)?>>>> then\n            change y by (-6)\n            sx\n            if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<touching (levels v)?> and <not <<touching color (#ff0000)?> or <touching color (#29ff00)?>>>>> or <<mouse down?> and <((mouse y) - (y position)) > [50]>>> then\n                set [y v] to [12]\n                if <([abs v] of (x) ) = (x)> then\n                    set [x v] to [-8]\n                else\n                    set [x v] to [8]\n                end\n            else\n                set [x v] to [0]\n            end\n        end\n    end\n    change y by (y)\n    if <<touching (levels v)?> and <not <<touching color (#ff0000)?> or <touching color (#29ff00)?>>>> then\n        sy\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <(y) < [0]>> then\n            set [y v] to [14]\n        else\n            set [y v] to [0]\n        end\n    end\n    if <<touching color (#ff0000)?> or <touching color (#29ff00)?>> then\n        go to x: (-200) y: (-85)\n    end\n    if <[212] < (x position)> then\n        broadcast (next backdrop v)\n        go to x: (-200) y: (-85)\n    end\n    if <touching color (#37b700)?> then\n        broadcast (escape v)\n    end\n    if <<(y position) > [180]> and <(variable) > [1]>> then\n        broadcast (the sky v)\n        go to x: (-200) y: (-85)\n    end\n    if <(level) = [15]> then\n        broadcast (ice place v) and wait\n    end\nend\n\nwhen I receive [start 2 v]\nshow\nchange y by (-1)\nforever\n    create clone of (_myself_ v)\n    wait (0.05) seconds\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\ngo [backward v] (1) layers\nhide\n\nwhen I receive [ice place v]\nhide\n\nwhen flag clicked\nhide variable [x v]\nhide variable [y v]\nforever\n    if <<<(current [date v]) > [0]> and <(current [date v]) < [2]>> and <<(current [month v]) > [3]> and <(current [month v]) < [5]>>> then\n        change [color v] effect by (3)\n    end\nend\n\nwhen I receive [start 2 v]\nforever\n    play sound [Frantic-Factory v] until done\nend\n\nwhen I receive [start 3 ice v]\nhide\n\n@Levels\n\nwhen I receive [next backdrop v]\nif <(costume [number v]) < [16]> then\n    next costume\n    change [level v] by (1)\nelse\n    switch costume to (costume11 v)\nend\n\nwhen I receive [start 2 v]\nshow\nforever\n    if <(costume [name v]) = [costume10]> then\n        broadcast (escape v)\n        set [variable v] to [0]\n    end\n    if <(costume [number v]) = [12]> then\n        broadcast (text hide v)\n        set [variable v] to [0]\n    end\n    if <(costume [number v]) = [11]> then\n        broadcast (gold cave v)\n        set [variable v] to [5]\n    end\n    if <(costume [number v]) = [12]> then\n        set [variable v] to [0]\n    end\n    if <(costume [number v]) = [15]> then\n        broadcast (ice place v)\n        switch costume to (costume14 v)\n    end\nend\n\nwhen flag clicked\nset [lobby? v] to [0]\nhide variable [your time v]\nset [variable v] to [0]\nswitch costume to (costume1 v)\nhide\n\nwhen I receive [the sky v]\nswitch costume to (costume16 v)\nset [variable v] to [5]\n\nwhen I receive [ice place v]\nshow variable [your time v]\nset [lobby? v] to [5]\nhide\n\nwhen I receive [start 2 v]\nswitch costume to (costume1 v)\n\nwhen I receive [start 2 v]\nset [your time v] to [0]\nrepeat until <(lobby?) = [5]>\n    wait (1) seconds\n    change [your time v] by (1)\nend\n\n@Thumbnail\n\nwhen flag clicked\nswitch costume to (costume1 v)\nshow\nset [ghost v] effect to (100)\ngo to [front v] layer\ngo to x: (0) y: (1)\n\n@Love fave\n\nwhen I receive [start 2 v]\nswitch costume to (costume2 v)\nset [costume v] to [0]\nhide\nforever\n    if <not <<(LOVED__) = [1]> and <(FAVED___) = [1]>>> then\n        wait (pick random (30) to (40)) seconds\n        switch costume to (costume1 v)\n        go to x: (0) y: (50)\n        show\n        go to [front v] layer\n        start sound [pop v]\n        repeat (9)\n            change y by (-6)\n        end\n        repeat (5)\n            change y by (3)\n        end\n        repeat (5)\n            change y by (-1)\n        end\n        wait (2) seconds\n        repeat (15)\n            change y by (7)\n        end\n        hide\n    end\n    if <(Costume) > [0]> then\n        hide\n        stop [this script v]\n    end\n    if <(backdrop [number v]) = [2]> then\n        switch costume to (costume2 v)\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen this sprite clicked\nsay [DO IT NOW!!!] for (2) seconds\n\n@Gold thing\n\nwhen flag clicked\nhide\n\nwhen I receive [gold cave v]\nshow\nforever\n    if <touching color (#efefef)?> then\n        hide\n    end\nend\n\nwhen I receive [text hide v]\nhide\n\nwhen I receive [the sky v]\nhide\n\n@Start game\n\nwhen I receive [start v]\nshow\n\nwhen flag clicked\nset [ghost v] effect to (0)\nswitch costume to (costume2 v)\nhide\ngo to x: (0) y: (3)\n\nwhen I receive [start 2 v]\nhide\n\n@Play button\n\nwhen flag clicked\nset [fade v] to [0]\ngo to x: (-134) y: (-135)\nset size to (70) %\nhide\n\nwhen I receive [start v]\nshow\n\nwhen this sprite clicked\nset size to (80) %\nwait (0.3) seconds\nset size to (70) %\nswitch backdrop to (backdrop1 v)\nhide\nbroadcast (start 2 v)\n\n@Intro\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\nswitch backdrop to (backdrop6 v)\nswitch costume to (costume1 v)\nstop all sounds\nstart sound [sound1 v]\nset size to (100) %\nwait (4) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nnext costume\nset size to (84) %\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (3) seconds\nbroadcast (start v)\nset volume to (100) %\nhide\n\nwhen flag clicked\nforever\n    if <(Your time) > (☁ highscore time)> then\n        set [☁ highscore time v] to (Your time)\n    end\nend\n\nwhen [space v] key pressed\nstop all sounds\nbroadcast (start v)\nhide\n\n@Highscore\n\nwhen flag clicked\nset [fade v] to [no]\nhide\n\nwhen I receive [ice place v]\nwait until <(fade) = [yes]>\ngo to x: (-7) y: (-83)\nshow\n\nset [☁ highscore time v] to [38]\n\nwhen flag clicked\nforever\n    switch costume to (☁ highscore time)\nend\n\n@Outro\n\nwhen flag clicked\nset [ghost v] effect to (0)\nswitch costume to (costume1 v)\nhide\n\nwhen I receive [ice place v]\nshow\nrepeat (3)\n    wait (2) seconds\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    next costume\n    repeat (10)\n        change [ghost v] effect by (-10)\n    end\n    wait (2) seconds\nend\nset [fade v] to [yes]\nbroadcast (start 3 ice v)\nhide\n\nwhen I receive [ice place v]\nstop all sounds\nplay sound [Castle Crashers - End Of Level Theme.mp3 v] until done\n\n