A Very Hard Platformer

Instructions: Use the arrow keys to move around.\nAvoid red and spikes.\nYellow makes you jump higher.\nPress "r" to restart a level.\nTry to beat the high score if you can!\nIf you enjoyed this, please give it a  ❤ , ★ and comment if you can!\nFull screen is recommended.\nWhen you're finished, please check out my other games too!\nhttps://scratch.mit.edu/studios/4685976/projects/

@Stage\n\nwhen I receive [next v]\nwait (0.01) seconds\nnext backdrop\n\nwhen I receive [play v]\nswitch backdrop to (backdrop1 v)\nforever\n    set [level v] to (backdrop [number v])\nend\n\nwhen I receive [instructions v]\nswitch backdrop to (backdrop11 v)\n\nwhen I receive [menu v]\nswitch backdrop to (backdrop4 v)\n\nwhen I receive [leaderboard v]\nswitch backdrop to (backdrop12 v)\n\nwhen flag clicked\nswitch backdrop to (backdrop13 v)\nset [ghost v] effect to (100)\nrepeat (50)\n    change [ghost v] effect by (-2)\n    wait (0.05) seconds\nend\nwait (5) seconds\nrepeat (50)\n    change [ghost v] effect by (2)\n    wait (0.05) seconds\nend\nswitch backdrop to (backdrop4 v)\nrepeat (10)\n    change [ghost v] effect by (-10)\n    wait (0.05) seconds\nend\n\n@Sprite1\n\nwhen flag clicked\nhide\n\nwhen I receive [play v]\nforever\n    set [sfc v] to ((deaths) * (15))\nend\n\ndefine reset\ngo to x: (-224) y: (-150)\n\nwhen I receive [play v]\nforever\n    if <key (r v) pressed?> then\n        reset\n    end\n    if <<touching color (#ff0000)?> or <<touching color (#666666)?> or <(y position) < [-170]>>> then\n        change [deaths v] by (1)\n        reset\n    end\n    if <touching color (#ffff00)?> then\n        set [yv v] to [10]\n    end\n    if <<touching (sprite2 v)?> or <<<key (q v) pressed?> and <key (w v) pressed?>> and <key (e v) pressed?>>> then\n        broadcast (next v)\n        reset\n    end\nend\n\nwhen backdrop switches to [backdrop20 v]\nbroadcast (finish v)\nhide\n\nwhen I receive [play v]\nrepeat until \n    wait (1) seconds\n    change [time v] by (1)\n    if <(backdrop [name v]) = [backdrop20]> then\n        stop [this script v]\n    end\nend\n\nwhen I receive [play v]\ngo to [front v] layer\nshow\nset size to (30) %\ngo to x: (-224) y: (-152)\nshow variable [level v]\nset [level v] to [1]\nset [deaths v] to [0]\nset [time v] to [0]\nset [xv v] to [0]\nset [yv v] to [0]\nset [score v] to [0]\nset [☁ world high score v] to (☁ world high score)\nforever\n    if <key (left arrow v) pressed?> then\n        change [xv v] by (-0.3)\n    end\n    if <key (right arrow v) pressed?> then\n        change [xv v] by (0.3)\n    end\n    change x by (xv)\n    set [xv v] to ((xv) * (0.9))\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                            if <key (up arrow v) pressed?> then\n                                if <(xv) > [0]> then\n                                    set [xv v] to [-3]\n                                else\n                                    set [xv v] to [3]\n                                end\n                                set [yv v] to [5]\n                            else\n                                set [xv v] to ((xv) * (-1.3))\n                                change x by (xv)\n                                set [xv v] to [0]\n                                change x by ((xv) / (5))\n                            end\n                            change y by (-5)\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [yv v] by (-0.5)\n    change y by (yv)\n    if <touching color (#000000)?> then\n        set [yv v] to ((yv) * (-0.25))\n        change y by (yv)\n        if <touching color (#000000)?> then\n            change y by (yv)\n            if <touching color (#000000)?> then\n                change y by (yv)\n                if <touching color (#000000)?> then\n                    change y by (yv)\n                end\n            end\n        end\n    end\n    change y by (-1)\n    if <<touching color (#000000)?> and <key (up arrow v) pressed?>> then\n        set [yv v] to [5]\n    end\n    change y by (1)\nend\n\nwhen I receive [finish v]\nforever\n    set [score v] to ((10000) - ((time) + (sfc)))\nend\n\nwhen I receive [finish v]\nforever\n    if <(score) > (☁ world high score)> then\n        set [☁ world high score v] to (score)\n    end\nend\n\n@Sprite2\n\nwhen flag clicked\nhide\n\nwhen I receive [play v]\ngo to [front v] layer\nshow\nset size to (20) %\ngo to x: (231) y: (-141)\n\nwhen backdrop switches to [backdrop15 v]\ngo to x: (231) y: (165)\n\nwhen backdrop switches to [backdrop20 v]\nhide\n\n@Sprite3\n\nwhen backdrop switches to [backdrop4 v]\nswitch costume to (costume2 v)\ngo to [front v] layer\nshow\ngo to x: (40) y: (-42)\n\nwhen this sprite clicked\nbroadcast (play v)\nhide\n\nwhen flag clicked\nforever\n    if <touching (mouse-pointer v)?> then\n        switch costume to (costume1 v)\n    else\n        switch costume to (costume2 v)\n    end\nend\n\nwhen I receive [instructions v]\nhide\n\nwhen I receive [leaderboard v]\nhide\n\nwhen flag clicked\nhide\n\n@Sprite4\n\nwhen backdrop switches to [backdrop4 v]\nswitch costume to (costume2 v)\ngo to [front v] layer\nshow\ngo to x: (-95) y: (-42)\n\nwhen flag clicked\nforever\n    if <touching (mouse-pointer v)?> then\n        switch costume to (costume1 v)\n    else\n        switch costume to (costume2 v)\n    end\nend\n\nwhen this sprite clicked\nbroadcast (leaderboard v)\nhide\n\nwhen I receive [play v]\nhide\n\nwhen I receive [instructions v]\nhide\n\nwhen flag clicked\nhide\n\n@Sprite5\n\nwhen backdrop switches to [backdrop4 v]\nswitch costume to (costume2 v)\ngo to [front v] layer\nshow\ngo to x: (172) y: (-42)\n\nwhen this sprite clicked\nbroadcast (instructions v)\nhide\n\nwhen flag clicked\nforever\n    if <touching (mouse-pointer v)?> then\n        switch costume to (costume1 v)\n    else\n        switch costume to (costume2 v)\n    end\nend\n\nwhen I receive [play v]\nhide\n\nwhen I receive [leaderboard v]\nhide\n\nwhen flag clicked\nhide\n\n@Sprite6\n\nwhen flag clicked\nhide\n\nwhen I receive [instructions v]\nset size to (100) %\ngo to [front v] layer\nshow\ngo to x: (172) y: (-41)\n\nwhen this sprite clicked\nbroadcast (menu v)\nhide\n\nwhen I receive [leaderboard v]\nset size to (100) %\ngo to [front v] layer\nshow\ngo to x: (172) y: (-67)\n\nwhen backdrop switches to [backdrop20 v]\nset size to (80) %\ngo to [front v] layer\nshow\ngo to x: (208) y: (-73)\n\n@0-Pixel\n\nwhen flag clicked\nhide\n\nwhen I receive [leaderboard v]\ngo to [front v] layer\nshow\nset size to (300) %\ngo to x: (-164) y: (11)\nforever\n    switch costume to ((letter (1) of (☁ world high score)) + (1))\nend\n\nwhen I receive [menu v]\nhide\n\nwhen backdrop switches to [backdrop20 v]\ngo to [front v] layer\nshow\ngo to x: (-168) y: (3)\nforever\n    switch costume to ((letter (1) of (score)) + (1))\nend\n\n@0-Pixel2\n\nwhen flag clicked\nhide\n\nwhen I receive [leaderboard v]\ngo to [front v] layer\nshow\nset size to (300) %\ngo to x: (-66) y: (11)\nforever\n    switch costume to ((letter (2) of (☁ world high score)) + (1))\nend\n\nwhen I receive [menu v]\nhide\n\nwhen backdrop switches to [backdrop20 v]\ngo to [front v] layer\nshow\ngo to x: (-61) y: (2)\nforever\n    switch costume to ((letter (2) of (score)) + (1))\nend\n\n@0-Pixel3\n\nwhen flag clicked\nhide\n\nwhen I receive [leaderboard v]\ngo to [front v] layer\nshow\nset size to (300) %\ngo to x: (34) y: (11)\nforever\n    switch costume to ((letter (3) of (☁ world high score)) + (1))\nend\n\nwhen I receive [menu v]\nhide\n\nwhen backdrop switches to [backdrop20 v]\ngo to x: (51) y: (11)\ngo to [front v] layer\nshow\nforever\n    switch costume to ((letter (3) of (score)) + (1))\nend\n\n@0-Pixel4\n\nwhen flag clicked\nhide\n\nwhen I receive [leaderboard v]\ngo to [front v] layer\nshow\nset size to (300) %\ngo to x: (132) y: (11)\nforever\n    switch costume to ((letter (4) of (☁ world high score)) + (1))\nend\n\nwhen I receive [menu v]\nhide\n\nwhen backdrop switches to [backdrop20 v]\ngo to [front v] layer\nshow\ngo to x: (146) y: (1)\nforever\n    switch costume to ((letter (4) of (score)) + (1))\nend\n\n@Sprite7\n\nwhen flag clicked\ngo to [front v] layer\nshow\ngo to x: (0) y: (0)\nset size to (0) %\nset [ghost v] effect to (100)\nrepeat (50)\n    change size by (2)\n    change [ghost v] effect by (-2)\n    wait (0.05) seconds\nend\nwait (5) seconds\nrepeat (50)\n    change y by (5)\n    change size by (-2)\n    change [ghost v] effect by (2)\n    wait (0.05) seconds\nend\n\n