2 Player Platformer

Instructions: Press R to restart a level if you get stuck\nRed player: arrow keys to move\nBlue player: WAD to move\nOnly one person has to get to the purple to win\nYou can jump on each other\n

@Stage\n\n@Player 1\n\nwhen I receive [play v]\nwait (0.2) seconds\nforever\n    wait until <[225] < (x position)>\n    change [level v] by (1)\nend\n\nwhen flag clicked\nbroadcast (Play 1 v)\nset size to (115) %\n\ndefine respawn\ngo to x: (-209) y: (-138)\nset [x v] to [0]\nset [y v] to [0]\n\nwhen I receive [play 1 v]\ngo to x: (-209) y: (-138)\nshow\nforever\n    change [y v] by (-1)\n    if <key (left arrow v) pressed?> then\n        change [x v] by (-1)\n    end\n    if <key (right arrow v) pressed?> then\n        change [x v] by (1)\n    end\n    if <touching color (#00ff24)?> then\n        change [hearts v] by (-1)\n        broadcast (Flash v) and wait\n        go to x: (-209) y: (-138)\n        set [x v] to [0]\n        set [y v] to [0]\n    end\n    set [x v] to ((x) * (0.9))\n    change x by (x)\n    if <touching color (#010101)?> then\n        change y by (1)\n    end\n    if <touching color (#010101)?> then\n        change y by (1)\n    end\n    if <touching color (#010101)?> then\n        change y by (1)\n    end\n    if <touching color (#010101)?> then\n        change y by (1)\n    end\n    if <touching color (#010101)?> then\n        change y by (-4)\n        change x by ((x) * (-1))\n        if <key (up arrow v) pressed?> then\n            set [y v] to [10]\n            if <([abs v] of (x) ) = (x)> then\n                set [x v] to [-10]\n            else\n                set [x v] to [10]\n            end\n        else\n            set [x v] to [0]\n        end\n    end\n    change y by (y)\n    if <touching color (#010101)?> then\n        change y by ((y) - ((y) * (2)))\n        set [y v] to [0]\n    end\n    change y by (-1)\n    if <<key (up arrow v) pressed?> and <touching color (#010101)?>> then\n        set [y v] to [10]\n    end\n    change y by (1)\nend\n\nwhen backdrop switches to [backdrop2 v]\ngo to x: (-209) y: (-138)\nset [x v] to [0]\nset [y v] to [0]\n\nwhen backdrop switches to [backdrop3 v]\ngo to x: (-209) y: (-138)\nset [x v] to [0]\nset [y v] to [0]\n\nwhen flag clicked\n\nwhen flag clicked\ngo to x: (-219) y: (-98)\nswitch backdrop to (backdrop1 v)\n\nwhen flag clicked\nforever\n    if <key (r v) pressed?> then\n        broadcast (Restart v)\n    end\nend\n\nwhen flag clicked\nhide\nwait (3) seconds\nshow\n\nwhen flag clicked\nset [hearts v] to [5]\n\nwhen I receive [restart v]\ngo to x: (-209) y: (-145)\n\nwhen flag clicked\nforever\n    if <touching color (#660080)?> then\n        next backdrop\n        broadcast (Restart v) and wait\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching color (#f20000)?> then\n        next backdrop\n        broadcast (Restart v) and wait\n    end\nend\n\n@Player 2\n\nwhen I receive [play v]\nwait (0.2) seconds\nforever\n    wait until <[225] < (x position)>\n    change [level v] by (1)\nend\n\nwhen flag clicked\nbroadcast (Play 1 v)\nset size to (115) %\n\ndefine respawn\ngo to x: (-195) y: (125)\nset [x v] to [0]\nset [y v] to [0]\n\nwhen I receive [play 1 v]\ngo to x: (-195) y: (125)\nshow\nforever\n    change [y v] by (-1)\n    if <key (a v) pressed?> then\n        change [x v] by (-1)\n    end\n    if <key (d v) pressed?> then\n        change [x v] by (1)\n    end\n    if <touching color (#00ff24)?> then\n        change [hearts v] by (-1)\n        broadcast (Flash v) and wait\n        go to x: (-195) y: (53)\n        set [x v] to [0]\n        set [y v] to [0]\n    end\n    set [x v] to ((x) * (0.9))\n    change x by (x)\n    if <touching color (#010101)?> then\n        change y by (1)\n    end\n    if <touching color (#010101)?> then\n        change y by (1)\n    end\n    if <touching color (#010101)?> then\n        change y by (1)\n    end\n    if <touching color (#010101)?> then\n        change y by (1)\n    end\n    if <touching color (#010101)?> then\n        change y by (-4)\n        change x by ((x) * (-1))\n        if <key (w v) pressed?> then\n            set [y v] to [10]\n            if <([abs v] of (x) ) = (x)> then\n                set [x v] to [-10]\n            else\n                set [x v] to [10]\n            end\n        else\n            set [x v] to [0]\n        end\n    end\n    change y by (y)\n    if <touching color (#010101)?> then\n        change y by ((y) - ((y) * (2)))\n        set [y v] to [0]\n    end\n    change y by (-1)\n    if <<key (w v) pressed?> and <touching color (#010101)?>> then\n        set [y v] to [10]\n    end\n    change y by (1)\nend\n\nwhen backdrop switches to [backdrop2 v]\ngo to x: (-195) y: (-128)\nset [x v] to [0]\nset [y v] to [0]\n\nwhen backdrop switches to [backdrop3 v]\ngo to x: (-195) y: (53)\nset [x v] to [0]\nset [y v] to [0]\n\nwhen flag clicked\ngo to x: (-195) y: (125)\nswitch backdrop to (backdrop1 v)\n\nwhen flag clicked\nhide\nwait (3) seconds\nshow\n\nwhen flag clicked\nset [hearts v] to [5]\n\nwhen I receive [restart v]\ngo to x: (-195) y: (125)\n\nwhen flag clicked\nforever\n    if <touching color (#b2a7b5)?> then\nend\n\nwhen flag clicked\n\nwhen flag clicked\nforever\n    if <touching color (#660080)?> then\n        next backdrop\n        broadcast (Restart v) and wait\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching color (#f20000)?> then\n        next backdrop\n        broadcast (Restart v) and wait\n    end\nend\n\n@Button\n\nwhen flag clicked\nhide\ngo to x: (-19) y: (0)\n\nwhen backdrop switches to [the true test v]\nshow\nforever\n    if <<touching (player 1 v)?> or <touching (player 2 v)?>> then\n        broadcast (Operate v) and wait\n        switch costume to (costume2 v)\n    end\nend\n\nnext costume\n\nwhen backdrop switches to [backdrop6 v]\nhide\n\n@danger\n\nwhen flag clicked\nhide\n\nwhen I receive [operate v]\nshow\n\nwhen backdrop switches to [backdrop6 v]\nforever\n    hide\nend\n\n@Thumbnail\n\nwhen flag clicked\nshow\ngo to [front v] layer\nhide\n\nwhen flag clicked\nforever\n    play sound [12 - Radioactive - Imagine Dragons v] until done\nend\n\n