Stickman - Platformer


@Stage\n\nwhen flag clicked\nswitch backdrop to (1 v)\n\nwhen [space v] key pressed\nif <(backdrop [number v]) = [1]> then\n    switch backdrop to (2 v)\nend\n\nwhen flag clicked\n\n@Sprite4\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (1 v)\nhide\n\nwhen I receive [next level v]\nnext costume\n\nwhen [space v] key pressed\nshow\n\nwhen backdrop switches to [3 v]\ngo to [front v] layer\n\n@Frames\n\nwhen [timer v] > (0.1)\nswitch costume to (stopnaill v)\ngo to [front v] layer\nshow\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    hide\n    reset timer\nend\n\nwhen I receive [end v]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\ngo to [front v] layer\nswitch costume to (thumbnaill v)\nset [ghost v] effect to (100)\nshow\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\nstop [all v]\n\nwhen flag clicked\nerase all\nswitch costume to (shadow v)\nset size to (100) %\ngo to x: (0) y: (0)\nset [ghost v] effect to (90)\nstamp\nhide\n\n@Player\n\nwhen backdrop switches to [2 v]\nset size to (100) %\nshow\nrepeat (4)\n    go to x: (-200) y: (-96)\nend\n\nwhen flag clicked\nforever\n    if <not <(backdrop [number v]) = [1]>> then\n        if <<key (right arrow v) pressed?> or <key (left arrow v) pressed?>> then\n            switch costume to (join [Walk ] (Walk))\n        end\n        if <not <key (up arrow v) pressed?>> then\n            if <not <key (any v) pressed?>> then\n                switch costume to (idle v)\n            end\n        else\n            switch costume to (jump v)\n            wait (0.7) seconds\n            switch costume to (fall v)\n            wait (0.8) seconds\n            wait until <not <key (up arrow v) pressed?>>\n        end\n    end\nend\n\ndefine Death effect\nstart sound [Oops v]\ncreate clone of (_myself_ v)\nset [xv v] to [0]\nset [yv v] to [0]\ngo to x: (-210) y: (-94)\n\nwhen flag clicked\npoint in direction (90)\nwait until <key (space v) pressed?>\nset [xv v] to [0]\nset [yv v] to [0]\nforever\n    change [yv v] by (-0.25)\n    if <key (left arrow v) pressed?> then\n        change [xv v] by (-0.75)\n        point in direction (-90)\n    end\n    if <key (right arrow v) pressed?> then\n        change [xv v] by (0.75)\n        point in direction (90)\n    end\n    set [xv v] to ((XV) * (0.9))\n    change x by (XV)\n    if <touching (sprite4 v)?> then\n        change y by (1)\n        if <touching (sprite4 v)?> then\n            change y by (1)\n            if <touching (sprite4 v)?> then\n                change y by (1)\n                if <touching (sprite4 v)?> then\n                    change y by (1)\n                    if <touching (sprite4 v)?> then\n                        change y by (1)\n                        if <touching (sprite4 v)?> then\n                            change y by (1)\n                            if <touching (sprite4 v)?> then\n                                change y by (-6)\n                                if <key (up arrow v) pressed?> then\n                                    set [yv v] to [8]\n                                    if <(XV) > [0]> then\n                                        set [xv v] to [-10]\n                                    else\n                                        set [xv v] to [10]\n                                    end\n                                else\n                                    change x by ((XV) * (-1))\n                                    set [xv v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (YV)\n    if <touching (sprite4 v)?> then\n        change y by ((YV) * (-1))\n        set [yv v] to [0]\n    end\n    change y by (-0.5)\n    if <<touching (sprite4 v)?> and <key (up arrow v) pressed?>> then\n        set [yv v] to [6]\n    end\n    change y by (0.5)\n    if <key (r v) pressed?> then\n        set [xv v] to [0]\n        set [yv v] to [0]\n        go to x: (-210) y: (-94)\n    end\n    if <[225] < (x position)> then\n        set [xv v] to [0]\n        set [yv v] to [0]\n        go to x: (-210) y: (-94)\n        broadcast (next level v)\n    end\n    if <touching (sprite2 v)?> then\n        Death effect\n    end\nend\n\nwhen I start as a clone\nclear graphic effects\nswitch costume to (idle v)\ngo to [front v] layer\nrepeat (10)\n    change y by (5)\n    change [ghost v] effect by (10)\nend\n\nwhen flag clicked\nforever\n    if <([costume # v] of [sprite4 v]) = [9]> then\n        switch backdrop to (3 v)\n    end\nend\n\nwhen flag clicked\ngo to x: (-133) y: (-114)\nset size to (200) %\nshow\n\nwhen flag clicked\nset [walk v] to [1]\nforever\n    if <<key (left arrow v) pressed?> or <key (right arrow v) pressed?>> then\n        change [walk v] by (1)\n        wait (0.02) seconds\n        if <(Walk) > [4]> then\n            set [walk v] to [1]\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <<<not <key (left arrow v) pressed?>> and <not <key (right arrow v) pressed?>>> and <<not <key (up arrow v) pressed?>> and <not <key (down arrow v) pressed?>>>> then\n        switch costume to (idle v)\n    end\nend\n\n@Sprite2\n\nwhen flag clicked\ngo to [front v] layer\ngo to x: (0) y: (0)\nswitch costume to (1 v)\nhide\n\nwhen I receive [next level v]\nnext costume\n\nwhen [space v] key pressed\nshow\n\n