☁Multiplayer Platformer☁ Mobile friendly #games #all
@Stage\n\nwhen flag clicked\nforever\n    play sound [Popsicle v] until done\nend\n\n@Game text\n\nwhen I receive [initialise  v]\nset [level # v] to [1]\nhide\n\nwhen I receive [tick v]\ngo to x: (0) y: (0)\nshow\ngo to [back v] layer\nswitch costume to (Level #)\n\n@Level\n\nwhen I receive [initialise  v]\nset [level # v] to [1]\nhide\n\nwhen I receive [tick v]\nshow\nswitch costume to (Level #)\n\n@Chat \n\nwhen [t v] key pressed\nshow\nwait (0.5) seconds\nrepeat until <key (t v) pressed?>\nend\nhide\n\nwhen flag clicked\nhide\nwait (1.5) seconds\nset [☁ chat v] to (join (username?) [ Has Joined the game])\n\n@Bad\n\nwhen I receive [initialise  v]\nset [level # v] to [1]\nhide\n\nwhen I receive [tick v]\ngo to x: (0) y: (0)\nshow\ngo to [back v] layer\nswitch costume to (Level #)\n\n@Player\n\ndefine Movement (id)\nplatform physics (10) (-0.8) (0.9) (0.65) (10) (8)\nSave My Data\nshow\nthink (username)\nif <touching (bad v)?> then\n    go to x: (-180) y: (180)\nend\nif <(x position) > [235]> then\n    change [level # v] by (1)\n    go to x: (-235) y: (y position)\nend\nif <(Level #) > [1]> then\n    if <(x position) < [-235]> then\n        change [level # v] by (-1)\n        go to x: (235) y: (y position)\n    end\nend\n\nwhen I receive [initialise  v]\ngo to x: (-180) y: (0)\nhide\nset [username? v] to (username)\nset [clone id v] to [0]\nrepeat (10)\n    change [clone id v] by (1)\n    create clone of (_myself_ v)\nend\n\nwhen I receive [tick v]\nTick\n\ndefine (id)\nif <(item (id) of [active check v]) = [Off]> then\n    hide\nelse\n    think (item ((id) * (5)) of [cloud list v])\n    go to x: (item (((id) * (5)) - (4)) of [cloud list v]) y: (item (((id) * (5)) - (3)) of [cloud list v])\n    switch costume to (join [P] (id))\n    if <(Level #) = (item (((id) * (5)) - (1)) of [cloud list v])> then\n        show\n    else\n        hide\n    end\nend\n\ndefine Save My Data\ndelete all of [my list v]\nadd (x position) to [my list v]\nadd (y position) to [my list v]\nadd (pick random (9999) to (999999)) to [my list v]\nadd (Level #) to [my list v]\nadd (username?) to [my list v]\n\ndefine Tick\nif <(Clone ID) = (Player #)> then\n    Movement (Clone ID)\nelse\n    (Clone ID)\nend\n\ndefine platform physics (jump height) (gravity) (friction) (movement speed) (wall jump vm) (wall jump hm)\nchange y by (y vel)\nif <touching (level v)?> then\n    repeat ([abs v] of (y vel) )\n        if <touching (level v)?> then\n            change y by ((-1) * (([abs v] of (y vel) ) / (y vel)))\n        end\n    end\n    if <<<<((mouse y) - (y position)) > [50]> and <mouse down?>> or <key (up arrow v) pressed?>> and <not <(y vel) > [0]>>> then\n        set [y vel v] to (jump height)\n    else\n        set [y vel v] to [0]\n    end\nelse\n    change [y vel v] by (gravity)\nend\nif <<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>> then\n    change [x vel v] by (movement speed)\nend\nif <<key (left arrow v) pressed?> or <<mouse down?> and <(x position) > (mouse x)>>> then\n    change [x vel v] by ((-1) * (movement speed))\nend\nchange x by (x vel)\nif <touching (level v)?> then\n    set [old y v] to (y position)\n    repeat (([abs v] of (x vel) ) + (1))\n        if <touching (level v)?> then\n            change y by (1)\n        end\n    end\n    if <touching (level v)?> then\n        set y to (old y)\n        repeat ([ceiling v] of ([abs v] of (x vel) ) )\n            if <touching (level v)?> then\n                change x by ((-1) * (([abs v] of (x vel) ) / (x vel)))\n            end\n        end\n        if <<<((mouse y) - (y position)) > [50]> and <mouse down?>> or <key (up arrow v) pressed?>> then\n            if <(x vel) < [0]> then\n                set [x vel v] to [0]\n                if <<key (left arrow v) pressed?> or <<mouse down?> and <(x position) > (mouse x)>>> then\n                    set [x vel v] to (wall jump hm)\n                    set [y vel v] to (wall jump vm)\n                end\n            else\n                set [x vel v] to [0]\n                if <<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>> then\n                    set [x vel v] to ((-1) * (wall jump hm))\n                    set [y vel v] to (wall jump vm)\n                end\n            end\n        end\n    end\nend\nset [x vel v] to ((x vel) * (friction))\n\nwait (0.1) seconds\n\nwhen flag clicked\n\nwhen [t v] key pressed\nwait (0.1) seconds\nrepeat until <key (t v) pressed?>\n    if <key (1 v) pressed?> then\n        set [☁ chat v] to (join (username) [ : Hi!])\n    end\n    if <key (2 v) pressed?> then\n        set [☁ chat v] to (join (username) [ : oops...])\n    end\n    if <key (3 v) pressed?> then\n        set [☁ chat v] to (join (username) [ : Oh no!])\n    end\n    if <key (4 v) pressed?> then\n        set [☁ chat v] to (join (username) [ : Ok])\n    end\n    if <key (5 v) pressed?> then\n        set [☁ chat v] to (join (username) [ : HELP!])\n    end\n    if <key (6 v) pressed?> then\n        set [☁ chat v] to (join (username) [ : LaGgY])\n    end\n    if <key (7 v) pressed?> then\n        set [☁ chat v] to (join (username) [ : Cool!])\n    end\n    if <key (8 v) pressed?> then\n        set [☁ chat v] to (join (username) [ : Follow me!])\n    end\nend\n\nwhen flag clicked\n\n@Thumbnail\n\nwhen flag clicked\ngo to [front v] layer\nshow\nwait (0.5) seconds\nhide\n\n@Cloud\n\ndefine Decode (data)\ndelete all of [cloud list v]\nset [output v] to []\nset [i v] to [0]\nrepeat ((length of (data)) / (2))\n    change [i v] by (2)\n    switch costume to (join (letter ((I) - (1)) of (data)) (letter (I) of (data)))\n    if <(costume [name v]) = [~]> then\n        add (Output) to [cloud list v]\n        set [output v] to []\n    else\n        set [output v] to (join (Output) (costume [name v]))\n    end\nend\n\ndefine Encode\nset [output v] to []\nset [n v] to [0]\nrepeat (length of [my list v])\n    set [i v] to [0]\n    change [n v] by (1)\n    repeat (length of (item (n) of [my list v]))\n        change [i v] by (1)\n        switch costume to (letter (I) of (item (n) of [my list v]))\n        if <(costume [number v]) < [10]> then\n            set [output v] to (join (Output) (join [0] (costume [number v])))\n        else\n            set [output v] to (join (Output) (costume [number v]))\n        end\n    end\n    set [output v] to (join (Output) [53])\nend\n\ndefine Update Players List (id)\nif <(id) = [1]> then\n    set [player list v] to [0]\n    delete all of [check v]\n    repeat (10)\n        change [player list v] by (1)\n        add (item (((Player List) * (4)) - (1)) of [cloud list v]) to [check v]\n    end\nelse\n    if <(id) = [2]> then\n        set [player list v] to [0]\n        repeat (10)\n            change [player list v] by (1)\n            if <not <(Player #) = (Player List)>> then\n                if <(item (Player List) of [check v]) = (item (((Player List) * (4)) - (1)) of [cloud list v])> then\n                    replace item (Player List) of [active check v] with [Off]\n                else\n                    replace item (Player List) of [active check v] with [On]\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [initialise  v]\ndelete all of [active check v]\nrepeat (10)\n    add [off] to [active check v]\nend\n\nwhen I receive [start v]\nforever\n    Update Players List [1]\n    wait (1.1) seconds\n    Update Players List [2]\nend\n\nwhen I receive [get data v]\nDecode Data\n\ndefine Save Data (id)\nEncode\nif <(id) = [1]> then\n    set [☁ 1 v] to (Output)\nelse\n    if <(id) = [2]> then\n        set [☁ 2 v] to (Output)\n    else\n        if <(id) = [3]> then\n            set [☁ 3 v] to (Output)\n        else\n            if <(id) = [4]> then\n                set [☁ 4 v] to (Output)\n            else\n                if <(id) = [5]> then\n                    set [☁ 5 v] to (Output)\n                else\n                    if <(id) = [6]> then\n                        set [☁ 6 v] to (Output)\n                    else\n                        if <(id) = [7]> then\n                            set [☁ 7 v] to (Output)\n                        else\n                            if <(id) = [8]> then\n                                set [☁ 8 v] to (Output)\n                            else\n                                if <(id) = [9]> then\n                                    set [☁ 9 v] to (Output)\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [tick v]\nDecode Data\nSave Data (Player #)\nDetermine Players\n\ndefine Decode Data\nDecode (join (☁ 1) (join (☁ 2) (join (☁ 3) (join (☁ 4) (join (☁ 5) (join (☁ 6) (join (☁ 7) (join (☁ 8) (☁ 9)))))))))\n\ndefine Determine Players\nset [players v] to [1]\nset [i v] to [0]\nrepeat (45)\n    change [i v] by (1)\n    if <(item (I) of [active check v]) = [On]> then\n        change [players v] by (1)\n    end\nend\n\n@Message\n\nwhen flag clicked\nbroadcast (Initialise  v) and wait\nGet Player Slot\nset [moved? v] to [3000]\nif <not <(Player #) > [0]>> then\n    set [full? v] to [True]\nend\nbroadcast (start v)\nforever\n    broadcast (Tick v) and wait\n    change [tick # v] by (1)\nend\n\nwhen I receive [start v]\nif <(Full?) = [True]> then\n    repeat (10)\n        change [brightness v] effect by (-10)\n    end\n    switch costume to (full v)\n    repeat (10)\n        change [brightness v] effect by (10)\n    end\n    clear graphic effects\n    wait (1) seconds\n    hide\nelse\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    hide\nend\n\nwhen I receive [initialise  v]\nswitch costume to (connecting v)\nshow\nclear graphic effects\ngo to x: (0) y: (0)\ngo to [front v] layer\nset [full? v] to [False]\nset [idle? v] to [False]\nset [moved? v] to [800]\nset [tick # v] to [0]\n\nwhen I receive [you have been booted. v]\nswitch costume to (booted v)\nshow\nclear graphic effects\ngo to x: (0) y: (0)\ngo to [front v] layer\n\nwhen I receive [tick v]\nif <<<<key (any v) pressed?> or <(username) = [-Slicer-]>> or <mouse down?>> or <(Full?) = [True]>> then\n    set [moved? v] to [1000]\nend\nchange [moved? v] by (-1)\nif <(Moved?) < [1]> then\n    broadcast (You have been booted. v)\n    stop [all v]\nend\n\ndefine Get Player Slot\nset [player # v] to [0]\nbroadcast (Get Data v) and wait\nset [moved? v] to [0]\ndelete all of [check v]\nrepeat (10)\n    change [moved? v] by (1)\n    add (item (((Moved?) * (4)) - (2)) of [cloud list v]) to [check v]\nend\nwait (1.5) seconds\nbroadcast (Get Data v) and wait\nset [moved? v] to [0]\nrepeat (10)\n    change [moved? v] by (1)\n    if <(item (Moved?) of [check v]) = (item (((Moved?) * (4)) - (2)) of [cloud list v])> then\n        set [player # v] to (Moved?)\n        stop [this script v]\n    end\nend\n\n@Players\n\nwhen I receive [tick v]\nset [ghost v] effect to (15)\nif <(Players) = [1]> then\n    switch costume to (1 v)\nelse\n    if <(Players) = [2]> then\n        switch costume to (2 \(1\) v)\n    else\n        if <(Players) = [3]> then\n            switch costume to (3 \(1\) v)\n        else\n            if <(Players) = [4]> then\n                switch costume to (4 \(1\) v)\n            else\n                if <(Players) = [5]> then\n                    switch costume to (5 \(1\) v)\n                else\n                    if <(Players) = [6]> then\n                        switch costume to (6 \(1\) v)\n                    else\n                        if <(Players) = [7]> then\n                            switch costume to (7 v)\n                        else\n                            if <(Players) = [8]> then\n                                switch costume to (8 v)\n                            else\n                                if <(Players) = [9]> then\n                                    switch costume to (9 v)\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ngo to [front v] layer\n\n@Watermark\n\nwhen flag clicked\ngo to [front v] layer\nset [ghost v] effect to (30)\n\n@Sprite3\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\nforever\n    reset timer\nend\n\nwhen [timer v] > (0.0001)\nhide variable [☁ chat v]\nshow\nset y to (200)\nrepeat (10)\n    change y by (-10)\nend\nrepeat (10)\n    change y by (-5)\nend\nrepeat (20)\n    change y by (-2.5)\nend\n\n
Server 2:https://scratch.mit.edu/projects/412020249\nHi! I was inspired by multiple scratchers to create this Cloud multiplayer platformer. I will be making many of these from now on, maybe even more than offline platformers.\nIMPORTANT: new scratchers can't play!\nIf you are Idle 20 seconds, you get kicked out.\nMusic is, of course, not by me: Faded, By alan walker.\n60% Of code by me. Trying to make better code by me.\nPress 'T' to open chat. List of commands is opened. press number. Press 'T' to close.\n@StratfordJames Loved!\n@0014049 Loved and Faved!\n@Zillien Loved!\n@Lufof Loved and Faved!\n@-Fusion- Loved and Faved!\n\n\n\n\n\n#Games #Cloud #Multiplayer #Platformers #All #mobile\n