Power-ups a platformer part 1

Instructions: PART 2 https://scratch.mit.edu/projects/595734690/\nArrow keys to move.\nTouch yellow to switch gravity to upside down.\nTouch purple to switch gravity to normal.\nTouch lightblue to jump higher.\nTouch mint to move a little bit to the right.\nTouch  lightpurple to move a little bit to the left.\nTouch red to switch controls.

@Stage\n\n@Level\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\nforever\n    switch costume to (Level)\nend\n\n@Lava\n\nwhen flag clicked\nset [timer v] to [0]\nforever\n    set [tide v] to [0]\n    repeat (10)\n        change [tide v] by (1)\n    end\n    repeat (20)\n        change [tide v] by (-1)\n    end\n    repeat (10)\n        change [tide v] by (1)\n    end\nend\n\nwhen flag clicked\nforever\n    set y to (Tide)\n    switch costume to (Level)\nend\n\nreset timer\nset y to (4)\n\n@Spikes\n\nwhen flag clicked\nshow\nforever\n    switch costume to (Level)\nend\n\n@detector\n\nwhen flag clicked\nhide\nset [faved___ v] to [0]\nset [loved__ v] to [0]\nset [clone id v] to [0]\ncreate clone of (_myself_ v)\nwait (0.2) seconds\nset [clone id v] to [1]\ncreate clone of (_myself_ v)\nwait until <<(LOVED__) = [1]> and <(FAVED___) = [1]>>\nwait (1) seconds\nbroadcast (Message v)\nshow\ngo to [front v] layer\ngo to x: (0) y: (50)\nreset timer\nswitch costume to (pick random (1) to (4))\nset [ghost v] effect to (100)\nrepeat until <(timer) > [3.5]>\n    change y by ((y position) / (-15))\n    change [ghost v] effect by (-3)\nend\nreset timer\nrepeat until <(timer) > [3.5]>\n    change y by (((y position) - (-100)) / (-15))\n    change [ghost v] effect by (10)\nend\n\nwhen I start as a clone\nif <(clone id) = [0]> then\n    go to x: (-15) y: (0)\n    set [loved__ v] to [0]\n    switch costume to (love v)\n    forever\n        set [love? v] to <touching (mouse-pointer v)?>\n        if <touching (mouse-pointer v)?> then\n            set [loved__ v] to [1]\n        end\n    end\nend\nif <(clone id) = [1]> then\n    go to x: (0) y: (0)\n    switch costume to (fave v)\n    set [faved___ v] to [0]\n    forever\n        set [fav v] to <touching (mouse-pointer v)?>\n        if <touching (mouse-pointer v)?> then\n            set [faved___ v] to [1]\n        end\n    end\nend\n\n@Joining\n\nwhen flag clicked\nhide\n\nwhen I receive [connecting v]\nswitch costume to (joining v)\nshow\n\nwhen flag clicked\nswitch costume to (sun v)\nshow\ngo to [front v] layer\n\n@Sprite1\n\nwhen flag clicked\nset [costume v] to [0]\nhide\nforever\n    wait (pick random (2) to (12)) 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        change [ghost v] effect by (-10)\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        change [ghost v] effect by (10)\n    end\n    hide\n    if <(Costume) > [0]> then\n        hide\n        stop [this script v]\n    end\nend\n\nif <not <<(LOVED__) = [1]> and <(FAVED___) = [1]>>> then\nend\n\n@Thumbnail\n\nwhen flag clicked\nhide\ngo to [back v] layer\n\nwhen flag clicked\nforever\n    reset timer\nend\n\nwhen [timer v] > (0.1)\nshow\nset [ghost v] effect to (100)\nrepeat (10)\n    go to [front v] layer\n    change [ghost v] effect by (-10)\nend\n\ngo to x: (0) y: (0)\n\n@power ups\n\nwhen flag clicked\nhide\n\ndefine costume (costume) x: (x) y: (y)\nswitch costume to (costume)\nset x to (x)\nset y to (y)\ncreate clone of (_myself_ v)\n\nwhen I receive [next level v]\ngo to [front v] layer\ndelete\nif <(Level) = [1]> then\n    costume [6] x: [-3] y: [-51]\nelse\n    if <(Level) = [2]> then\n        delete\n        costume [3] x: [54] y: [-61]\n        costume [blank] x: [999] y: [999]\n    else\n        if <(Level) = [5]> then\n            costume [7] x: [-149] y: [-70]\n        end\n    end\nend\n\ncostume [1] x: [-20] y: [-50]\ncostume [2] x: [10] y: [50]\ncostume [1] x: [40] y: [-50]\ncostume [2] x: [70] y: [50]\ncostume [1] x: [100] y: [-50]\ncostume [2] x: [130] y: [50]\ncostume [1] x: [160] y: [-50]\ncostume [2] x: [190] y: [50]\n\ncostume [blank] x: [] y: []\nstop [this script v]\n\ncostume [blank] x: [] y: []\nstop [this script v]\n\nwhen I start as a clone\nshow\n\ndefine delete\nrepeat (1000)\n    delete this clone\nend\n\ncostume [3] x: [-80] y: [-50]\n\ncostume [2] x: [-30] y: [50]\n\ncostume [1] x: [80] y: [-50]\ncostume [2] x: [30] y: [50]\n\nwhen I start as a clone\nclear graphic effects\nforever\n    if <touching (cube v)?> then\n        wait (0.2) seconds\n        repeat (20)\n            change [ghost v] effect by (5)\n        end\n    end\nend\n\nwhen I receive [restart v]\ndelete\n\nwhen I receive [restart v]\nif <(Level) = [1]> then\n    costume [6] x: [-3] y: [-51]\nelse\n    if <(Level) = [2]> then\n        delete\n        costume [3] x: [54] y: [-61]\n        costume [blank] x: [999] y: [999]\n    else\n        if <(Level) = [5]> then\n            costume [7] x: [-149] y: [-70]\n        end\n    end\nend\ndelete\n\nif <(Level) = [3]> then\n\n@Спрайт 1\n\ngo to x: (0) y: (0)\n\nwhen flag clicked\nhide\nset [ghost v] effect to (100)\n\nwhen I receive [show v]\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\n    wait (0.01) seconds\nend\nwait (5) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\n    wait (0.01) seconds\nend\n\n@Cube\n\nwhen I start as a clone\nclear graphic effects\nrepeat (10)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nwhen flag clicked\nforever\n    if <(Level) = [9]> then\n        broadcast (The End So  Ya v)\n    end\nend\n\nchange y by (10)\n\nset [gravity v] to [0]\n\nset y to (93)\n\nwhen flag clicked\nforever\n    change y by ((y vel) / (30))\nend\n\nwhen flag clicked\nforever\n    if <(gravity) = [0]> then\n        if <<touching (door v)?> or <touching (level v)?>> then\n            change y by (1)\n        end\n        if <<touching (door v)?> or <touching (level v)?>> then\n            change y by (1)\n        end\n        if <<touching (door v)?> or <touching (level v)?>> then\n            change y by (1)\n        end\n        if <<touching (door v)?> or <touching (level v)?>> then\n            change y by (1)\n        end\n        if <<touching (door v)?> or <touching (level v)?>> then\n            change y by (-4)\n            change x by ((x vel) * (-1))\n            if <key (up arrow v) pressed?> then\n                if <(x vel) > [0]> then\n                    set [x vel v] to [-10]\n                else\n                    set [x vel v] to [10]\n                end\n                set [y vel v] to [15]\n            else\n                set [x vel v] to [0]\n            end\n        end\n        change [y vel v] by (-1)\n        change y by (y vel)\n        if <<touching (door v)?> or <touching (level v)?>> then\n            change y by ((y vel) - ((y vel) * (2)))\n            set [y vel v] to [0]\n        end\n        change y by (-1)\n        if <<<touching (door v)?> or <touching (level v)?>> and <key (up arrow v) pressed?>> then\n            set [y vel v] to [15]\n        end\n        change y by (1)\n        create clone of (_myself_ v)\n        if <(x position) > [250]> then\n            change [level v] by (1)\n            broadcast (NEXT LEVEL v) and wait\n        end\n    end\nend\n\nif <touching (bounce v)?> then\n    set [y vel v] to [19]\nend\nif <touching (enemy v)?> then\n    set [y vel v] to [15]\nend\nif  then\n    change y by (1)\nend\nif  then\n    change y by (1)\nend\nif  then\n    change y by (1)\nend\nif <touching (door v)?> then\n    change y by (1)\nend\nif <touching (door v)?> then\n    change y by (-4)\n    change x by ((x vel) * (-1))\n    if <key (up arrow v) pressed?> then\n        if <(x vel) > [0]> then\n            set [x vel v] to [-10]\n        else\n            set [x vel v] to [10]\n        end\n        set [y vel v] to [15]\n    else\n        set [x vel v] to [0]\n    end\nend\nchange [y vel v] by (-1)\nchange y by (y vel)\nif <touching (door v)?> then\n    change y by ((y vel) - ((y vel) * (2)))\n    set [y vel v] to [0]\nend\nchange y by (-1)\nif <<touching (door v)?> and <key (up arrow v) pressed?>> then\n    set [y vel v] to [15]\nend\nchange y by (1)\ncreate clone of (_myself_ v)\nif <(x position) > [250]> then\n    change [level v] by (1)\n    broadcast (NEXT LEVEL v) and wait\nend\n\nset [y vel v] to [20]\n\nset [gravity v] to [0]\n\nrepeat (10)\n    change y by (10)\n    turn right (10) degrees\n    change size by (-5)\nend\n\nwhen I receive [next level v]\npoint in direction (90)\nset size to (100) %\nset [gravity v] to [0]\nset [x vel v] to [0]\nset [y vel v] to [0]\ngo to x: (-201) y: (-4)\n\nwhen I receive [next level v]\nset [change v] to [0]\n\nwhen I receive [restart v]\nset [change v] to [0]\n\nwhen flag clicked\nforever\n    play sound [chill-out-atmospheric-4950 v] until done\nend\n\nwhen flag clicked\nshow\nset [change v] to [0]\nset [level v] to [1]\nbroadcast (NEXT LEVEL v)\nforever\n    if <(Level) = [3]> then\n        if <touching color (#240ab3)?> then\n            set x to (153)\n            set y to (98)\n            set [xv v] to [0]\n            set [y vel v] to [0]\n        end\n    else\n        if <touching color (#240ab3)?> then\n            set x to (96)\n            set y to (32)\n            set [xv v] to [0]\n            set [y vel v] to [0]\n        end\n    end\n    if <[-170] > (y position)> then\n        broadcast (restart v) and wait\n    end\n    if <touching color (#feea02)?> then\n        set [gravity v] to [1]\n        start sound [Zoop v]\n    end\n    if <touching color (#ce03f8)?> then\n        set [gravity v] to [0]\n        start sound [Zoop v]\n    end\n    if <touching color (#59ff96)?> then\n        set [x vel v] to [40]\n        start sound [Zoop v]\n    end\n    if <touching color (#59d0ff)?> then\n        set [y vel v] to [20]\n        start sound [Zoop v]\n    end\n    if <touching color (#a042ff)?> then\n        set [x vel v] to [-10]\n        start sound [Zoop v]\n    end\n    if <touching color (#ff5656)?> then\n        set [change v] to [1]\n        broadcast (show v)\n        start sound [Zoop v]\n    end\n    if <(change) = [1]> then\n        if <key (left arrow v) pressed?> then\n            change [x vel v] by (1)\n        end\n        if <key (right arrow v) pressed?> then\n            change [x vel v] by (-1)\n        end\n    else\n        if <key (left arrow v) pressed?> then\n            change [x vel v] by (-1)\n        end\n        if <key (right arrow v) pressed?> then\n            change [x vel v] by (1)\n        end\n    end\n    set [x vel v] to ((x vel) * (0.9))\n    change x by (x vel)\n    if <(gravity) = [1]> then\n        if <touching (level v)?> then\n            change y by (-0.5)\n            if <touching (level v)?> then\n                change y by (-0.5)\n                if <touching (level v)?> then\n                    change y by (-0.5)\n                    if <touching (level v)?> then\n                        change y by (-0.5)\n                        if <touching (level v)?> then\n                            change y by (-0.5)\n                            if <touching (level v)?> then\n                                change y by (-0.5)\n                                if <touching (level v)?> then\n                                    change y by (-0.5)\n                                    if <touching (level v)?> then\n                                        change y by (-0.5)\n                                        if <touching (level v)?> then\n                                            if <key (up arrow v) pressed?> then\n                                                if <(Xv2) > [0]> then\n                                                    set [xv2 v] to [-7]\n                                                else\n                                                    set [xv2 v] to [7]\n                                                end\n                                                set [y vel v] to [-9]\n                                            else\n                                                set [xv2 v] to ((Xv2) * (-1.3))\n                                                change x by (Xv2)\n                                                set [y vel v] to [0]\n                                                change x by ((Xv2) / (5))\n                                            end\n                                            change y by (4)\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        change [y vel v] by (0.5)\n        change y by (y vel)\n        if <touching (level v)?> then\n            set [y vel v] to ((y vel) * (-0.25))\n            change y by (y vel)\n            if <touching (level v)?> then\n                change y by (y vel)\n                if <touching (level v)?> then\n                    change y by (y vel)\n                    if <touching (level v)?> then\n                        change y by (y vel)\n                    end\n                end\n            end\n        end\n        change y by (1)\n        if <<touching (level v)?> and <key (up arrow v) pressed?>> then\n            set [y vel v] to [-9]\n        end\n        change y by (-1)\n    end\n    if <touching (spikes v)?> then\n        repeat (10)\n            change y by (10)\n            turn right (10) degrees\n            change size by (-5)\n        end\n        broadcast (restart v)\n    end\n    if <(x position) > [240]> then\n        change [level v] by (1)\n        broadcast (NEXT LEVEL v) and wait\n    end\n    create clone of (_myself_ v)\nend\n\nwhen I receive [next level v]\nbroadcast (restart v)\n\nwhen I receive [restart v]\npoint in direction (90)\nset size to (100) %\nset [gravity v] to [0]\nset [x vel v] to [0]\nset [y vel v] to [0]\ngo to x: (-226) y: (-4)\n\nwhen flag clicked\ngo to x: (-224) y: (-3)\n\nwhen flag clicked\nforever\n    if <touching (lava v)?> then\n        broadcast (restart v)\n    end\nend\n\nforever\n\n@Спрайт 2\n\ndefine portal1 pos x: (x) portal pos y: (y)\nshow\nswitch costume to (костюм 1 v)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\n\nwhen I receive [next level v]\nshow\nif <(Level) = [3]> then\n    portal1 pos x: [-160] portal pos y: [0]\n    Portal pos x: [153] pos y: [98]\nelse\n    if <(Level) = [8]> then\n        portal1 pos x: [-90] portal pos y: [-25]\n        Portal pos x: [96] pos y: [32]\n    else\n        hide\n    end\nend\n\ndefine Portal pos x: (x) pos y: (y)\nshow\nswitch costume to (костюм 2 v)\ngo to x: (x) y: (y)\n\nwhen I receive [restart v]\ndelete this clone\n\nwhen I receive [restart v]\nshow\nif <(Level) = [3]> then\n    portal1 pos x: [-160] portal pos y: [0]\n    Portal pos x: [153] pos y: [98]\nelse\n    if <(Level) = [8]> then\n        portal1 pos x: [-90] portal pos y: [-25]\n        Portal pos x: [96] pos y: [32]\n    else\n        hide\n    end\nend\n\n@door\n\nwhen I receive [open v]\nstop [other scripts in sprite v]\nrepeat (10)\n    change y by (10)\nend\n\nwhen I receive [next level v]\nif <(Level) = [4]> then\n    show\n    go to x: (215) y: (16)\nelse\n    if <(Level) = [7]> then\n        show\n        go to x: (215) y: (16)\n    else\n        hide\n    end\n    go to [back v] layer\n    go [forward v] (1) layers\nend\n\nwhen I receive [restart v]\nif <(Level) = [4]> then\n    show\n    go to x: (215) y: (16)\nelse\n    if <(Level) = [7]> then\n        show\n        go to x: (215) y: (16)\n    else\n        hide\n    end\n    go to [back v] layer\n    go [forward v] (1) layers\nend\n\n@Спрайт 3\n\nwhen flag clicked\nhide\nforever\n    if <(Level) = [4]> then\n        show\n        go to x: (-176) y: (161)\n    else\n        if <(Level) = [7]> then\n            show\n            go to x: (-176) y: (161)\n        else\n            hide\n        end\n    end\n    if <touching (cube v)?> then\n        broadcast (open v)\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n    end\nend\n\nhide\n\nwhen I receive [next level v]\nclear graphic effects\n\nwhen I receive [restart v]\nclear graphic effects\n\n@Level2\n\nwhen flag clicked\nshow\nforever\n    switch costume to (Level)\nend\n\ngo to x: (0) y: (0)\n\n