Scratch|Multiplayer Scrolling Platformer v1.8     #all #games
@Stage\n\nwhen flag clicked\nforever\n    play sound [Inferno v] until done\nend\n\nstart sound [Connect v]\n\n@Blank\n\n@Opponents\n\ndefine begin decode of (encoded)\nset [encoded v] to (encoded)\nset [letter # v] to [1]\n\ndefine val = 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\nclear graphic effects\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\nchange [player # v] by (1)\n\nwhen I receive [begin v]\ncheck players\nforever\n    if <(MY PLAYER #) = (player #)> then\n        set [offline v] to [100]\n        hide\n    else\n        Tick\n    end\nend\n\ndefine val = cloud # (p)\nif <(p) = [1]> then\n    set [value v] to (☁ P1)\nelse\n    if <(p) = [2]> then\n        set [value v] to (☁ P2)\n    else\n        if <(p) = [3]> then\n            set [value v] to (☁ P3)\n        else\n            if <(p) = [4]> then\n                set [value v] to (☁ P4)\n            else\n                if <(p) = [5]> then\n                    set [value v] to (☁ P5)\n                else\n                    if <(p) = [6]> then\n                        set [value v] to (☁ P6)\n                    else\n                        if <(p) = [7]> then\n                            set [value v] to (☁ P7)\n                        else\n                            if <(p) = [8]> then\n                                set [value v] to (☁ P8)\n                            else\n                                if <(p) = [9]> then\n                                    set [value v] to (☁ P9)\n                                else\n                                    set [value v] to (☁ P10)\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [setup - opponents v]\nSetup players\nset [color v] effect to (140)\n\ndefine Tick\nval = cloud # (player #)\nif <(join [A] (value)) = (last value)> then\n    change [offline v] by (1)\n    if <(offline) = [100]> then\n        hide\n        check players\n    end\nelse\n    set [last value v] to (join [A] (value))\n    if <[99] > (offline)> then\n        show\n    end\n    set [offline v] to [0]\nend\nbegin decode of (value)\nval = read from encoded\nset x to ((value) - (Scroll x))\nval = read from encoded\nset y to ((value) - (Scroll y))\nval = read from encoded\nsay (join (join (player #) [ : ]) (value))\n\nwhen I receive [join game v]\nval = cloud # (player #)\nset [last value v] to (join [A] (value))\nwait (3) seconds\nval = cloud # (player #)\nif <(join [A] (value)) = (last value)> then\n    set [my player # v] to (player #)\nend\n\nwhen flag clicked\nforever\n    if <not <(backdrop [number v]) = [4]>> then\n        hide\n    end\nend\n\ndefine check players\nif <(player #) = [1]> then\n    set [☁ p1 v] to []\nelse\n    if <(player #) = [2]> then\n        set [☁ p2 v] to []\n    else\n        if <(player #) = [3]> then\n            set [☁ p3 v] to []\n        else\n            if <(player #) = [4]> then\n                set [☁ p4 v] to []\n            else\n                if <(player #) = [5]> then\n                    set [☁ p5 v] to []\n                else\n                    if <(player #) = [6]> then\n                        set [☁ p6 v] to []\n                    else\n                        if <(player #) = [7]> then\n                            set [☁ p7 v] to []\n                        else\n                            if <(player #) = [8]> then\n                                set [☁ p8 v] to []\n                            else\n                                if <(player #) = [9]> then\n                                    set [☁ p9 v] to []\n                                else\n                                    if <(player #) = [10]> then\n                                        set [☁ p10 v] to []\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    go to [back v] layer\n    go [backward v] (1300000000000) layers\n    hide\nend\n\nwhen flag clicked\nforever\n    if <touching (_edge_ v)?> then\n        hide\n    end\nend\n\nwhen flag clicked\nclear graphic effects\nforever\n    if <touching (_edge_ v)?> then\n        set [ghost v] effect to (99)\n    end\nend\n\n@Player\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\nswitch backdrop to (scratch dots v)\n\nwhen I receive [play game v]\nswitch backdrop to (scratch dots v)\nset [level v] to [1]\nforever\n    broadcast (Reset v)\n    broadcast (Setup v)\n    Begin\n    repeat until <(EXIT) > []>\n        Tick\n        broadcast (Tick v)\n    end\nend\n\ndefine Begin\nset [x v] to [0]\nset [y v] to [0]\nset [sx v] to [0]\nset [sy v] to [0]\nset [in air? v] to [0]\nset [exit v] to []\nset size to (100) %\nshow\n\ndefine Tick\nset [moving? v] to [0]\nif <<<key (left arrow v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>> or <key (a v) pressed?>> then\n    set [moving? v] to [1]\n    change [sx v] by (-2)\nend\nif <<<key (right arrow v) pressed?> or <<mouse down?> and <(x position) < (mouse x)>>> or <key (s v) pressed?>> then\n    set [moving? v] to [1]\n    change [sx v] by (2)\nend\nset [sx v] to ((sx) * (0.8))\nif <([abs v] of (sx) ) > [0.9]> then\n    Change Player x by: (round (sx))\nend\nif <<<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> or <key (w v) pressed?>> then\n    set [moving? v] to [1]\n    if <(In air?) < [4]> then\n        set [sy v] to [17]\n    end\nend\nif <(sy) > [-20]> then\n    change [sy v] by (-2)\nend\nChange player y by: (sy)\nchange [scroll x v] by ((round ((X) - (Scroll x))) / (2))\nif <(Scroll x) < [0]> then\n    set [scroll x v] to [0]\nend\nchange [scroll y v] by (round (((Y) - (Scroll y)) / (10)))\nif <(Scroll y) < [0]> then\n    set [scroll y v] to [0]\nend\nPosition\nif <(Y) < [-180]> then\n    set [exit v] to [die]\n    change [attempts v] by (1)\nend\n\nif <(username) = [5wonders]> then\n    set [sy v] to [25]\nend\n\ndefine Change player y by: (sy)\nchange [y v] by (sy)\nchange [in air? v] by (1)\nPosition\nrepeat until <not <touching (game v)?>>\n    if <(sy) > [0]> then\n        change [y v] by (-1)\n    else\n        change [y v] by (1)\n        set [in air? v] to [0]\n    end\n    Position\n    set [sy v] to [0]\nend\n\ndefine Position\ngo to x: ((X) - (Scroll x)) y: ((Y) - (Scroll y))\n\ndefine Change Player x by: (sx)\nchange [x v] by (sx)\nPosition\nif <touching (game v)?> then\n    repeat (8)\n        change [y v] by (1)\n        Position\n        if <not <touching (game v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-12)\n    if <<<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> or <key (w v) pressed?>> then\n        set [moving? v] to [1]\n        if <(sx) > [0]> then\n            set [sx v] to [-16]\n        else\n            set [sx v] to [16]\n        end\n        set [in air? v] to [0]\n    else\n        set [sx v] to [0]\n    end\n    repeat until <not <touching (game v)?>>\n        if <(sx) > [0]> then\n            change [x v] by (-1)\n        else\n            change [x v] by (1)\n        end\n        Position\n    end\nend\n\nchange [scroll y v] by (round (((Y) - (Scroll y)) / (10)))\nif <(Scroll y) < [0]> then\n    set [scroll y v] to [0]\nend\nPosition\nif <(Y) < [-180]> then\n    set [exit v] to [die]\nend\n\nwhen I receive [win_for now v]\nrepeat (50)\n    End\nend\n\ndefine End\nbroadcast (End Scroll v)\n\nwhen I receive [end scroll v]\nhide\n\nwhen I receive [setup v]\n\nwhen [timer v] > (0.01)\nhide\n\nwhen I receive [begin v]\nforever\n    if <(MY PLAYER #) > [0]> then\n        send cloud data\n    end\nend\n\ndefine send cloud data\nset [encoded v] to []\nWrite (X) to encoded\nWrite (Y) to encoded\nWrite (username) to encoded\nWrite (round ((timer) * (10))) to encoded\nset cloud # (MY PLAYER #) - (encoded)\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\ndefine set cloud # (p) - (val)\nif <(p) = [1]> then\n    set [☁ p1 v] to (val)\nelse\n    if <(p) = [2]> then\n        set [☁ p2 v] to (val)\n    else\n        if <(p) = [3]> then\n            set [☁ p3 v] to (val)\n        else\n            if <(p) = [4]> then\n                set [☁ p4 v] to (val)\n            else\n                if <(p) = [5]> then\n                    set [☁ p5 v] to (val)\n                else\n                    if <(p) = [6]> then\n                        set [☁ p6 v] to (val)\n                    else\n                        if <(p) = [7]> then\n                            set [☁ p7 v] to (val)\n                        else\n                            if <(p) = [8]> then\n                                set [☁ p8 v] to (val)\n                            else\n                                if <(p) = [9]> then\n                                    set [☁ p9 v] to (val)\n                                else\n                                    set [☁ p10 v] to (val)\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <not <(backdrop [number v]) = [4]>> then\n        hide\n    end\nend\n\nwhen I receive [end of intro v]\n\nwhen flag clicked\nset [max players v] to [10]\nset [my player # v] to [0]\nbroadcast (setup - opponents v) and wait\nswitch backdrop to (joining v)\nbroadcast (join game v) and wait\nif <(MY PLAYER #) > [0]> then\n    switch backdrop to (joined v)\n    start sound [Connect v]\n    wait (1) seconds\nelse\n    switch backdrop to (full v)\nend\nbroadcast (begin v)\nbroadcast (Green Flag v)\nbroadcast (Play Game v)\nset [attempts v] to [0]\n\nwhen flag clicked\nforever\n    if <<<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > [10]>>> and <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n        switch costume to (ul v)\n    else\n        if <<<key (left arrow v) pressed?> or <<mouse down?> and <[-10] > (mouse x)>>> and <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n            switch costume to (ur v)\n        else\n            if <<key (left arrow v) pressed?> or <<mouse down?> and <[-10] > (mouse x)>>> then\n                switch costume to (r v)\n            else\n                if <<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > [10]>>> then\n                    switch costume to (l v)\n                else\n                    if <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> then\n                        switch costume to (u v)\n                    else\n                        switch costume to (m v)\n                    end\n                end\n            end\n        end\n    end\nend\n\n@Comments\n\ndefine Clone at x: (x) Clone at y: (y)\nchange [x v] by (x)\nchange [y v] by (y)\ncreate clone of (_myself_ v)\n\nwhen I receive [setup v]\nset size to (100) %\nhide\nset [x v] to [0]\nset [y v] to [0]\nswitch costume to (1 v)\nClone at x: [-50] Clone at y: [-20]\n\nwhen I receive [green flag v]\nshow\ngo to x: (0) y: (-95)\n\nwhen I receive [tick v]\nPosition ((x) - (Scroll x)) ((y) - (Scroll y))\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen I receive [end scroll v]\nhide\n\nwhen flag clicked\nforever\n    if <not <(backdrop [number v]) = [4]>> then\n        hide\n    end\nend\n\n@Game\n\nwhen I receive [start v]\nshow\ngo to [front v] layer\nforever\n    play sound [Nebula v] until done\nend\n\nwhen I receive [end scroll v]\nhide\n\nwhen I receive [tick v]\nPosition ((x) - (Scroll x)) ((y) - (Scroll y))\n\nwhen I receive [setup v]\npoint in direction (90)\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(Level) = [1]> then\n    switch costume to (1 v)\n    set size to (100) %\n    Clone at x: [700] Clone at y: [0]\n    Clone at x: [550] Clone at y: [0]\n    Clone at x: [540] Clone at y: [0]\n    Clone at x: [230] Clone at y: [280]\n    Clone at x: [230] Clone at y: [400]\n    Clone at x: [1060] Clone at y: [400]\n    Clone at x: [-400] Clone at y: [0]\n    Clone at x: [1000] Clone at y: [-200]\n    set size to (700) %\n    Clone at x: [600] Clone at y: [330]\n    Clone at x: [600] Clone at y: [330]\n    Clone at x: [500] Clone at y: [-150]\n    Clone at x: [850] Clone at y: [400]\n    Clone at x: [650] Clone at y: [0]\n    Clone at x: [910] Clone at y: [0]\n    switch costume to (6 v)\n    Clone at x: [900] Clone at y: [0]\n    Clone at x: [900] Clone at y: [-90]\n    Clone at x: [900] Clone at y: [-110]\n    Clone at x: [910] Clone at y: [-150]\n    Clone at x: [700] Clone at y: [-100]\n    Clone at x: [700] Clone at y: [-100]\n    Clone at x: [700] Clone at y: [-160]\nend\n\ndefine Clone at x: (x) Clone at y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen I receive [green flag v]\nshow\ngo to x: (0) y: (-95)\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen flag clicked\nclear sound effects\nwait (5) seconds\nplay sound [ZOOM20 v] until done\nchange [sound v] by (1)\n\nwhen flag clicked\nset [pan left/right v] effect to (0)\nset [attempts v] to [0]\nforever\n    play sound [Clean_Soul_Calming v] until done\nend\n\nwhen I receive [win v]\nhide\nstop [other scripts in sprite v]\nstop all sounds\n\nwhen flag clicked\nforever\n    if <not <(backdrop [number v]) = [4]>> then\n        hide\n    end\nend\n\nwhen flag clicked\nshow\n\n@Thumbnail\n\nwhen flag clicked\nhide variable [@player v]\ngo to x: (0) y: (0)\nforever\n    set [ghost v] effect to (100)\n    go to [front v] layer\n    show\nend\n\n
-=Scratch|Multiplayer Scrolling Platformer -mobile- =-\n☁ Hi everyone, I finished that magnificent multiplayer ☁ scrolling platformer!!! \n☁ This is my first multiplayer scrolling platformer and I ☁ hope I'll have time to do more\nPropose it to be featured!: https://scratch.mit.edu/studios/646050/comments/\n☁ There is no end. This is a playground.\n☁ Sometimes you'll find big gaps, You may fall or jump.\n☁ You might die once and continue after(at the start)\n☁ Lag or glitches? : Refresh the page!\n☁ It can support a maximum of 10 players\n☁ I REALLY WANT THIS TO BE FEATURED... (please help me!)\nRemix tree: https://scratch.mit.edu/projects/406292199/remixtree/\n------===========instructions===========------\n- arrow keys, WASD to move or Mobile!\n- Don't fall into gaps.\n- If you like it, please ❤️, ⭐️ and FOLLOW ME! for more