Flatland [Platformer]

Instructions: \n

@Stage\n\nwhen flag clicked\nforever\n    play sound [06 Grass Land Overworld \(NSMBWii\) v] until done\nend\n\nwhen I receive [next level v]\nnext backdrop\n\nwhen flag clicked\nswitch backdrop to ([sin v] of (90) )\nset [brightness v] effect to (-10)\n\n@Player\n\nwhen flag clicked\nset size to (150) %\ngo to [front v] layer\nRespawn [-210] [0]\nset [paused v] to [0]\nset [level v] to [1]\nset [frame counter v] to [0]\nset [deaths on hard level v] to [0]\nforever\n    if <(paused) = [0]> then\n        switch costume to (hitbox v)\n        change [y speed v] by (-1)\n        Change Y (y speed)\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <(touching ground) = [1]>> then\n            set [y speed v] to [15]\n            start sound [WU_SE_PLY_JUMP_HIGH_ v]\n        end\n        if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n            change [x speed v] by (2)\n        end\n        if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n            change [x speed v] by (-2)\n        end\n        if <(x speed) > [9]> then\n            set [x speed v] to [9]\n        else\n            if <(x speed) < [-9]> then\n                set [x speed v] to [-9]\n            end\n        end\n        Change X (x speed)\n        if <(x speed) > [0]> then\n            change [x speed v] by (-1)\n        else\n            if <(x speed) < [0]> then\n                change [x speed v] by (1)\n            end\n        end\n        switch costume to (cube v)\n        change [frame counter v] by (1)\n        if <(frame counter) = [99]> then\n            set [frame counter v] to [0]\n        end\n        if <((frame counter) mod (3)) = [0]> then\n            create clone of (_myself_ v)\n        end\n        if <<(x position) > [239]> and <not <(level) = [16]>>> then\n            Respawn [-210] [0]\n            start sound (pick random (5) to (7))\n            change [level v] by (1)\n            broadcast (Next Level v) and wait\n        end\n        if <<touching (rising lava v)?> or <touching (spikes v)?>> then\n            change [deaths on hard level v] by (1)\n            set [death sound v] to [1]\n            Respawn [-210] [0]\n        end\n    end\nend\n\ndefine Respawn (x) (y)\nset x to (x)\nset y to (y)\n\ndefine Change X (x speed)\nset [slope v] to [0]\nif <(touching ground) = [1]> then\n    set [max slope v] to [15]\nelse\n    set [max slope v] to [1]\nend\nchange x by (x speed)\nif <touching (platforms v)?> then\n    repeat until <<not <touching (platforms v)?>> or <(slope) = (max slope)>>\n        change y by (1)\n        change [slope v] by (1)\n    end\nend\nif <(slope) = (max slope)> then\n    change y by (() - (slope))\n    set [x speed v] to [0]\n    if <(x speed) > [0]> then\n        repeat until <not <touching (platforms v)?>>\n            change x by (-1)\n        end\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            set [y speed v] to [15]\n            set [x speed v] to [-10]\n            start sound (pick random (3) to (4))\n        end\n    else\n        repeat until <not <touching (platforms v)?>>\n            change x by (1)\n        end\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            set [y speed v] to [15]\n            set [x speed v] to [10]\n            start sound (pick random (3) to (4))\n        end\n    end\nend\nif <(touching ground) = [1]> then\n    change y by (-15)\n    if <touching (platforms v)?> then\n        repeat until <not <touching (platforms v)?>>\n            change y by (1)\n        end\n    else\n        change y by (15)\n    end\nend\n\ndefine Change Y (y speed)\nchange y by (y speed)\nset [touching ground v] to [0]\nif <touching (platforms v)?> then\n    set [y speed v] to [0]\n    if <<(y speed) > [0]> or <(y speed) = [0]>> then\n        repeat until <not <touching (platforms v)?>>\n            change y by (-1)\n        end\n    else\n        set [touching ground v] to [1]\n        repeat until <not <touching (platforms v)?>>\n            change y by (1)\n        end\n    end\nend\n\nwhen I start as a clone\nset size to (150) %\nrepeat (20)\n    change [ghost v] effect by (5)\n    change size by (-5)\nend\ndelete this clone\n\nwhen I receive [next level v]\nset [deaths on hard level v] to [0]\ndelete this clone\n\nwhen I receive [skip level v]\nRespawn [-210] [0]\nbroadcast (Next Level v) and wait\n\nwhen flag clicked\nforever\n    if <(death sound) = [1]> then\n        play sound [WU_SE_VOC_MA_DAMAGE_LAST v] until done\n        set [death sound v] to [0]\n    end\nend\n\n@Platforms\n\nwhen I receive [next level v]\nnext costume\n\nwhen flag clicked\nset [brightness v] effect to (5)\nswitch costume to ([sin v] of (90) )\n\n@Rising Lava\n\nwhen flag clicked\nswitch costume to (lava v)\n\nwhen flag clicked\ngo to x: (0) y: (-15)\nforever\n    repeat (20)\n        change y by (.5)\n        wait (.01) seconds\n    end\n    repeat (20)\n        change y by (-.5)\n        wait (.01) seconds\n    end\nend\n\n@Spikes\n\nwhen flag clicked\nset [brightness v] effect to (-5)\nswitch costume to ([sin v] of (90) )\n\nwhen I receive [next level v]\nnext costume\n\n@Clouds\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    repeat (20)\n        change y by (-.5)\n        wait (.01) seconds\n    end\n    repeat (20)\n        change y by (.5)\n        wait (.01) seconds\n    end\nend\n\nwhen flag clicked\nswitch costume to ([sin v] of (90) )\n\nwhen I receive [next level v]\nnext costume\n\n@Platform Designer\n\n@End\n\nwhen flag clicked\nhide\ngo to [front v] layer\nwait (1) seconds\nwait until <(level) = [16]>\nstart sound [Goal Cheer v]\nwait (6) seconds\ngo to x: (0) y: (389)\nshow\nglide (3) secs to x: (0) y: (0)\nset [paused v] to [1]\n\nwhen flag clicked\nforever\n    go to [front v] layer\nend\n\n@Le7els\n\nwhen I receive [next level v]\nnext costume\n\nwhen flag clicked\npoint in direction (90)\nshow\nset [brightness v] effect to (5)\nswitch costume to ([sin v] of (90) )\nforever\n    go to [front v] layer\nend\n\n@Sprite1\n\nwhen flag clicked\nforever\n    if <(deaths on hard level) > [4]> then\n        show\n        go to [front v] layer\n    else\n        hide\n    end\nend\n\nwhen this sprite clicked\nif <([x position v] of [player v]) < [210]> then\n    set [deaths on hard level v] to [0]\n    hide\n    change [level v] by (1)\n    broadcast (Skip Level v)\nend\n\n