moonlight - pixel platformer

Instructions: wasd or arrow keys\n3 levels so far

@Stage\n\n@Tileset\n\n@Ground\n\ngo to x: (0) y: (0)\n\nset drag mode [not draggable v]\n\nwhen flag clicked\nforever\n    switch costume to (level)\nend\n\n@Decor\n\ngo to x: (0) y: (0)\ngo to [back v] layer\n\nwhen flag clicked\nforever\n    switch costume to (level)\nend\n\n@Water\n\nwhen flag clicked\ngo to x: (-10) y: (-50)\nforever\n    erase all\n    set [ghost v] effect to (75)\n    set y to ((-150) + ((([sin v] of ((timer) * (100)) ) * (20)) + (-10)))\n    stamp\n    set y to ((-150) + ((([sin v] of ((timer) * (100)) ) * (15)) + (-30)))\n    stamp\n    set y to ((-150) + ((([sin v] of ((timer) * (100)) ) * (10)) + (-50)))\n    stamp\n    set [ghost v] effect to (100)\n    set y to ((-150) + ((([sin v] of ((timer) * (100)) ) * (5)) + (-80)))\n    stamp\nend\n\nhide\n\nwhen flag clicked\nforever\n    switch costume to (level)\nend\n\n@PixelMan\n\ndefine Y Collisions (y)\nrepeat until <not <touching (ground v)?>>\n    if <(y) > [0]> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [falling v] to [0]\n    end\n    set [y v] to [0]\nend\n\ndefine X Collisions (x) (s) (h) (l)\nif <touching (ground v)?> then\n    repeat (s)\n        change y by (1)\n        if <not <touching (ground v)?>> then\n            stop [this script v]\n        end\n    end\n    change y by (() - (s))\n    repeat until <not <touching (ground v)?>>\n        if <(x) > [0]> then\n            change x by (-1)\n        else\n            change x by (1)\n        end\n    end\nend\nif <<<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<key (left arrow v) pressed?> or <key (a v) pressed?>>> and <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n    if <(x) > [0]> then\n        if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n            if <not <<(l) < [3]> or <<(l) = [0]> or <(l) = []>>>> then\n                set [x v] to ((l) * (-1))\n            end\n        end\n    else\n        if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n            if <not <<(l) < [3]> or <<(l) = [0]> or <(l) = []>>>> then\n                set [x v] to (l)\n            end\n        end\n    end\n    if <not <<(h) < [3]> or <<(h) = [0]> or <(h) = []>>>> then\n        set [y v] to (h)\n    end\nelse\n    set [x v] to [0]\nend\n\nwhen flag clicked\nset rotation style [left-right v]\ngo to x: (-175) y: (20)\nset [level v] to [1]\nset [x v] to [0]\nset [y v] to [0]\nforever\n    Platformer || X speed: [2] Y speed: [10] Jump time: [1] Slope: [8] Gravity: [-1] Friction: [.7] WJ Height: [0] WJ Length: [0]\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        point in direction (90)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        point in direction (-90)\n    end\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<key (left arrow v) pressed?> or <key (a v) pressed?>>> then\n        change [frame v] by (0.5)\n    else\n        set [frame v] to [0]\n    end\n    if <(x position) = [240]> then\n        go to x: (-175) y: (20)\n        change [level v] by (1)\n        set [x v] to [0]\n        set [y v] to [0]\n    end\n    if <(y position) = [-186]> then\n        go to x: (-175) y: (20)\n        set [x v] to [0]\n        set [y v] to [0]\n    end\nend\n\ndefine Platformer || X speed: (x) Y speed: (y) Jump time: (t) Slope: (s) Gravity: (g) Friction: (f) WJ Height: (h) WJ Length: (l)\nswitch costume to (hitbox v)\nchange [falling v] by (1)\nchange [y v] by (g)\nif <not <(x) > [8]>> then\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        change [x v] by (x)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change [x v] by ((x) * (-1))\n    end\nend\nchange x by (x)\nif <touching (ground v)?> then\n    X Collisions (x) (s) (h) (l)\nend\nchange y by (y)\nif <touching (ground v)?> then\n    Y Collisions (y)\nend\nif <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <(falling) < (t)>> then\n    set [y v] to (y)\nend\nset [x v] to ((x) * (f))\nSet Costume\n\ndefine Set Costume\nif <(falling) < [6]> then\n    if <(frame) = [0]> then\n        switch costume to (idle1 v)\n    else\n        switch costume to ([floor v] of ((2) + ((frame) mod (6))) )\n    end\nelse\n    if <(y) > [0]> then\n        switch costume to (pixelman7 v)\n    else\n        switch costume to (pixelman6 v)\n    end\nend\n\n