Dot Platformer || A Platformer

Instructions: Arrow keys to move, up arrow to jump, don't touch spikes! Pretty short sadly :(\n\nFull screen recommended\n\nClick the green flag twice or the game will glitch like crazy :(

@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\n\nwhen [space v] key pressed\nnext backdrop\n\nwhen flag clicked\nforever\n    start sound [Nebula v]\nend\n\n@Spikes\n\nwhen flag clicked\ngo to [back v] layer\ngo to x: (0) y: (0)\nforever\n    switch costume to (Level)\nend\n\nwhen flag clicked\nforever\n    if <(costume [number v]) = [4]> then\n        repeat until <not <(costume [number v]) = [4]>>\n            repeat (20)\n                change y by (0.5)\n            end\n            repeat (20)\n                change y by (-0.5)\n            end\n        end\n    else\n        go to x: (0) y: (0)\n    end\nend\n\n@Sprite1\n\nwhen flag clicked\nforever\n    go to x: (0) y: (0)\n    set [ghost v] effect to (100)\n    go to [front v] layer\n    hide\nend\n\nwhen flag clicked\nshow\n\n@Menu\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\nshow\nforever\n    if <<(costume [number v]) = [1]> and <<mouse down?> and <touching (mouse-pointer v)?>>> then\n        next costume\n    end\nend\n\nwhen I receive [x out already v]\nnext costume\n\n@X\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\nforever\n    if <([costume # v] of [menu v]) = [2]> then\n        show\n        wait until <<mouse down?> and <touching (mouse-pointer v)?>>\n        broadcast (X out already v)\n    else\n        hide\n    end\nend\n\nwhen I receive [x out already v]\nhide\n\n@Player\n\nwhen flag clicked\nset size to (100) %\nbroadcast (Restart v)\nset [x vel v] to [0]\nset [level v] to [1]\nforever\n    if <<<key (a v) pressed?> or <key (left arrow v) pressed?>> or <<(x position) > (mouse x)> and <mouse down?>>> then\n        change [x vel v] by (-1)\n    end\n    if <<<key (d v) pressed?> or <key (right arrow v) pressed?>> or <<(mouse x) > (x position)> and <mouse down?>>> then\n        change [x vel v] by (1)\n    end\n    set [x vel v] to ((x vel) * (0.9))\n    change x by (x vel)\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (-4)\n        change x by ((x vel) * (-1))\n        if <<<key (w v) pressed?> or <key (up arrow v) pressed?>> or <<(mouse y) > (y position)> and <mouse down?>>> 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 (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 (level v)?> and <<<key (w v) pressed?> or <key (up arrow v) pressed?>> or <<(mouse y) > (y position)> and <mouse down?>>>> 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) > [239]> then\n        broadcast (Next level v) and wait\n        change [level v] by (1)\n    end\n    if <touching (spikes v)?> then\n        broadcast (Restart v)\n    end\n    if <(y position) = [-183]> then\n        broadcast (Restart v)\n    end\nend\n\nwhen I start as a clone\nclear graphic effects\nset [color v] effect to (10)\nrepeat (10)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nwhen I receive [next level v]\nbroadcast (Restart v)\n\nwhen I receive [restart v]\nset [x vel v] to [0]\nset [y vel v] to [0]\ngo to x: (-204) y: (94)\n\n@Retry\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\nforever\n    if <([costume # v] of [menu v]) = [2]> then\n        show\n    else\n        hide\n    end\nend\n\nwhen I receive [x out already v]\nhide\n\nwhen this sprite clicked\nbroadcast (Restart v)\n\n@Level\n\nwhen flag clicked\nforever\n    switch costume to (Level)\nend\n\n