darkness || platformer

Instructions: (Check out my game contest: scratch.mit.edu/projects/671002344/)\n\nDarkness | A Platformer\n\nArrows keys or WASD to move.\nAvoid spikes and lava\nYou can jump on text! :D

@Stage\n\nwhen flag clicked\nforever\n    switch backdrop to (Level:)\nend\n\nwhen [o v] key pressed\nstop all sounds\n\nwhen flag clicked\nstart sound [Faded - Alan Walker v]\n\n@player\n\nwhen I start as a clone\nset [ghost v] effect to (0)\nshow\nset size to (40) %\nrepeat (10)\n    change size by (-2)\n    change [ghost v] effect by (16)\nend\ndelete this clone\n\ndefine ground (jump) (speed) (friction) (gravity)\nif <<<<key (right arrow v) pressed?> or <key (d v) pressed?>> and <(mobile?) = [0]>> or <(right) = [1]>> then\n    create clone of (_myself_ v)\n    switch costume to (player v)\n    change [xvel v] by (speed)\n    change [scroll x v] by (speed)\nend\nif <<<<key (left arrow v) pressed?> or <key (a v) pressed?>> and <(mobile?) = [0]>> or <(left) = [1]>> then\n    create clone of (_myself_ v)\n    switch costume to (player v)\n    change [xvel v] by ((speed) * (-1))\n    change [scroll x v] by ((speed) * (-1))\nend\nset [xvel v] to ((Xvel) * (friction))\nchange x by (Xvel)\nif <touching color (#4d9bff)?> then\n    start sound [boing v]\n    set [yvel v] to [14]\nend\nif <touching (level v)?> then\n    set [slope v] to [0]\n    repeat until <<(slope) = [8]> or <not <touching (level v)?>>>\n        change [slope v] by (1)\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by ((slope) * (-1))\n        repeat ([ceiling v] of ([abs v] of (Xvel) ) )\n            if <touching (level v)?> then\n                change x by ((([abs v] of (Xvel) ) / (Xvel)) * (-1))\n            end\n        end\n        set [xvel v] to [0]\n    end\nend\nchange y by (Yvel)\nif <touching (level v)?> then\n    repeat ([ceiling v] of ([abs v] of (Yvel) ) )\n        if <touching (level v)?> then\n            change y by ((([abs v] of (Yvel) ) / (Yvel)) * (-1))\n        end\n    end\n    if <<(([abs v] of (Yvel) ) / (Yvel)) = [-1]> and <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <(mobile?) = [0]>> or <(up) = [1]>>> then\n        start sound [High Whoosh v]\n        set [yvel v] to (jump)\n        set [scroll y v] to (jump)\n    else\n        set [yvel v] to [0]\n    end\nelse\n    change [yvel v] by (gravity)\nend\nif <<(x position) > [235]> or <<touching (key v)?> or >> then\n    set [yvel v] to [0]\n    set [xvel v] to [0]\n    change [level v] by (1)\n    go to x: (-211) y: (-20)\n    broadcast (next level\ v)\nend\nif <<(y position) < [-170]> or <<touching (ememies v)?> or >> then\n    set [yvel v] to [0]\n    set [xvel v] to [0]\n    go to x: (-211) y: (-20)\n    start sound [Crunch v]\nend\nif <<touching (hidden v)?> or > then\n    broadcast (hide v)\nend\n\nwhen flag clicked\nset size to (50) %\nswitch costume to (player v)\npoint in direction (90)\ngo to x: (-210) y: (-50)\nforever\n    ground [7.5] [.65] [.90] [-.35]\nend\n\nwhen flag clicked\nshow\n\n@level\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset [level v] to [1]\nforever\n    switch costume to (level)\nend\n\n@thumbnail\n\nwhen flag clicked\nforever\n    show\n    set [ghost v] effect to (100)\n    go to [front v] layer\nend\n\nstop [all v]\n\n@ememies\n\nwhen I receive [next level\ v]\nnext costume\n\nwhen flag clicked\nswitch costume to (costume1 v)\n\ngo to [back v] layer\n\n@light\n\npoint in direction (10)\n\nwhen flag clicked\nforever\n    go to [back v] layer\n    point towards (player v)\n    move ((distance to [player v]) / (2)) steps\nend\n\nwhen flag clicked\nforever\n    set size to (((6) * ([cos v] of ((timer) * (125)) )) + (50)) %\nend\n\n