Multiplayer Platformer II #All #Games II REMAKE

Instructions: If this doesn't work TRY THIS INSTEAD :D\nhttps://scratch.mit.edu/projects/477920761\nWelcome To my first multiplayer platformer!! :D\n- 100% Mutiplayer BUG FIXED!!! (almost)\n- Up to 10 Players\n- Mobile friendly\n- Avoid the dangers.\n- Heart, Star and a FOLLOW for more epic games.

@Stage\n\n@player\n\nwhen I receive [begin v]\nrepeat (60)\n    if <<<key (left arrow v) pressed?> or <<(x position) > (mouse x)> and <mouse down?>>> or <<<key (right arrow v) pressed?> or <<(mouse x) > (x position)> and <mouse down?>>> or <<<key (up arrow v) pressed?> or <<(mouse y) > (y position)> and <mouse down?>>> or <<<<touching (platform v)?> or <touching color (#00ff2c)?>> and <key (up arrow v) pressed?>> or <<<touching (platform v)?> or <touching color (#00ff2c)?>> and <<(mouse y) > (y position)> and <mouse down?>>>>>>> then\n        set [kickout. v] to [0]\n    else\n        change [kickout. v] by (1)\n    end\n    wait (1) seconds\nend\nif <(Kickout.) = [60]> then\n    stop [all v]\nend\n\ndefine Run Engine\nchange [y v] by (-0.5)\nif <<key (left arrow v) pressed?> or <<(x position) > (mouse x)> and <mouse down?>>> then\n    change [x v] by (-0.9)\n    switch costume to (1 v)\nend\nif <<key (right arrow v) pressed?> or <<(mouse x) > (x position)> and <mouse down?>>> then\n    change [x v] by (0.9)\n    switch costume to (2 v)\nend\nset [x v] to ((X) * (0.9))\nchange x by (X)\nif <<touching (platform v)?> or <touching color (#00ff2c)?>> then\n    change y by (1)\n    if <<touching (platform v)?> or <touching color (#00ff2c)?>> then\n        change y by (1)\n        if <<touching (platform v)?> or <touching color (#00ff2c)?>> then\n            change y by (1)\n            if <<touching (platform v)?> or <touching color (#00ff2c)?>> then\n                change y by (1)\n                if <<touching (platform v)?> or <touching color (#00ff2c)?>> then\n                    change y by (1)\n                    if <<touching (platform v)?> or <touching color (#00ff2c)?>> then\n                        change y by (1)\n                        if <<touching (platform v)?> or <touching color (#00ff2c)?>> then\n                            change y by (-6)\n                            change x by ((X) * (-1))\n                            if <<key (up arrow v) pressed?> or <<(mouse y) > (y position)> and <mouse down?>>> then\n                                set [y v] to [9]\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                    end\n                end\n            end\n        end\n    end\nend\nchange y by (Y)\nif <<touching (platform v)?> or <touching color (#00ff2c)?>> then\n    change y by ((Y) * (-1))\n    set [y v] to [0]\nend\nchange y by (-0.5)\nif <<<<touching (platform v)?> or <touching color (#00ff2c)?>> and <key (up arrow v) pressed?>> or <<<touching (platform v)?> or <touching color (#00ff2c)?>> and <<(mouse y) > (y position)> and <mouse down?>>>> then\n    switch costume to (4 v)\n    set [y v] to [9.5]\nend\nchange y by (0.5)\nif <touching (danger v)?> then\n    repeat (20)\n        change [ghost v] effect by (5)\n    end\n    go to x: (X Spawn.) y: (Y Spawn.)\n    repeat (20)\n        change [ghost v] effect by (-5)\n    end\n    set [x v] to [0]\n    set [y v] to [0]\nend\nif <(x position) > [233]> then\n    go to x: (X Spawn.) y: (Y Spawn.)\n    broadcast (Next Level v)\n    change [level v] by (1)\n    set [x v] to [0]\n    set [y v] to [0]\nend\nif <touching (spring v)?> then\n    set [y v] to [20]\nend\n\nwhen flag clicked\nset [y spawn. v] to [60]\nset [x spawn. v] to [-218]\ngo to x: (X Spawn.) y: (Y Spawn.)\nswitch costume to (player v)\nswitch backdrop to (cavesbackround v)\nshow\nset size to (70) %\nset [x v] to [0]\nset [y v] to [0]\n\ndefine Run block\nRun Engine\n\nwhen flag clicked\nset [max players! v] to [10]\nset [my player# v] to [0]\nbroadcast (setups v) and wait\nswitch backdrop to (joining v)\nbroadcast (join game v) and wait\nif <(My player#) > [0]> then\n    set [☁ p1 v] to [2]\nelse\n    set [☁ p2 v] to [3]\nend\nbroadcast (begin v)\n\ndefine write (val) to encoded\nset [letter # . v] to [1]\nrepeat (length of (val))\n    set [encodied. v] to (join (encodied.) (item # of (letter (letter # .) of (val)) in [code v]))\n    change [letter # . v] by (1)\nend\nset [encodied. v] to (join (encodied.) [00])\n\nwhen I receive [begin v]\nforever\n    Run block\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 [☁ 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                            else\n                                if <(player) = [9]> then\n                                    set [☁ p9 v] to (value)\n                                else\n                                    set [☁ p10 v] to (value)\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine send cloud data\nset [encodied. v] to []\nwrite (username) to encoded\nwrite (round ((timer) * (10))) to encoded\nwrite (round (x position)) to encoded\nwrite (round (y position)) to encoded\nwrite (costume [number v]) to encoded\nwrite ([costume # v] of [platform v]) to encoded\nset cloud # (My player#) to (encodied.)\n\nwhen flag clicked\nset [connecting.. v] to [1]\n\nwhen flag clicked\nforever\n    if <not <<<key (left arrow v) pressed?> or <<(x position) > (mouse x)> and <mouse down?>>> or <<<key (right arrow v) pressed?> or <<(mouse x) > (x position)> and <mouse down?>>> or <<<key (up arrow v) pressed?> or <<(mouse y) > (y position)> and <mouse down?>>> or <<<<touching (platform v)?> or <touching color (#00ff2c)?>> and <key (up arrow v) pressed?>> or <<<touching (platform v)?> or <touching color (#00ff2c)?>> and <<(mouse y) > (y position)> and <mouse down?>>>>>>>> then\n        switch costume to (3 v)\n    end\nend\n\nwhen flag clicked\nrepeat until <(LEVEL) = [16]>\nend\n\nset [timer v] to ((timer) + (1))\n\nwhen [timer v] > (timer)\nif <(My player#) = [1]> then\n    set [☁ p1 v] to []\n    set [my player# v] to []\nelse\n    if <(My player#) = [2]> then\n        set [☁ p2 v] to []\n        set [my player# v] to []\n    else\n        if <(My player#) = [3]> then\n            set [☁ p3 v] to []\n            set [my player# v] to []\n        else\n            if <(My player#) = [4]> then\n                set [☁ p4 v] to []\n                set [my player# v] to []\n            else\n                if <(My player#) = [5]> then\n                    set [☁ p5 v] to []\n                    set [my player# v] to []\n                else\n                    if <(My player#) = [6]> then\n                        set [☁ p6 v] to []\n                        set [my player# v] to []\n                    else\n                        if <(My player#) = [7]> then\n                            set [☁ p7 v] to []\n                            set [my player# v] to []\n                        else\n                            if <(My player#) = [8]> then\n                                set [☁ p8 v] to []\n                                set [my player# v] to []\n                            else\n                                if <(My player#) = [9]> then\n                                    set [☁ p9 v] to []\n                                    set [my player# v] to []\n                                else\n                                    set [☁ p10 v] to []\n                                    set [my player# v] to []\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nreset timer\nset [timer v] to [0]\n\nwhen flag clicked\nset [level v] to [1]\nforever\n    play sound [TheFatRat - Time Lapse v] until done\nend\n\nset [my player# v] to []\n\nwhen flag clicked\nshow variable [☁ highscore v]\nshow variable [timer v]\nset [☁ highscore v] to [300]\n\nwhen I receive [begin v]\nrepeat until <(LEVEL) = [16]>\n    change [timer v] by (1)\n    wait (0.1) seconds\nend\n\n@Other players\n\ndefine begin decode of (encode)\nset [encodied v] to (encode)\nset [letter # v] to [1]\n\ndefine value=read from encode\nset [value v] to []\nforever\n    set [idx v] to (join (letter (letter #) of (encodied)) (letter ((letter #) + (1)) of (encodied)))\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 (0)\nset [offline v] to [100]\nhide\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        hide\n        set [offline v] to [100]\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                            else\n                                if <(player) = [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 [setups v]\nsetup players\n\ndefine tick\nvalue=Cloud # (Player#)\nif <(join [A] (value)) = (last value)> then\n    change [offline v] by (value)\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 encode\nsay (value)\nvalue=read from encode\nvalue=read from encode\nset x to (value)\nvalue=read from encode\nset y to (value)\nvalue=read from encode\nswitch costume to (value)\nvalue=read from encode\nif <(value) = ([costume # v] of [platform v])> then\n    show\nelse\n    hide\nend\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 flag clicked\nbroadcast (setups v)\nforever\n    show\n    set size to (70) %\nend\n\nshow\n\n@Platform\n\nwhen flag clicked\nswitch costume to (1 v)\n\nwhen I receive [next level v]\nnext costume\n\n@Connection Statements\n\nwhen flag clicked\nforever\n    switch costume to (Connecting..)\n    go to [front v] layer\nend\n\nwhen I receive [begin v]\nhide\n\nwhen flag clicked\nshow\n\n@Danger\n\nwhen flag clicked\nshow\nswitch costume to (1 v)\n\nwhen I receive [next level v]\nnext costume\n\n@Thumbnail\n\nwhen [timer v] > (0.01)\nswitch costume to (thumbnail v)\nset size to (100) %\nset [ghost v] effect to (100)\npoint in direction (90)\ngo to x: (-400) y: (0)\ngo to [front v] layer\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\n    change x by (((0) - (x position)) / (2))\nend\n\nwhen flag clicked\nhide\nswitch costume to (thumbnail v)\nset size to (100) %\nset [ghost v] effect to (100)\ngo to x: (-400) y: (0)\npoint in direction (90)\ngo to [front v] layer\nforever\n    reset timer\nend\n\n@spring\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\nforever\n    if <(LEVEL) = [8]> then\n        show\n        go to x: (-56) y: (-134)\n    end\nend\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\nforever\n    if <(LEVEL) = [9]> then\n        hide\n    end\nend\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\nforever\n    if <(LEVEL) = [10]> then\n        show\n        go to x: (-56) y: (-134)\n    end\nend\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\nforever\n    if <(LEVEL) = [11]> then\n        hide\n    end\nend\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\nforever\n    if <(LEVEL) = [14]> then\n        show\n        go to x: (12) y: (-134)\n    end\nend\n\nhide\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\nforever\n    if <(LEVEL) = [15]> then\n        hide\n    end\nend\n\n@Clouds\n\nwhen I start as a clone\nshow\nforever\n    switch costume to (pick random (1) to (2))\n    set size to (pick random (70) to (80)) %\n    go to [back v] layer\n    set [ghost v] effect to (pick random (5) to (20))\n    if <(pick random (1) to (2)) = [1]> then\n        show\n        go to x: (200) y: (pick random (20) to (180))\n        repeat (50)\n            change x by (2)\n        end\n        if <touching (_edge_ v)?> then\n            hide\n        end\n        wait (pick random (1) to (5)) seconds\n    end\n    switch costume to (pick random (1) to (2))\n    set size to (pick random (70) to (80)) %\n    go to [back v] layer\n    set [ghost v] effect to (pick random (5) to (20))\n    if <(pick random (1) to (2)) = [2]> then\n        show\n        go to x: (220) y: (pick random (20) to (180))\n        repeat (110)\n            change x by (-4)\n        end\n        hide\n        wait (pick random (1) to (5)) seconds\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\n\nwhen flag clicked\n\nwhen I receive [begin v]\nhide\nrepeat (5)\n    create clone of (_myself_ v)\n    wait (1) seconds\nend\n\n