Darkness: A Platformer

Instructions: Welcome to Darkness! \n\nInstructions: Arrow keys to move, try to avoid all gaps in the ground! \n\nStory: You are lost, trapped in darkness with only a light around you to see. Try to beat all the levels to get your way out!\n\nAll levels are 100% possible, but it is difficult. 

@Stage\n\n@Player\n\nwhen flag clicked\nshow\ngo to x: (-183) y: (-105)\nset [yv v] to [0]\nset [xv v] to [0]\nforever\n    platform physics (12) (-1) (0.9) (0.8) (8) (8)\nend\n\ndefine platform physics (jump height) (gravity) (friction) (movement speed) (wall jump vm) (wall jump hm)\nchange y by (Yv)\nif <touching (level v)?> then\n    repeat ([abs v] of (Yv) )\n        if <touching (level v)?> then\n            change y by ((-1) * (([abs v] of (Yv) ) / (Yv)))\n        end\n    end\n    if <<key (up arrow v) pressed?> and <not <(Yv) > [0]>>> then\n        set [yv v] to (jump height)\n    else\n        set [yv v] to [0]\n    end\nelse\n    change [yv v] by (gravity)\nend\nif <key (right arrow v) pressed?> then\n    change [xv v] by (movement speed)\nend\nif <key (left arrow v) pressed?> then\n    change [xv v] by ((-1) * (movement speed))\nend\nchange x by (Xv)\nif <touching (level v)?> then\n    set [y v] to (y position)\n    repeat (([abs v] of (Xv) ) + (1))\n        if <touching (level v)?> then\n            change y by (1)\n        end\n    end\n    if <touching (level v)?> then\n        set y to (Y)\n        repeat ([ceiling v] of ([abs v] of (Xv) ) )\n            if <touching (level v)?> then\n                change x by ((-1) * (([abs v] of (Xv) ) / (Xv)))\n            end\n        end\n        if <key (up arrow v) pressed?> then\n            if <(Xv) < [0]> then\n                set [xv v] to [0]\n                if <key (left arrow v) pressed?> then\n                    set [xv v] to (wall jump hm)\n                    set [yv v] to (wall jump vm)\n                end\n            else\n                set [xv v] to [0]\n                if <key (right arrow v) pressed?> then\n                    set [xv v] to ((-1) * (wall jump hm))\n                    set [yv v] to (wall jump vm)\n                end\n            end\n        end\n    end\nend\nset [xv v] to ((Xv) * (friction))\n\nwhen flag clicked\nswitch costume to (curved_block v)\nset size to (100) %\nforever\n    if <(x position) > [210]> then\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n        go to x: (-183) y: (-105)\n        broadcast (nl v)\n        repeat (10)\n            change [ghost v] effect by (-10)\n        end\n    end\n    if <(y position) < [-175]> then\n        broadcast (Die v)\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n        go to x: (-183) y: (-105)\n        repeat (10)\n            change [ghost v] effect by (-10)\n        end\n    end\nend\n\nwhen I receive [end v]\nhide\nstop [other scripts in sprite v]\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\n\nwhen backdrop switches to [blue sky v]\nhide\n\n@Light\n\nwhen I start as a clone\nshow\nset [ghost v] effect to (80)\nforever\n    go to [back v] layer\n    change x by ((([x position v] of [player v]) - (x position)) / (3))\n    change y by ((([y position v] of [player v]) - (y position)) / (3))\n    set size to (((6) * ([sin v] of ((timer) * (60)) )) + (80)) %\nend\n\nwhen I receive [nl v]\ngo to (player v)\n\nwhen I receive [die v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nwait (0.03) seconds\nrepeat (2)\n    change [ghost v] effect by (-10)\nend\n\nwhen I receive [bounce v]\nclear graphic effects\nset [ghost v] effect to (80)\nrepeat (10)\n    change [color v] effect by (-4)\nend\nwait (0.5) seconds\nrepeat (10)\n    change [color v] effect by (4)\nend\nclear graphic effects\nset [ghost v] effect to (80)\n\nwhen flag clicked\nshow\ngo to (player v)\nswitch costume to (costume3 v)\nrepeat (2)\n    next costume\n    create clone of (_myself_ v)\nend\nnext costume\nshow\nset [ghost v] effect to (80)\nforever\n    go to [back v] layer\n    change x by ((([x position v] of [player v]) - (x position)) / (3))\n    change y by ((([y position v] of [player v]) - (y position)) / (3))\n    set size to (((6) * ([sin v] of ((timer) * (60)) )) + (80)) %\nend\n\nwhen I receive [end v]\nhide\n\nwhen backdrop switches to [blue sky v]\nhide\n\n@Level\n\nwhen flag clicked\nset [level v] to [1]\nswitch costume to (1 v)\nforever\n    go to x: (0) y: (0)\nend\n\nwhen I receive [nl v]\nchange [level v] by (1)\nnext costume\n\nwhen flag clicked\nforever\n    if <(LEVEL) = [13]> then\n        switch backdrop to (blue sky v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(LEVEL) = [12]> then\n        switch backdrop to (near end v)\n    end\nend\n\n@Thumb\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\nshow\nhide\n\n