Polluted (multiplayer platformer)
@Stage\n\nwhen flag clicked\nset [ghost v] effect to (0)\nswitch backdrop to (title v)\n\nwhen I receive [start game v]\nset [ghost v] effect to (0)\nswitch backdrop to (backdrop3 v)\nbroadcast (message1 v)\n\nwhen I receive [you won v]\nswitch backdrop to (backdrop2 v)\n\n@Sprite1\n\nwhen I receive [message1 v]\nshow\ngo to [front v] layer\ngo to x: (0) y: (-407)\nrepeat until <(y position) = [-56]>\n    change y by ((1.7) + ((level) / (8)))\n    wait (0.001) seconds\nend\n\nwhen flag clicked\nset [deaths v] to [0]\nset [ghost v] effect to (0)\n\nwhen I receive [you won v]\nstop [other scripts in sprite v]\nhide\n\nwhen flag clicked\nhide\n\nwhen flag clicked\nforever\n    if <touching (player v)?> then\n        change [deaths v] by (1)\n        broadcast (message1 v)\n    end\nend\n\nwhen flag clicked\nforever\n    play sound [Block by bubblebee3 v] until done\nend\n\n@Sprite2\n\nwhen flag clicked\nhide\n\nwhen I receive [you won v]\nset [end v] to [y]\npoint in direction (90)\nshow\nstop [all v]\n\ngo to x: (0) y: (0)\nforever\n    wait (.05) seconds\n    turn right (7.5) degrees\n    wait (.05) seconds\n    turn right (7.5) degrees\n    wait (.05) seconds\n    turn left (7.5) degrees\n    wait (.05) seconds\n    turn left (7.5) degrees\n    turn left (7.5) degrees\n    wait (.05) seconds\n    turn left (7.5) degrees\n    wait (.05) seconds\n    turn right (7.5) degrees\n    wait (.05) seconds\n    turn right (7.5) degrees\nend\n\n@Sprite3\n\nwhen flag clicked\ngo to x: (6) y: (-11)\nshow\n\nwhen I receive [start game v]\nhide\n\n@Sprite4\n\nwhen flag clicked\ngo [backward v] (3) layers\ngo to x: (5) y: (-178)\nhide\nforever\n    wait (pick random (.05) to (1)) seconds\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nif <touching color (#28f300)?> then\n    delete this clone\nend\nshow\nset x to (pick random (-213) to (212))\nrepeat (10)\n    change y by (4)\nend\nrepeat until \n    change y by (4)\nend\ndelete this clone\n\nwhen I receive [start game v]\nstop [other scripts in sprite v]\ndelete this clone\n\n@Sprite5\n\nwhen this sprite clicked\nbroadcast (start game v)\nhide\n\nwhen flag clicked\ngo to x: (0) y: (-40)\nshow\nset [brightness v] effect to (0)\nset size to (100) %\nforever\n    if <touching (mouse-pointer v)?> then\n        set size to (110) %\n        set [brightness v] effect to (10)\n    else\n        set [brightness v] effect to (0)\n        set size to (100) %\n    end\nend\n\n@opponents\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 [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 (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 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\npoint in direction (value)\nvalue=read from encode\nif <(value) = (level)> 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\nset size to (70) %\n\n@Player\n\ndefine Touch Ground <up>\nchange [falling? v] by (1)\nrepeat until <not <touching (ground2 v)?>>\n    if <up> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [falling? v] to [0]\n    end\n    set [my variable v] to [0]\nend\n\ndefine Walk (direction) (speed)\npoint in direction (direction)\nchange x by (speed)\nset [slope v] to [0]\nrepeat until <<(slope) = [8]> or <not <touching (ground2 v)?>>>\n    change y by (1)\n    change [slope v] by (1)\nend\nif <(slope) = [8]> then\n    change x by ((0) - (speed))\n    change y by ((0) - (slope))\nend\nchange [frame v] by (0.5)\n\nwhen flag clicked\nset [level v] to [1]\nhide\n\nwhen I receive [message1 v]\ngo to [front v] layer\ngo to x: (-205) y: (100)\nswitch costume to (costume1 v)\nset rotation style [left-right v]\nset [my variable v] to [0]\nshow\nforever\n    change [my variable v] by (-1)\n    change y by (my variable)\n    Touch Ground <(my variable) > [0]>\n    if <<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>>> then\n        Walk [-90] [-6]\n    else\n        if <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>>> then\n            Walk [90] [6]\n        else\n            set [frame v] to [0]\n        end\n    end\n    if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n        if <<(jump key) = [0]> and <(falling?) < [3]>> then\n            set [my variable v] to [14]\n            set [falling? v] to [6]\n            set [jump key v] to [1]\n        else\n            set [jump key v] to [0]\n        end\n    end\n    if <(x position) > [222]> then\n        if <(level) < [12]> then\n            go to x: (-205) y: (100)\n            change [level v] by (1)\n            broadcast (message1 v)\n        else\n            broadcast (You won v)\n            hide\n            stop [other scripts in sprite v]\n            stop [this script v]\n        end\n    end\nend\n\nwhen flag clicked\nset [timer v] to [0]\nrepeat until <[] = [1]>\n    change [timer v] by (-1)\nend\nstop [all v]\n\nwhen I receive [you won v]\nchange [level v] by (1)\nhide\n\nwhen I receive [message1 v]\nforever\n    if <touching color (#00ec08)?> then\n        broadcast (message1 v)\n    end\nend\n\nwhen I receive [start v]\n\nbroadcast (message1 v)\n\nwhen I receive [begin v]\n\nwhen I receive [begin v]\nforever\n    if <(My Player #) > [0]> then\n        send cloud data\n    end\nend\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 [☁ p1 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 flag clicked\nbroadcast (Play game v)\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 (direction) to encoded\nwrite (level) to encoded\nset cloud # (My Player #) to (encodied)\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\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\nset [☁ p1 v] to [0]\nset [☁ p2 v] to [0]\nset [☁ p3 v] to [0]\nset [☁ p4 v] to [0]\nset [☁ p5 v] to [0]\nset [☁ p6 v] to [0]\nset [☁ p7 v] to [0]\nset [☁ p8 v] to [0]\nset [☁ p9 v] to [0]\nset [☁ p10 v] to [0]\n\nwhen flag clicked\nset [time v] to [0]\nset [end v] to [n]\nhide variable [time v]\n\nwhen I receive [start game v]\nshow variable [time v]\nrepeat until <(End) = [y]>\n    wait (1) seconds\n    change [time v] by (1)\nend\n\n@ground2\n\nwhen I receive [message1 v]\ngo to x: (0) y: (0)\nshow\nswitch costume to (level)\n\nwhen flag clicked\nswitch costume to (1 v)\nhide\n\nwhen I receive [you won v]\nhide\n\n@Sprite7\n\nwhen flag clicked\nhide\ngo to x: (0) y: (-10)\nforever\n    if <(level) = [5]> then\n        switch costume to (costume1 v)\n        show\n        go to [back v] layer\n        repeat (12)\n            if <(level) = [5]> then\n                change y by (1)\n            else\n                hide\n            end\n        end\n        repeat (12)\n            if <(level) = [5]> then\n                change y by (-1)\n            else\n                hide\n            end\n        end\n        hide\n    else\n        go to x: (42) y: (-116)\n        if <(level) = [13]> then\n            switch costume to (costume2 v)\n            show\n            go to [back v] layer\n            repeat (12)\n                if <(level) = [13]> then\n                    change y by (1)\n                else\n                    hide\n                end\n            end\n            repeat (12)\n                if <(level) = [13]> then\n                    change y by (-1)\n                else\n                    hide\n                end\n            end\n        else\n            hide\n        end\n    end\nend\n\n@trail\n\nwhen flag clicked\nforever\n    set size to (0.1) %\nend\n\nclear graphic effects\n\nwhen flag clicked\nswitch backdrop to (xy-grid-30px v)\nforever\n    if <(shape) = [square]> then\n        switch costume to (costume1 v)\n    else\n        if <(shape) = [circle]> then\n            switch costume to (costume3 v)\n        else\n            if <(shape) = [heart]> then\n                switch costume to (costume2 v)\n            else\n                if <(shape) = [star]> then\n                    switch costume to (costume4 v)\n                end\n            end\n        end\n    end\nend\n\nwhen I start as a clone\nset size to (60) %\nset size to (60) %\nrepeat (25)\n    change size by (-1)\n    change [ghost v] effect by (6)\n    change [pixelate v] effect by (2)\n    change [brightness v] effect by (2)\nend\ndelete this clone\n\nwhen flag clicked\nforever\n    if <(my variable) = [rainbow]> then\n        if <(my variable) = [black]> then\n            if <(shape) = [square]> then\n                switch costume to (1 v)\n            else\n                if <(shape) = [circle]> then\n                    switch costume to (3 v)\n                else\n                    if <(shape) = [heart]> then\n                        switch costume to (2 v)\n                    else\n                        if <(shape) = [star]> then\n                            switch costume to (4 v)\n                        end\n                    end\n                end\n            end\n            set [brightness v] effect to (-80)\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    go to [back v] layer\n    set size to (60) %\nend\n\nwhen flag clicked\nforever\n    if <(my variable) = [black]> then\n        if <(shape) = [square]> then\n            switch costume to (1 v)\n        else\n            if <(shape) = [circle]> then\n                switch costume to (3 v)\n            else\n                if <(shape) = [heart]> then\n                    switch costume to (2 v)\n                else\n                    if <(shape) = [star]> then\n                        switch costume to (4 v)\n                    end\n                end\n            end\n        end\n        set [brightness v] effect to (-80)\n    end\nend\n\nwhen I receive [start game v]\nshow\nforever\n    go to (player v)\n    create clone of (_myself_ v)\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [you won v]\nhide\n\n
--------------------------⚠POLLUTED⚠----------------------------- multiplayer arrow keys to move. Save the Earth from pollution! ❤ and ⭐ if you enjoy!\nNote: mobile friendly. Unshared to fix a couple of glitches and improve level art. Sorry for the inconvenience.