☁ Cloud multiplayer platformer engine
@Stage\n\nwhen I receive [begin v]\nwait (1.5) seconds\nswitch backdrop to (blank v)\n\nwhen flag clicked\nforever\n    play sound [Unlimited v] until done\nend\n\n@Player\n\nwhen flag clicked\nhide\nset [max players v] to [4]\nset [my player # v] to [0]\nbroadcast (Setup - Opponents v) and wait\nswitch backdrop to (connecting... v)\nbroadcast (Join Game v) and wait\nif <(My player #) > [0]> then\n    switch backdrop to (connected v)\nelse\n    switch backdrop to (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]\nset [level v] to [1]\nsay (join (My player #) (join [: ] (username)))\nshow\ngo to x: (-175) y: (-20)\nswitch costume to (costume1 v)\nforever\n    if <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>>> then\n        switch costume to (costume1 v)\n        change [x velocity v] by (1)\n    end\n    if <<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>>> then\n        switch costume to (costume2 v)\n        change [x velocity v] by (-1)\n    end\n    set [x velocity v] to ((X velocity) * (0.9))\n    change x by (X velocity)\n    if <<touching color (#00ef05)?> or <<touching color (#00cb03)?> or <touching color (#00ab03)?>>> then\n        change y by (1)\n        if <<touching color (#00ef05)?> or <<touching color (#00cb03)?> or <touching color (#00ab03)?>>> then\n            change y by (1)\n            if <<touching color (#00ef05)?> or <<touching color (#00cb03)?> or <touching color (#00ab03)?>>> then\n                change y by (1)\n                if <<touching color (#00ef05)?> or <<touching color (#00cb03)?> or <touching color (#00ab03)?>>> then\n                    change y by (1)\n                    if <<touching color (#00ef05)?> or <<touching color (#00cb03)?> or <touching color (#00ab03)?>>> then\n                        change y by (1)\n                        if <<touching color (#00ef05)?> or <<touching color (#00cb03)?> or <touching color (#00ab03)?>>> then\n                            change y by (-5)\n                            change x by ((X velocity) * (-1))\n                            Walljump <(X velocity) > [0]>\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [y velocity v] by (-1)\n    change y by (Y velocity)\n    if <<touching color (#00ef05)?> or <<touching color (#00cb03)?> or <touching color (#00ab03)?>>> then\n        change y by ((Y velocity) * (-1))\n        set [y velocity v] to [0]\n    end\n    change y by (-1)\n    if <<<touching color (#00ef05)?> or <<touching color (#00cb03)?> or <touching color (#00ab03)?>>> and <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>>> then\n        set [y velocity v] to [15]\n    end\n    change y by (1)\n    if <touching color (#ff0000)?> then\n        go to x: (-175) y: (-20)\n    end\n    if <touching color (#e5ff00)?> then\n        set [y velocity v] to [20]\n    end\n    if <<(round (x position)) = [250]> or <(round (x position)) = [251]>> then\n        if <not <(Level) > [9]>> then\n            change [level v] by (1)\n            go to x: (-175) y: (-20)\n        end\n    end\n    if <(My player #) > [0]> then\n        Send cloud data\n    end\nend\n\ndefine Set cloud # (player) to (value)\nif <(player) = [1]> then\n    set [☁ player 1 v] to (value)\nelse\n    if <(player) = [2]> then\n        set [☁ player 2 v] to (value)\n    else\n        if <(player) = [3]> then\n            set [☁ player 3 v] to (value)\n        else\n            set [☁ player 4 v] to (value)\n        end\n    end\nend\n\ndefine Send cloud data\nset [encoded v] to []\nWrite (username) to encoded\nWrite (round ((timer) * (10))) to encoded\nWrite (x position) to encoded\nWrite (y position) to encoded\nSet cloud # (My player #) to (encoded)\n\nwhen backdrop switches to [connected v]\nshow\n\ndefine Walljump <right?>\nif <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n    if <right?> then\n        set [x velocity v] to [-5]\n    else\n        set [x velocity v] to [5]\n    end\n    set [y velocity v] to [10]\nelse\n    set [x velocity v] to [0]\nend\n\n@Opponents\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\ndefine Setup Players\nset [color v] effect to (90)\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]\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 (☁ Player 1)\nelse\n    if <(player) = [2]> then\n        set [value v] to (☁ Player 2)\n    else\n        if <(player) = [3]> then\n            set [value v] to (☁ Player 3)\n        else\n            set [value v] to (☁ Player 4)\n        end\n    end\nend\n\nwhen I receive [setup - opponents 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\nsay (join (Player #) (join [: ] (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\n@Sprite1\n\nwhen flag clicked\ngo to x: (0) y: (10)\nhide variable [level v]\nhide\nswitch costume to (level 1 v)\nforever\n    switch costume to (Level)\nend\n\nwhen I receive [begin v]\nshow variable [level v]\nshow\n\n@Sprite2\n\nwhen flag clicked\nshow\nforever\n    go to [front v] layer\n    set [ghost v] effect to (100)\nend\n\n
Arrow keys, wasd, or mobile controls.\nYou can use this to make a cloud multiplayer platformer, but you can't backpack it, you can only remix it because if you backpack it the cloud variables would only turn into the variable but with a cloud emoji. I am not kidding you.\nThis has 10 levels you can make. If you want more, you can change it.