☁ Drown - A☁ Mobile Multiplayer Platformer By @DarkPhrophecy


@Stage\n\nwhen flag clicked\nwait (4) seconds\nplay sound [Unlimited v] until done\nplay sound [Nebula v] until done\nplay sound [Popsicle v] until done\nplay sound [Vexento - Pixel Party v] until done\nplay sound [SharaX - Vive La Verse v] until done\nplay sound [Alan Walker - Force v] until done\nplay sound [mbb-beach v] until done\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v) and wait\n\n@player\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 (ground v)?> or <touching color (#00ff2c)?>> then\n    change y by (1)\n    if <<touching (ground v)?> or <touching color (#00ff2c)?>> then\n        change y by (1)\n        if <<touching (ground v)?> or <touching color (#00ff2c)?>> then\n            change y by (1)\n            if <<touching (ground v)?> or <touching color (#00ff2c)?>> then\n                change y by (1)\n                if <<touching (ground v)?> or <touching color (#00ff2c)?>> then\n                    change y by (1)\n                    if <<touching (ground v)?> or <touching color (#00ff2c)?>> then\n                        change y by (1)\n                        if <<touching (ground 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 (ground 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 (ground v)?> or <touching color (#00ff2c)?>> and <key (up arrow v) pressed?>> or <<<touching (ground 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 (spikes 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\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 [4]\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 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 [ground 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 (ground v)?> or <touching color (#00ff2c)?>> and <key (up arrow v) pressed?>> or <<<touching (ground 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\nforever\n    set [timer v] to ((timer) + (1))\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\nreset timer\nset [timer v] to [0]\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 (ground v)?> or <touching color (#00ff2c)?>> and <key (up arrow v) pressed?>> or <<<touching (ground 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\nwhen flag clicked\nif <(☁ life) = [5]> then\n    change [pitch v] effect by (10)\nend\n\nwhen flag clicked\nset [☁ life v] to [5]\n\nwhen flag clicked\nhide\nwait (4) seconds\nshow\n\nwhen flag clicked\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 [color v] effect to (90)\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\nswitch costume to (value)\nvalue=read from encode\nif <(value) = ([costume # v] of [ground 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\nset size to (70) %\n\n@Ground\n\nwhen flag clicked\nswitch costume to (1 v)\n\nwhen I receive [next level v]\nnext costume\n\nwhen flag clicked\nhide\nwait (3.1) seconds\nshow\n\n@Connection Statements\n\nwhen flag clicked\nwait (6) seconds\nforever\n    switch costume to (Connecting)\nend\n\nwhen I receive [begin v]\nhide\n\nwhen flag clicked\nshow\n\n@Spikes\n\nwhen flag clicked\nhide\n\nwhen I receive [next level v]\nnext costume\n\nwhen I receive [begin v]\nshow\nswitch costume to (1 v)\ngo to [front v] layer\n\n@Thumbnail\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    go to x: (0) y: (5)\n    go to [front v] layer\nend\n\n@intro\n\nwhen flag clicked\nhide\n\nwhen flag clicked\nset [ghost v] effect to (0)\nshow\nswitch costume to (costume1 v)\nwait (0.5) seconds\nstart sound [Cinematic Impact Sound Effects v]\nbroadcast (shake v)\nswitch costume to (costume2 v)\nwait (1.5) seconds\nswitch costume to (costume3 v)\nwait (2) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nbroadcast (Start animation v)\n\nwhen flag clicked\nset [brightness v] effect to (100)\nrepeat (5)\n    go to x: (pick random (-5) to (5)) y: (pick random (-5) to (5))\n    change [brightness v] effect by (-14)\nend\nrepeat (5)\n    go to x: (pick random (-1) to (1)) y: (pick random (-1) to (1))\n    change [brightness v] effect by (-6)\nend\ngo to x: (0) y: (0)\n\n@Water\n\nwhen flag clicked\nhide\nwait (4) seconds\nshow\ngo to x: (-439) y: (-162)\nforever\n    switch costume to (costume1 v)\n    show\n    wait (0.1) seconds\n    repeat (20)\n        change y by ([ceiling v] of (0.5) )\n    end\n    wait (0.1) seconds\n    repeat (20)\n        change y by ([ceiling v] of (-1) )\n    end\nend\n\nif <(scene) = [game]> then\n\ngo to [front v] layer\n\n@Sprite1\n\nwhen this sprite clicked\nbroadcast (Next Level v)\n\nwhen flag clicked\nhide\nwait (4) seconds\nshow\n\nwhen flag clicked\ngo to x: (38) y: (30)\n\n@Love Fav\n\nwhen flag clicked\nhide\nforever\n    wait (pick random (5) to (20)) seconds\n    switch costume to (costume1 v)\n    go to x: (0) y: (50)\n    show\n    go to [front v] layer\n    repeat (9)\n        change y by (-6)\n    end\n    repeat (5)\n        change y by (3)\n    end\n    repeat (5)\n        change y by (-1)\n    end\n    wait (2) seconds\n    repeat (15)\n        change y by (7)\n    end\n    hide\nend\n\n