Stickman Platformer

Instructions: CONTROLS:\nArrow keys: move\nUp arrow: jump\nR: restart level\nenjoy\nCreated with MESGAME

@Stage\n\nwhen flag clicked\nbroadcast (spawn v)\nset [level v] to [1]\n\nwhen flag clicked\nforever\n    set [level v] to (join (level) [/21])\nend\n\nwhen I receive [next level v]\nchange [level v] by (1)\n\nwhen [space v] key pressed\nif <(username) = [MESYETI]> then\n    ask [Type level select password] and wait\n    if <(answer) = [gottagofast]> then\n        ask [Go to level:] and wait\n        set [level v] to (answer)\n    end\nend\n\nwhen flag clicked\nforever\n    play sound [10-sky-sanctuary v] until done\nend\n\n@Player\n\nwhen I receive [spawn v]\ngo to x: (-185) y: (101)\nset [player y speed v] to [0]\n\nwhen flag clicked\nforever\n    if <not <touching (level v)?>> then\n        change [player y speed v] by (-1)\n        change y by (player y speed)\n        change [player in air v] by (1)\n    end\n    collision\nend\n\ndefine collision\nif <not <(player touching wall) = [1]>> then\n    if <touching (level v)?> then\n        if <not <(player y speed) > [0]>> then\n            if <touching color (#ff0000)?> then\n                broadcast (spawn v)\n            end\n            repeat until <not <touching (level v)?>>\n                change y by (1)\n                set [player y speed v] to [0]\n                set [player in air v] to [0]\n            end\n        end\n    end\nend\nif <<touching (level v)?> and <(player y speed) > [0]>> then\n    repeat until <not <touching (level v)?>>\n        change y by (-2)\n        set [player y speed v] to [0]\n    end\nend\nif <(player touching wall) = [1]> then\n    move (-5) steps\nend\n\nwhen flag clicked\nset rotation style [left-right v]\nforever\n    if <key (right arrow v) pressed?> then\n        point in direction (90)\n        move (5) steps\n    end\n    if <key (left arrow v) pressed?> then\n        point in direction (-90)\n        move (5) steps\n    end\nend\n\nwhen flag clicked\nforever\n    if <<[2] > (player in air)> and <key (up arrow v) pressed?>> then\n        start sound [Jump v]\n        change y by (10)\n        set [player y speed v] to [12]\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (level v)?> then\n        set [player in air v] to [0]\n    end\nend\n\nwhen flag clicked\n\nwhen I receive [spawn v]\nwait (.1) seconds\nwait until <(x position) > [230]>\nbroadcast (spawn v)\nbroadcast (Next level v)\n\nwhen flag clicked\nforever\n    if <<key (left arrow v) pressed?> or <key (right arrow v) pressed?>> then\n        switch costume to (run1 v)\n        wait (0) seconds\n        switch costume to (run2 v)\n        wait (0) seconds\n        switch costume to (run3 v)\n        wait (0) seconds\n        switch costume to (run4 v)\n        wait (0) seconds\n        switch costume to (run5 v)\n        wait (0) seconds\n        switch costume to (run6 v)\n        wait (0) seconds\n        switch costume to (run7 v)\n        wait (0) seconds\n        switch costume to (run8 v)\n        wait (0) seconds\n        switch costume to (run9 v)\n        wait (0) seconds\n    else\n        switch costume to (idle v)\n    end\nend\n\nwhen [r v] key pressed\nbroadcast (spawn v)\n\n@Level\n\nwhen flag clicked\nswitch costume to (costume1 v)\nforever\n    switch costume to (level)\nend\n\nwhen flag clicked\nwait (1) seconds\nwait until <(level) = [21]>\nstart sound [Win v]\n\n@Wall Detection\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    if <touching (level v)?> then\n        set [player touching wall v] to [1]\n    else\n        set [player touching wall v] to [0]\n    end\nend\n\nwhen flag clicked\nforever\n    go to (player v)\nend\n\n@Thumb\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    go to [front v] layer\nend\n\n