Cave Platformer

Instructions: Arrow Keys to move.\nPress R to restart.\n2nd Version :\nhttps://scratch.mit.edu/projects/866393203/ 

@Stage\n\nwhen flag clicked\nset volume to (50) %\nforever\n    play sound [159 Xenogenesis v] until done\nend\n\n@ground\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\nswitch costume to (costume1 v)\n\nwhen I receive [next level v]\nnext costume\n\nwhen flag clicked\nshow\n\nwhen flag clicked\nset [time v] to [0]\nforever\n    change [time v] by (1)\n    wait (1) seconds\n    if <(costume [number v]) = [20]> then\n        set [ya v] to [1]\n        if <(ya) = [1]> then\n            if <(☁ best time) > (time)> then\n                set [☁ best time v] to (time)\n            end\n        end\n        set [ya v] to [0]\n    end\nend\n\n@danger\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\nswitch costume to (costume1 v)\n\nwhen I receive [next level v]\nnext costume\n\nwhen [z v] key pressed\nif <<(username) = [basandbubba]> or <(username) = [04tmoody-collab]>> then\n    hide\nend\n\nwhen [z v] key pressed\nif <(username) = [Babsandbubba]> then\n    hide\nend\n\n@player\n\nwhen flag clicked\nerase all\ngo to x: (-200) y: (-50)\nset [xv v] to [0]\nset [yv v] to [0]\nshow\nforever\n    physics\n    if <(x position) > [235]> then\n        go to x: (-200) y: (-50)\n        set [xv v] to [0]\n        set [yv v] to [0]\n        broadcast (next level v)\n    end\n    if <<[-175] > (y position)> or <<touching (danger v)?> or <key (r v) pressed?>>> then\n        broadcast (die v)\n        wait (0.01) seconds\n        go to x: (-200) y: (-50)\n        set [xv v] to [0]\n        set [yv v] to [0]\n    end\nend\n\ndefine physics\nif <<key (left arrow v) pressed?> or <<(mouse x) < [0]> and <mouse down?>>> then\n    change [xv v] by (-2)\nend\nif <<key (right arrow v) pressed?> or <<[0] < (mouse x)> and <mouse down?>>> then\n    change [xv v] by (2)\nend\nset [xv v] to ((xv) * (0.8))\nchange x by (xv)\nif <touching (ground v)?> then\n    repeat until <not <touching (ground v)?>>\n        change x by (([abs v] of (xv) ) / (() - (xv)))\n    end\n    set [xv v] to [0]\nend\nchange [yv v] by (-1)\nif <<<key (up arrow v) pressed?> or <<[0] < (mouse y)> and <mouse down?>>> and <(can jump?) = [1]>> then\n    set [yv v] to [15]\nend\nchange y by (yv)\nset [can jump? v] to [0]\nif <touching (ground v)?> then\n    repeat until <not <touching (ground v)?>>\n        change y by (([abs v] of (yv) ) / (() - (yv)))\n    end\n    if <(yv) < [0]> then\n        set [can jump? v] to [1]\n    end\n    set [yv v] to [0]\nend\n\nwhen [z v] key pressed\nif <(username) = [braveowl]> then\n    hide\nend\n\nwhen flag clicked\nswitch costume to (costume1 v)\nforever\n    if <touching color (#ff0000)?> then\n        go to x: (-200) y: (-50)\n    end\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nrepeat (10)\n    change size by (-10)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nwhen I receive [next skin v]\nnext costume\n\nwhen I receive [die v]\ndelete this clone\n\n@thumbnail\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\nforever\n    switch costume to (costume2 v)\n    show\n    go to [front v] layer\nend\n\n@Mark\n\nwhen flag clicked\nforever\n    hide\nend\n\nwhen I receive [die v]\ngo to (player v)\nstamp\n\nwhen I receive [next level v]\nerase all\n\n