Two Player Platformer 

Instructions: to move player 1 (the blue square) use the arrow keys. to move player 2 (the red square) use the wasd keys. Don't touch the spikes because in this world triangles are a no, no and try to get to the green to get to the next level. S key to skip a level and R to restart the level.

@Stage\n\n@player2\n\ndefine player\nif on edge, bounce\nchange [y2 v] by (-0.5)\nif <key (a v) pressed?> then\n    change [x2 v] by (-1)\nend\nif <key (d v) pressed?> then\n    change [x2 v] by (1)\nend\nset [x2 v] to ((X2) * (0.9))\nchange x by (X2)\nif <<touching (objects v)?> or <touching (player v)?>> then\n    change y by (1)\n    if <<touching (objects v)?> or <touching (player v)?>> then\n        change y by (1)\n        if <<touching (objects v)?> or <touching (player v)?>> then\n            change y by (1)\n            if <<touching (objects v)?> or <touching (player v)?>> then\n                change y by (1)\n                if <<touching (objects v)?> or <touching (player v)?>> then\n                    change y by (1)\n                    if <<touching (objects v)?> or <touching (player v)?>> then\n                        change y by (1)\n                        if <<touching (objects v)?> or <touching (player v)?>> then\n                            change y by (-6)\n                            change x by ((X2) * (-1))\n                            if <key (w v) pressed?> then\n                                set [y2 v] to [10]\n                                if <(X2) > [0]> then\n                                    set [x2 v] to [-10]\n                                else\n                                    set [x2 v] to [10]\n                                end\n                            else\n                                set [x2 v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nchange y by (Y2)\nif <<touching (objects v)?> or <touching (player v)?>> then\n    change y by ((Y2) * (-1))\n    set [y2 v] to [0]\nend\nchange y by (-0.5)\nif <<<touching (player v)?> or <touching (objects v)?>> and <key (w v) pressed?>> then\n    set [y2 v] to [10]\nend\nchange y by (0.5)\nif <touching (spikes v)?> then\n    go to x: (X Spawn) y: (Y Spawn)\nend\nif <touching color (#f000ff)?> then\n    set [y2 v] to [16]\nend\n\nwhen I receive [next v]\ngo to x: (X Spawn) y: (Y Spawn)\n\nwhen [r v] key pressed\ngo to x: (XSpawn2) y: (YSpawn2)\n\nwhen I receive [go v]\npoint in direction (90)\nset [y spawn v] to [-129]\nset [x spawn v] to [-218]\ngo to x: (X Spawn) y: (Y Spawn)\nshow\nset size to (100) %\nset [x2 v] to [0]\nset [y2 v] to [0]\nforever\n    player\nend\n\nwhen flag clicked\nset size to (100) %\nswitch costume to (square v)\nforever\n    if <touching color (#05ff00)?> then\n        go to x: (X Spawn) y: (Y Spawn)\n        broadcast (next v)\n    end\nend\n\nwhen flag clicked\nset [90 v] to [90]\nforever\n    if <(90) = [90]> then\n        point in direction (90)\n    else\n        stop [this script v]\n    end\nend\n\nwhen I receive [win v]\nset [90 v] to [0]\n\nwhen I receive [small cube v]\nset size to (50) %\n\n@Player\n\ndefine player 2\nif on edge, bounce\nchange [y v] by (-0.5)\nif <key (left arrow v) pressed?> then\n    change [x v] by (-1)\nend\nif <key (right arrow v) pressed?> then\n    change [x v] by (1)\nend\nset [x v] to ((x) * (0.9))\nchange x by (x)\nif <<touching (objects v)?> or <touching (player2 v)?>> then\n    change y by (1)\n    if <<touching (objects v)?> or <touching (player2 v)?>> then\n        change y by (1)\n        if <<touching (objects v)?> or <touching (player2 v)?>> then\n            change y by (1)\n            if <<touching (objects v)?> or <touching (player2 v)?>> then\n                change y by (1)\n                if <<touching (objects v)?> or <touching (player2 v)?>> then\n                    change y by (1)\n                    if <<touching (objects v)?> or <touching (player2 v)?>> then\n                        change y by (1)\n                        if <<touching (objects v)?> or <touching (player2 v)?>> then\n                            change y by (-6)\n                            change x by ((x) * (-1))\n                            if <key (up arrow v) pressed?> then\n                                set [y v] to [10]\n                                if <(x) > [0]> 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                    end\n                end\n            end\n        end\n    end\nend\nchange y by (y)\nif <<touching (objects v)?> or <touching (player2 v)?>> then\n    change y by ((y) * (-1))\n    set [y v] to [0]\nend\nchange y by (-0.5)\nif <<<touching (objects v)?> or <touching (player2 v)?>> and <key (up arrow v) pressed?>> then\n    set [y v] to [10]\nend\nchange y by (0.5)\nif <touching (spikes v)?> then\n    go to x: (XSpawn2) y: (YSpawn2)\nend\nif <touching color (#f000ff)?> then\n    set [y v] to [16]\nend\n\nwhen I receive [next v]\ngo to x: (XSpawn2) y: (YSpawn2)\n\nwhen [r v] key pressed\ngo to x: (XSpawn2) y: (YSpawn2)\n\nwhen I receive [go v]\npoint in direction (90)\nset [yspawn2 v] to [-83]\nset [xspawn2 v] to [-218]\ngo to x: (XSpawn2) y: (YSpawn2)\nshow\nset size to (100) %\nset [x v] to [0]\nset [y v] to [0]\nforever\n    player 2\nend\n\nwhen flag clicked\nset size to (100) %\nswitch costume to (square v)\nforever\n    if <touching color (#05ff00)?> then\n        go to x: (XSpawn2) y: (YSpawn2)\n        broadcast (next v)\n    end\nend\n\nwhen flag clicked\nset [90 v] to [90]\nforever\n    if <(90) = [90]> then\n        point in direction (90)\n    else\n        stop [this script v]\n    end\nend\n\nwhen I receive [win v]\nset [90 v] to [0]\n\nwhen I receive [small cube v]\nset size to (50) %\n\n@objects\n\nwhen flag clicked\nswitch costume to (costume1 v)\n\nwhen I receive [next v]\nnext costume\n\nwhen flag clicked\nforever\n    if <(level) = [6]> then\n        wait (5) seconds\n        broadcast (win v)\n        stop [this script v]\n    end\nend\n\n@spikes\n\nwhen flag clicked\nshow\nset size to (100) %\ngo to [back v] layer\nswitch costume to (costume1 v)\n\nwhen I receive [next v]\nnext costume\n\nwhen I receive [go v]\nforever\n    if <(level) = [2]> then\n        stop [other scripts in sprite v]\n        set size to (100) %\n        stop [this script v]\n    end\nend\n\nwhen I receive [go v]\nforever\n    if <(level) = [1]> then\n        repeat (4)\n            change size by (5)\n            wait (.1) seconds\n        end\n        repeat (4)\n            change size by (-5)\n            wait (.025) seconds\n        end\n        set size to (100) %\n    end\nend\n\n@next\n\nwhen flag clicked\nset size to (100) %\nshow\nforever\n    repeat (8)\n        change size by (5)\n        wait (.1) seconds\n    end\n    repeat (8)\n        change size by (-5)\n        wait (.025) seconds\n    end\n    set size to (100) %\nend\n\nwhen flag clicked\nset [level v] to [1]\ngo to x: (209) y: (-130)\n\nwhen I receive [next v]\nchange [level v] by (1)\n\nwhen flag clicked\nforever\n    if <(level) = [1]> then\n        go to x: (209) y: (-130)\n    end\n    if <(level) = [2]> then\n        go to x: (209) y: (-130)\n    end\n    if <(level) = [3]> then\n        go to x: (213) y: (153)\n    end\n    if <(level) = [4]> then\n        go to x: (209) y: (-119)\n    end\n    if <(level) = [5]> then\n        go to x: (209) y: (-119)\n    end\n    if <(level) = [6]> then\n        hide\n    end\nend\n\n@text\n\nwhen flag clicked\ngo to [back v] layer\nswitch costume to (costume1 v)\nshow\n\nwhen I receive [next v]\nnext costume\n\n@Sprite1\n\nwhen flag clicked\nset [ghost v] effect to (100)\ngo to [front v] layer\ngo to [front v] layer\nshow\n\nwhen [s v] key pressed\nbroadcast (next v)\n\nwhen I receive [go v]\nforever\n    play sound [1f1n1ty-psmd-within-the-sadness-remix v] until done\nend\n\n@Transition\n\nwhen flag clicked\nswitch costume to (costume2 v)\ngo to [front v] layer\nhide\n\nwhen flag clicked\ngo to [front v] layer\ngo to [front v] layer\nshow\nstart sound [intro song v]\nshow\nswitch costume to (costume1 v)\nrepeat (16)\n    next costume\nend\nswitch costume to (costume17 v)\nrepeat (16)\n    wait (.0003) seconds\n    next costume\nend\nswitch costume to (costume33 v)\nrepeat (6)\n    wait (.0003) seconds\n    next costume\nend\nwait (7.6) seconds\nbroadcast (go v)\ngo to [back v] layer\nhide\n\nwhen I receive [win v]\ngo to [front v] layer\ngo to [front v] layer\nshow\nswitch costume to (costume1 v)\nrepeat (16)\n    next costume\nend\nswitch costume to (costume17 v)\nrepeat (16)\n    wait (.0003) seconds\n    next costume\nend\nswitch costume to (costume33 v)\nrepeat (6)\n    wait (.0003) seconds\n    next costume\nend\nshow\n\nshow\n\nwhen I receive [go v]\nforever\n    if <not <(level) = [6]>> then\n        hide\n    end\nend\n\n