Gravity Switch-A Platformer

Instructions: Use arrow keys to move! Space to switch gravity! Get to the yellow to get to the next level! Don't touch red! \nLove and fave for more levels!!! If you can't get past a level, press s!\n\nIf you like it, propose this to be featured here https://scratch.mit.edu/studios/4228481/ if you like it!

@Stage\n\n@Sprite1\n\nwhen flag clicked\nforever\n    if <(Gravity) = [2]> then\n        if <key (space v) pressed?> then\n            set [gravity v] to [1]\n            wait (.2) seconds\n        end\n    end\n    if <(Gravity) = [1]> then\n        if <key (space v) pressed?> then\n            set [gravity v] to [2]\n            wait (.2) seconds\n        end\n    end\nend\n\nwhen flag clicked\ngo to x: (-233) y: (-141)\nset [gravity v] to [1]\n\nwhen flag clicked\nset [deaths v] to [0]\nswitch backdrop to (backdrop1 v)\nforever\n    if <<touching color (#fff300)?> or <key (s v) pressed?>> then\n        next backdrop\n        go to x: (-233) y: (-141)\n        set [gravity v] to [1]\n        set [xv v] to [0]\n        set [yv v] to [0]\n        wait (1) seconds\n    end\n    if <touching color (#ff0000)?> then\n        go to x: (-233) y: (-141)\n        change [☁ total deaths worldwide v] by (1)\n        change [deaths v] by (1)\n        set [gravity v] to [1]\n        set [xv v] to [0]\n        set [yv v] to [0]\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Gravity) = [2]> then\n        if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<(x position) < (mouse x)> and <mouse down?>>> then\n            change [xv v] by (1)\n        end\n        if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<(mouse x) < (x position)> and <mouse down?>>> then\n            change [xv v] by (-1)\n        end\n        set [xv v] to ((Xv) * (0.9))\n        change x by (Xv)\n        if <touching color (#000000)?> then\n            change y by (-1)\n            if <touching color (#000000)?> then\n                change y by (-1)\n                if <touching color (#000000)?> then\n                    change y by (-1)\n                    if <touching color (#000000)?> then\n                        change y by (-1)\n                        if <touching color (#000000)?> then\n                            change y by (-1)\n                            if <touching color (#000000)?> then\n                                change x by ((Xv) * (-1))\n                                change y by (5)\n                                if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<(y position) < ((mouse y) + (30))> and <mouse down?>>> then\n                                    if <(Xv) > [0]> then\n                                        set [xv v] to [5]\n                                    else\n                                        set [xv v] to [-5]\n                                    end\n                                    set [yv v] to [-10]\n                                else\n                                    set [xv v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        change [yv v] by (1)\n        change y by (Yv)\n        if <touching color (#000000)?> then\n            change y by ((Yv) * (-1))\n            set [yv v] to [0]\n        end\n        change y by (1)\n        if <touching color (#000000)?> then\n            if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<(y position) < ((mouse y) + (30))> and <mouse down?>>> then\n                set [yv v] to [-15]\n            end\n        end\n        change y by (-1)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Gravity) = [1]> then\n        if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<(x position) < (mouse x)> and <mouse down?>>> then\n            change [xv v] by (1)\n        end\n        if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<(mouse x) < (x position)> and <mouse down?>>> then\n            change [xv v] by (-1)\n        end\n        set [xv v] to ((Xv) * (0.9))\n        change x by (Xv)\n        if <touching color (#000000)?> then\n            change y by (1)\n            if <touching color (#000000)?> then\n                change y by (1)\n                if <touching color (#000000)?> then\n                    change y by (1)\n                    if <touching color (#000000)?> then\n                        change y by (1)\n                        if <touching color (#000000)?> then\n                            change y by (1)\n                            if <touching color (#000000)?> then\n                                change x by ((Xv) * (-1))\n                                change y by (-5)\n                                if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<(y position) < ((mouse y) + (-30))> and <mouse down?>>> then\n                                    if <(Xv) > [0]> then\n                                        set [xv v] to [-5]\n                                    else\n                                        set [xv v] to [5]\n                                    end\n                                    set [yv v] to [10]\n                                else\n                                    set [xv v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        change [yv v] by (-1)\n        change y by (Yv)\n        if <touching color (#000000)?> then\n            change y by ((Yv) * (-1))\n            set [yv v] to [0]\n        end\n        change y by (-1)\n        if <touching color (#000000)?> then\n            if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<(y position) < ((mouse y) + (-30))> and <mouse down?>>> then\n                set [yv v] to [15]\n            end\n        end\n        change y by (1)\n    end\nend\n\n@Thumbnail\n\nwhen flag clicked\nforever\n    go to [front v] layer\n    show\n    go to x: (0) y: (0)\n    set [ghost v] effect to (100)\nend\n\n