Speedrunner - a platformer

Instructions: ooo, scrolling platformer!\n\nArrow keys or wasd to move around\n\ncan you make the fastest time?

@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\nhide variable [ree v]\nhide variable [☁ reee v]\nforever\n    play sound [THE WORLD REVOLVING - Deltarune OST v] until done\nend\n\nwhen I receive [epic v]\nswitch backdrop to (backdrop2 v)\nchange [ree v] by (backtime)\nrepeat (10)\n    if <(ree) < (☁ reee)> then\n        set [☁ reee v] to (ree)\n    end\nend\nshow variable [☁ reee v]\nshow variable [ree v]\n\n@m a p\n\nwhen flag clicked\nreset timer\nswitch costume to (costume1 v)\nset size to (1500) %\nswitch costume to (1 v)\ngo to [front v] layer\nshow\ngo to x: (3350) y: (-175)\nset x to (3350)\nforever\n    set [x. v] to (x position)\n    set [ex v] to (x position)\n    if <(X) > [1]> then\n        change x by (join [-] (X))\n    else\n        change x by ((X) - ((X) * (2)))\n    end\nend\n\nwhen I receive [ydied v]\ngo to x: (3350) y: (-175)\n\nwhen I receive [epic v]\nhide\n\n@h\n\nwhen I receive [zmove v]\n\nwhen flag clicked\nbroadcast (zmove v)\npoint in direction (90)\nshow\n\nwhen I receive [zmove v]\ngo to x: (0) y: (0)\nforever\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        point in direction (90)\n        change [x v] by (1)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change [x v] by (-1)\n        point in direction (-90)\n    end\n    set [x v] to ((X) * (0.9))\n    if <touching color (#000000)?> then\n        change y by (0.5)\n        if <touching color (#000000)?> then\n            change y by (0.5)\n            if <touching color (#000000)?> then\n                change y by (0.5)\n                if <touching color (#000000)?> then\n                    change y by (0.5)\n                    if <touching color (#000000)?> then\n                        change y by (0.5)\n                        if <touching color (#000000)?> then\n                            change y by (0.5)\n                            if <touching color (#000000)?> then\n                                change y by (0.5)\n                                if <touching color (#000000)?> then\n                                    change y by (0.5)\n                                    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                                        if <[0] < (X)> then\n                                            set [x v] to [-7]\n                                        else\n                                            set [x v] to [7]\n                                        end\n                                        set [y v] to [7]\n                                    else\n                                        set [x v] to ((X) * (-1.3))\n                                        change x by (X)\n                                        set [x v] to [0]\n                                        change x by ((X) / (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    change [y v] by (-0.5)\n    change y by (Y)\n    if <touching color (#000000)?> then\n        switch costume to (costume1 v)\n        set [y v] to ((Y) * (-0.25))\n        change y by (Y)\n        if <touching color (#000000)?> then\n            change y by (Y)\n            if <touching color (#000000)?> then\n                change y by (Y)\n                if <touching color (#000000)?> then\n                    change y by (Y)\n                end\n            end\n        end\n    end\n    change y by (-1)\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <touching color (#000000)?>> then\n        set [y v] to [10]\n    end\n    change y by (1)\n    if <touching color (#fd0000)?> then\n        go to x: (0) y: (0)\n        broadcast (ydied v)\n    end\nend\n\nwhen I receive [zmove v]\nforever\n    if <touching (_edge_ v)?> then\n        go to x: (0) y: (0)\n        broadcast (ydied v)\n    end\nend\n\nwhen I receive [zmove v]\nforever\n    if <touching color (#66ff72)?> then\n        set [x v] to [30]\n        set [y v] to [5]\n    end\nend\n\nwhen I receive [zmove v]\nforever\n    if <touching color (#ff85fa)?> then\n        set [x v] to [0]\n        set [y v] to [15]\n    end\nend\n\nwhen I receive [zmove v]\nforever\n    if <touching color (#ffb800)?> then\n        set [x v] to [-30]\n        set [y v] to [5]\n    end\nend\n\nwhen I receive [zmove v]\ngo to [front v] layer\nforever\n    if <touching color (#66d4ff)?> then\n        change [x v] by (150)\n        wait (0) seconds\n        set [x v] to [0]\n        set [y v] to [0]\n    end\nend\n\nchange [x v] by (500)\nwait (0) seconds\nset [x v] to [0]\nset [y v] to [0]\n\nwhen I receive [zmove v]\ngo to [front v] layer\nforever\n    if <touching color (#ff5858)?> then\n        hide\n        set [ree v] to (timer)\n        stop [other scripts in sprite v]\n        wait (1) seconds\n        broadcast (epic v)\n        stop [this script v]\n    end\nend\n\n@chest1\n\nwhen flag clicked\nset [backtime v] to [0]\nswitch costume to (costume1 v)\ngo to [back v] layer\nshow\nset y to (55)\nforever\n    set x to ((x.) - (2550))\nend\n\nwhen flag clicked\nwait until <touching (h v)?>\nswitch costume to (costume2 v)\nchange [backtime v] by (-10)\nstart sound [pop v]\n\n@chest2\n\nwhen flag clicked\nswitch costume to (costume1 v)\ngo to [back v] layer\nshow\nset y to (100)\nforever\n    set x to ((x.) + (169))\nend\n\nwhen flag clicked\nwait until <touching (h v)?>\nswitch costume to (costume2 v)\nchange [backtime v] by (-10)\nstart sound [pop v]\n\nset y to (0)\n\n@white\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\n\n@chest3\n\nwhen flag clicked\nswitch costume to (costume1 v)\ngo to [back v] layer\nshow\nset y to (95)\nforever\n    set x to ((x.) + (325))\nend\n\nwhen flag clicked\nwait until <touching (h v)?>\nswitch costume to (costume2 v)\nchange [backtime v] by (-10)\nstart sound [pop v]\n\n@chest4\n\nwhen flag clicked\nswitch costume to (costume1 v)\ngo to [back v] layer\nshow\nset y to (50)\nforever\n    set x to ((x.) + (725))\nend\n\nwhen flag clicked\nwait until <touching (h v)?>\nswitch costume to (costume2 v)\nchange [backtime v] by (-10)\nstart sound [pop v]\n\n@chest5\n\nwhen flag clicked\nswitch costume to (costume1 v)\ngo to [back v] layer\n\nshow\nset y to (0)\nforever\n    set x to ((x.) + (169))\nend\n\nwhen flag clicked\nwait until <touching (h v)?>\nswitch costume to (costume2 v)\n\n@Sprite1\n\ngo to x: (0) y: (0)\ngo to [front v] layer\nshow\n\nwhen flag clicked\nhide\n\n