Escape The School | Multiplayer Platformer!                  #games #all

Instructions: Hello!\nThis is a collab (Collaboration) between @konina4189 and @bookdog17\nPlease leave a love, fave and follow so we can feel some appreciation.\n\nFeatures:\nMultiplayer: bookdog17\nBeautiful levels: me\nAmazing school art: bookdog17\nMobile friendly\nPlayer art: me\nHelping text: me\n\nTry to beat my time of 90 XD seconds!\n

@Stage\n\nwhen I receive [next level v]\nnext backdrop\n\nwhen flag clicked\nswitch backdrop to (xy-grid-20px v)\n\nwhen I receive [joined v]\nforever\n    play sound [omfg- Hello v] until done\nend\n\n@ground\n\nwhen I receive [next level v]\nchange [my level # v] by (1)\nnext costume\nchange [level v] by (1)\n\nwhen flag clicked\nreset timer\nswitch costume to (costume1 v)\nset [level v] to [1]\n\nwhen I receive [joined v]\nreset timer\n\n@Joining scripts\n\nwhen flag clicked\nhide\n\nwhen I receive [join game v]\nshow\nswitch costume to (joining v)\n\nwhen I receive [full v]\nswitch costume to (full v)\n\nwhen I receive [joined v]\nswitch costume to (joined v)\nwait (1) seconds\nhide\n\nwhen flag clicked\ngo to [front v] layer\n\nwhen flag clicked\n\n@Bad!!!\n\nwhen I receive [next level v]\nchange [my level # v] by (1)\nnext costume\n\nwhen flag clicked\nswitch costume to (costume1 v)\n\n@Player\n\nwhen flag clicked\nshow\n\nwhen flag clicked\nset [max players v] to [8]\nset [my player # v] to [0]\nbroadcast (setup - other players v) and wait\nbroadcast (join game v) and wait\nif <(MY PLAYER #) > []> then\n    broadcast (joined v)\nelse\n    broadcast (Full v)\nend\nbroadcast (begin v)\n\ndefine write (val) to encoded\nset [letter # v] to [1]\nrepeat (length of (val))\n    set [encoded v] to (join (encoded) (item # of (letter (letter #) of (val)) in [code v]))\n    change [letter # v] by (1)\nend\nset [encoded v] to (join (encoded) [00])\n\nwhen I receive [begin v]\ngo to x: (-217) y: (-20)\nset [my level # v] to [1]\nset [x v] to [0]\nset [y v] to [0]\nforever\n    if <(MY PLAYER #) > [0]> then\n        change [y v] by (-1)\n        if <<key (left arrow v) pressed?> or <<mouse down?> and <(x position) > (mouse x)>>> then\n            change [x v] by (-1)\n        end\n        if <<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>> then\n            change [x v] by (1)\n        end\n        set [x v] to ((x) * (0.9))\n        change x by (x)\n        if <touching (ground v)?> then\n            change y by (1)\n        end\n        if <touching (ground v)?> then\n            change y by (1)\n        end\n        if <touching (ground v)?> then\n            change y by (1)\n        end\n        if <touching (ground v)?> then\n            change y by (1)\n        end\n        if <touching (ground v)?> then\n            change y by (-4)\n            change x by ((x) * (-1))\n            if <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> then\n                set [y v] to [17]\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        change y by (y)\n        if <touching (ground v)?> 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?> or <<mouse down?> and <(mouse y) > (y position)>>> and <touching (ground v)?>> then\n            set [y v] to [15]\n        end\n        change y by (1)\n        if <(x position) > [222]> then\n            go to x: (-217) y: (-20)\n            broadcast (NEXT LEVEL v)\n        end\n        if <touching color (#7bbae3)?> then\n            set [y v] to [22]\n        end\n        if <<touching color (#00a5ff)?> or <<touching color (#666666)?> or <touching color (#ffcece)?>>> then\n            go to x: (-217) y: (-20)\n        end\n        send cloud data\n    end\nend\n\ndefine set cloud # (player) to (value)\nif <(player) = [1]> then\n    set [☁ p1 v] to (value)\nelse\n    if <(player) = [2]> then\n        set [☁ p2 v] to (value)\n    else\n        if <(player) = [3]> then\n            set [☁ p3 v] to (value)\n        else\n            if <(player) = [4]> then\n                set [☁ p4 v] to (value)\n            else\n                if <(player) = [5]> then\n                    set [☁ p5 v] to (value)\n                else\n                    if <(player) = [6]> then\n                        set [☁ p6 v] to (value)\n                    else\n                        if <(player) = [7]> then\n                            set [☁ p7 v] to (value)\n                        else\n                            if <(player) = [8]> then\n                                set [☁ p8 v] to (value)\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine send cloud data\nset [encoded v] to []\nwrite (my level #) to encoded\nwrite (chat) to encoded\nwrite (round ((timer) * (10))) to encoded\nwrite (x position) to encoded\nwrite (y position) to encoded\nset cloud # (MY PLAYER #) to (encoded)\nsay (chat)\n\nwhen I receive [begin v]\nset [chat v] to (username)\n\n@Other Players\n\nwhen flag clicked\nshow\n\ndefine begin decode of (encoded)\nset [encoded v] to (encoded)\nset [letter # v] to [1]\n\ndefine value = read from encoded\nset [value v] to []\nforever\n    set [idx v] to (join (letter (letter #) of (encoded)) (letter ((letter #) + (1)) of (encoded)))\n    change [letter # v] by (2)\n    if <(idx) < [1]> then\n        stop [this script v]\n    end\n    set [value v] to (join (value) (item (idx) of [code v]))\nend\n\nwhen I start as a clone\ngo to (random position v)\n\ndefine setup players\nhide\nset [offline v] to [100]\nset [player # v] to [1]\nrepeat ((MAX PLAYERS) - (1))\n    create clone of (_myself_ v)\n    change [player # v] by (1)\nend\n\nwhen I receive [begin v]\nset [x v] to [0]\nset [y v] to [0]\nforever\n    if <(MY PLAYER #) = (player #)> then\n        set [offline v] to [100]\n        hide\n    else\n        tick\n    end\nend\n\ndefine value = cloud # (player)\nif <(player) = [1]> then\n    set [value v] to (☁ P1)\nelse\n    if <(player) = [2]> then\n        set [value v] to (☁ P2)\n    else\n        if <(player) = [3]> then\n            set [value v] to (☁ P3)\n        else\n            if <(player) = [4]> then\n                set [value v] to (☁ P4)\n            else\n                if <(player) = [5]> then\n                    set [value v] to (☁ P5)\n                else\n                    if <(player) = [6]> then\n                        set [value v] to (☁ P6)\n                    else\n                        if <(player) = [7]> then\n                            set [value v] to (☁ P7)\n                        else\n                            if <(player) = [8]> then\n                                set [value v] to (☁ P8)\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [setup - other players v]\nsetup players\n\ndefine tick\nvalue = cloud # (player #)\nif <(join [A] (value)) = (last value)> then\n    change [offline v] by (1)\n    if <(offline) = [100]> then\n        hide\n    end\nelse\n    set [last value v] to (join [A] (value))\n    if <(offline) > [99]> then\n        show\n    end\n    set [offline v] to [0]\nend\nbegin decode of (value)\nvalue = read from encoded\nif <(value) = (my level #)> then\n    if <[100] > (offline)> then\n        show\n    else\n        hide\n    end\nelse\n    hide\nend\nvalue = read from encoded\nsay (value)\nvalue = read from encoded\nvalue = read from encoded\nset x to (value)\nvalue = read from encoded\nset y to (value)\n\nwhen I receive [join game v]\nvalue = cloud # (player #)\nset [last value v] to (join [A] (value))\nwait (3) seconds\nvalue = cloud # (player #)\nif <(join [A] (value)) = (last value)> then\n    set [my player # v] to (player #)\nend\n\nwhen I receive [begin v]\nwait (1) seconds\n\n@blank\n\nwhen flag clicked\nplay drum (2 v) for (0.25) beats\n\n@HI\n\nshow\ngo to [front v] layer\n\nwhen flag clicked\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\n