||Friends **2**|| – A 2 Player Platformer

Instructions: Welcome to Friends 2 - A 2 Player Platformer!\nGame Rules:\n\n- Touching spikes or the saw kills you.\n- The buttons remove all danger when you are on them.\n- You must both be on the portal (Blue Spinny Thing) to go to the next level.\n\nPurple Player Controls:\n\n- Move - Arrow Keys\n- Crouch - Down Arrow\n\nBlue Player Controls:\n\n- Move - WAS\n- Crouch - D\n\nHave Fun :D

@Stage\n\n@Thumb\n\nwhen flag clicked\nshow\ngo to [front v] layer\nchange [ghost v] effect by (100)\n\nset [level v] to [6]\n\n@Level\n\nwhen flag clicked\nset [level v] to [1]\nswitch costume to (costume1 v)\nrepeat (10)\n    go to x: (0) y: (0)\n    set size to (90) %\n    show\nend\nforever\n    switch costume to (LEVEL)\nend\n\nset [level v] to [6]\n\nwhen I receive [next level v]\nchange [level v] by (1)\n\n@clouds\n\nwhen flag clicked\nhide\nforever\n    wait (pick random (1) to (3)) seconds\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nshow\ngo to [back v] layer\nset [ghost v] effect to (pick random (40) to (75))\ngo to x: (-242) y: (pick random (100) to (-259))\nforever\n    repeat until <(x position) > [171]>\n        move (pick random (2) to (7)) steps\n    end\n    delete this clone\nend\n\n@Notifications\n\nwhen flag clicked\ngo to [front v] layer\ngo to x: (0) y: (50)\nhide\nwait (pick random (8) to (15)) seconds\nshow\nrepeat until <(y position) < [6]>\n    change y by (((5) - (y position)) / (6))\nend\nwait (3.5) seconds\nrepeat until <(y position) > [49.5]>\n    change y by (((y position) + (5)) / (5))\nend\nhide\nrepeat until <(LEVEL) = [7]>\n    wait (pick random (14) to (20)) seconds\n    show\n    repeat until <(y position) < [6]>\n        change y by (((5) - (y position)) / (6))\n    end\n    wait (3.5) seconds\n    repeat until <(y position) > [49.5]>\n        change y by (((y position) + (5)) / (5))\n    end\n    hide\nend\n\n@Buttons\n\nwhen I receive [tick v]\nset [button? v] to [0]\ngo to x: (0) y: (0)\nswitch costume to (LEVEL)\nif <<touching (player2 v)?> or <touching (player v)?>> then\n    if <(Button?) = [0]> then\n        change y by (-5)\n        set [button? v] to [1]\n        wait until <not <<touching (player v)?> or <touching (player2 v)?>>>\n    else\n        change y by (5)\n        set [button? v] to [0]\n        wait until <not <<touching (player v)?> or <touching (player2 v)?>>>\n    end\nend\n\n@Saw1\n\nwhen flag clicked\nforever\n    turn right (6) degrees\nend\n\nwhen flag clicked\nshow\nforever\n    switch costume to (LEVEL)\nend\n\nwhen flag clicked\nforever\n    go to x: (20) y: (-70)\n    if <(Button?) = [1]> then\n        hide\n    else\n        show\n    end\nend\n\n@portal\n\nwhen [timer v] > (0.1)\nhide\n\nwhen flag clicked\nswitch costume to (costume2 v)\ncreate clone of (_myself_ v)\nshow\nforever\n    turn right (3) degrees\nend\n\nwhen flag clicked\nrepeat (10)\n    clear graphic effects\nend\nforever\n    show\n    if <(LEVEL) = [1]> then\n        go to x: (200) y: (-40)\n    end\n    if <(LEVEL) = [2]> then\n        go to x: (200) y: (-50)\n    end\nend\n\nwhen I start as a clone\nswitch costume to (costume2 v)\nshow\nrepeat (10)\n    go to [front v] layer\nend\nforever\n    turn left (3) degrees\nend\n\nwhen I start as a clone\nrepeat (10)\n    clear graphic effects\nend\nforever\n    show\n    if <(LEVEL) = [1]> then\n        go to x: (200) y: (-40)\n    end\n    if <(LEVEL) = [2]> then\n        go to x: (200) y: (-50)\n    end\nend\n\nwhen I receive [tick v]\nif <<touching (player2 v)?> and <touching (player v)?>> then\n    broadcast (Next Level v)\nend\n\n@Player\n\nwhen flag clicked\ngo to [back v] layer\nset [color v] effect to (0)\nswitch costume to (hello5 v)\nshow\ngo to x: (-216) y: (0)\nset [x v] to [0]\nset [y v] to [0]\nforever\n    set size to (100) %\n    change [y v] by (-0.5)\n    if  then\n        if <[4] < (costume [number v])> then\n            change [x v] by (0.8)\n        else\n            switch costume to (hello2 v)\n            change [x v] by (0.8)\n        end\n    end\n    if  then\n        if <[4] < (costume [number v])> then\n            change [x v] by (-0.9)\n        else\n            switch costume to (hello3 v)\n            change [x v] by (-0.9)\n        end\n    end\n    set [x v] to ((x) * (0.9))\n    change x by (x)\n    if <<touching (level v)?> or <touching (moving platform v)?>> then\n        change y by (1)\n        if <<touching (level v)?> or <touching (moving platform v)?>> then\n            change y by (1)\n            if <<touching (level v)?> or <touching (moving platform v)?>> then\n                change y by (1)\n                if <<touching (level v)?> or <touching (moving platform v)?>> then\n                    change y by (1)\n                    if <<touching (level v)?> or <touching (moving platform v)?>> then\n                        change y by (1)\n                        if <<touching (level v)?> or <touching (moving platform v)?>> then\n                            change y by (1)\n                            if <<touching (level v)?> or <touching (moving platform v)?>> then\n                                change y by (-6)\n                                if  then\n                                    set [y v] to [0]\n                                    if <(x) > [0]> then\n                                        set [x v] to [-10]\n                                    else\n                                        set [x v] to [10]\n                                    end\n                                else\n                                    change x by ((x) * (-1))\n                                    set [x v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (y)\n    if <<touching (level v)?> or <touching (moving platform v)?>> then\n        change y by ((y) * (-1))\n        set [y v] to [0]\n    end\n    change y by (-0.5)\n    if <<<touching (level v)?> or <touching (moving platform v)?>> and > then\n        if <[4] < (costume [number v])> then\n            set [y v] to [12]\n        else\n            set [y v] to [9]\n        end\n    end\n    change y by (0.5)\n    if <<touching (spikes v)?> or <<touching (saw1 v)?> or <<[-175] > (y position)> or <<touching (moving spikes v)?> or >>>> then\n        start sound [pop v]\n        broadcast (Restart v)\n        wait until <not <<touching (spikes v)?> or <<touching (saw1 v)?> or <<[-175] > (y position)> or <<touching (moving spikes v)?> or >>>>>\n    end\nend\n\nrepeat (10)\n    change [ghost v] effect by (10)\n    wait (0.01) seconds\nend\nrepeat (10)\n    set [ghost v] effect to (0)\nend\nshow\n\nwhen flag clicked\n\ndefine Reset\nset [x v] to [0]\nset [yv v] to [0]\nset [y v] to [0]\ngo to x: (-216) y: (-50)\nshow\n\nwhen I receive [restart v]\nReset\nchange [deaths v] by (1)\n\nwhen I receive [next level v]\nReset\n\nwhen flag clicked\nforever\n    broadcast (Tick v)\n    if <<touching (trampoline v)?> or <<touching (trampoline v)?> or <<touching (trampoline3 v)?> or <touching (trampoline4 v)?>>>> then\n        set [y v] to [12]\n    end\n    if <touching (zoom v)?> then\n        change [x v] by (5)\n    end\n    if <<touching (buttons v)?> and <<key (up arrow v) pressed?> or >> then\n        set [y v] to [7]\n    end\n    if <<key (down arrow v) pressed?> or > then\n        switch costume to (player2 v)\n    else\n        switch costume to (player v)\n    end\nend\n\n@Player2\n\ndefine Reset\nset [x v] to [0]\nset [yv v] to [0]\nset [y v] to [0]\ngo to x: (-180) y: (-50)\nshow\n\nwhen I receive [restart v]\nReset\n\nwhen I receive [next level v]\nReset\n\nwhen flag clicked\ngo to [back v] layer\nset [color v] effect to (0)\nswitch costume to (hello5 v)\nshow\ngo to x: (-180) y: (0)\nset [x v] to [0]\nset [y v] to [0]\n\nwhen I receive [tick v]\nif <<touching (trampoline v)?> or <<touching (trampoline v)?> or <<touching (trampoline3 v)?> or <touching (trampoline4 v)?>>>> then\n    set [y v] to [12]\nend\nif <touching (zoom v)?> then\n    change [x v] by (5)\nend\nif <<touching (buttons v)?> and > then\n    set [y v] to [7]\nend\nif  then\n    switch costume to (player2 v)\nelse\n    switch costume to (player v)\nend\n\nwhen I receive [tick v]\nforever\n    change [y v] by (-0.5)\n    if <key (d v) pressed?> then\n        if <[4] < (costume [number v])> then\n            change [x v] by (0.8)\n        else\n            switch costume to (hello2 v)\n            change [x v] by (0.8)\n        end\n    end\n    if  then\n        if <[4] < (costume [number v])> then\n            change [x v] by (-0.9)\n        else\n            switch costume to (hello3 v)\n            change [x v] by (-0.9)\n        end\n    end\n    set [x v] to ((x) * (0.9))\n    change x by (x)\n    if <<touching (level v)?> or <touching (moving platform v)?>> then\n        change y by (1)\n        if <<touching (level v)?> or <touching (moving platform v)?>> then\n            change y by (1)\n            if <<touching (level v)?> or <touching (moving platform v)?>> then\n                change y by (1)\n                if <<touching (level v)?> or <touching (moving platform v)?>> then\n                    change y by (1)\n                    if <<touching (level v)?> or <touching (moving platform v)?>> then\n                        change y by (1)\n                        if <<touching (level v)?> or <touching (moving platform v)?>> then\n                            change y by (1)\n                            if <<touching (level v)?> or <touching (moving platform v)?>> then\n                                change y by (-6)\n                                if  then\n                                    set [y v] to [0]\n                                    if <(x) > [0]> then\n                                        set [x v] to [-10]\n                                    else\n                                        set [x v] to [10]\n                                    end\n                                else\n                                    change x by ((x) * (-1))\n                                    set [x v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (y)\n    if <<touching (level v)?> or <touching (moving platform v)?>> then\n        change y by ((y) * (-1))\n        set [y v] to [0]\n    end\n    change y by (-0.5)\n    if <<<touching (level v)?> or <touching (moving platform v)?>> and <key (w v) pressed?>> then\n        if <[4] < (costume [number v])> then\n            set [y v] to [12]\n        else\n            set [y v] to [9]\n        end\n    end\n    change y by (0.5)\n    if <<touching (spikes v)?> or <<touching (saw1 v)?> or <<[-175] > (y position)> or <<touching (moving spikes v)?> or >>>> then\n        start sound [pop v]\n        broadcast (Restart v)\n        wait until <not <<touching (spikes v)?> or <<touching (saw1 v)?> or <<[-175] > (y position)> or <<touching (moving spikes v)?> or >>>>>\n    end\nend\n\nrepeat (10)\n    change [ghost v] effect by (10)\n    wait (0.01) seconds\nend\n\nrepeat (10)\n    set [ghost v] effect to (0)\nend\n\nshow\n\n@Spikes\n\nwhen flag clicked\nshow\nforever\n    switch costume to (LEVEL)\nend\n\nwhen flag clicked\nforever\n    if <(Button?) = [1]> then\n        hide\n    else\n        show\n    end\nend\n\n