Cloud Multiplayer Platformer

Instructions: Instructions:\nArrow Keys\nWAD\navoid many dangers in the volcano, such as spikes, lava geysers, and magma cubes!\n#3 ON GAMES TRENDING!! :D\nwhat the community is loving!! :D\ncheck out underwater platformer! https://scratch.mit.edu/projects/482963901/\nCredits:\n@xXEdgeXx and @GlizzyGobbler765 for some player code\n@icmy123 for enemy ai code, edited by me\n@ori_gin for the lava spray\n@legendscroll for treasure\nmusic by Alan Walker\n#all

@Stage\n\nwhen I receive [begin v]\nset volume to (50) %\nwait (.2) seconds\nforever\n    play sound [Nebula v] until done\nend\n\nrepeat (10)\n    change volume by (5)\nend\n\nrepeat (10)\n    change volume by (-5)\nend\nplay sound [Nebula v] until done\n\nstart sound [Nebula v]\n\nwhen I receive [full v]\nstop [all v]\n\n@player\n\ndefine Chat\nif <(is the chat open) = [1]> then\n    if <key (1 v) pressed?> then\n        set [chat v] to [1]\n        say (item (Chat) of [chat v])\n        wait (2) seconds\n        say []\n        set [chat v] to [0]\n    else\n        if <key (2 v) pressed?> then\n            set [chat v] to [2]\n            say (item (Chat) of [chat v])\n            wait (2) seconds\n            say []\n            set [chat v] to [0]\n        else\n            if <key (3 v) pressed?> then\n                set [chat v] to [3]\n                say (item (Chat) of [chat v])\n                wait (2) seconds\n                say []\n                set [chat v] to [0]\n            else\n                if <key (4 v) pressed?> then\n                    set [chat v] to [4]\n                    say (item (Chat) of [chat v])\n                    wait (2) seconds\n                    say []\n                    set [chat v] to [0]\n                else\n                    if <key (5 v) pressed?> then\n                        set [chat v] to [5]\n                        say (item (Chat) of [chat v])\n                        wait (2) seconds\n                        say []\n                        set [chat v] to [0]\n                    else\n                        if <key (6 v) pressed?> then\n                            set [chat v] to [6]\n                            say (item (Chat) of [chat v])\n                            wait (2) seconds\n                            say []\n                            set [chat v] to [0]\n                        else\n                            if <key (7 v) pressed?> then\n                                set [chat v] to [7]\n                                say (item (Chat) of [chat v])\n                                wait (2) seconds\n                                say []\n                                set [chat v] to [0]\n                            else\n                                if <key (8 v) pressed?> then\n                                    set [chat v] to [8]\n                                    say (item (Chat) of [chat v])\n                                    wait (2) seconds\n                                    say []\n                                    set [chat v] to [0]\n                                else\n                                    if <key (9 v) pressed?> then\n                                        set [chat v] to [9]\n                                        say (item (Chat) of [chat v])\n                                        wait (2) seconds\n                                        say []\n                                        set [chat v] to [0]\n                                    else\n                                        set [chat v] to [0]\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Position\ngo to x: ((x) - (SCROLL X)) y: ((y) - (SCROLL Y))\n\nwhen flag clicked\nset [scroll y v] to [0]\nset [##spawnx v] to [-220]\nset [##spawny v] to [-120]\nset [scroll x v] to [0]\nshow list [chat v]\nbroadcast (GREEN FLAG v) and wait\nbroadcast (PLAY GAME v) and wait\n\ndefine CHANGE PLAYER Y BY (sy)\nchange [y v] by (sy)\nchange [inair v] by (1)\nset [player y v] to (y)\nPosition\nrepeat until <not <touching (platform v)?>>\n    if <(sy) > [0]> then\n        change [y v] by (-1)\n    else\n        change [y v] by (1)\n        set [inair v] to [0]\n    end\n    Position\n    set [sy v] to [0]\nend\n\ndefine GAME ON\nset [x v] to (##SpawnX)\nset [y v] to (##SpawnY)\nset [sy v] to [0]\nset [sx v] to [0]\nset [scroll x v] to (##SpawnX)\nset [scroll y v] to (##SpawnY)\nset [inair v] to [0]\nset [exit v] to []\nset size to (90) %\nset [ghost v] effect to (0)\nshow\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\n\ndefine Game-Win\nrepeat (50)\n    point towards (exit v)\n    turn right (65) degrees\n    move ((distance to [exit v]) / (2)) steps\n    change size by (-1)\n    change [ghost v] effect by (2)\nend\nhide\nchange [level v] by (1)\n\ndefine TICK\nset [#### v] to ((Para?) + ((Immortal?) + (Jetpack?)))\nset [time v] to (join [Special skill remaining time: ] (####))\nswitch costume to (costume2 v)\nhide variable [time v]\nif <touching (platform3 v)?> then\n    set [jetpack? v] to [10]\n    set [immortal? v] to [0]\n    set [para? v] to [0]\n    show variable [time v]\nend\nif <touching (platform4 v)?> then\n    set [immortal? v] to [10]\n    set [jetpack? v] to [0]\n    set [para? v] to [0]\n    show variable [time v]\nend\nif <touching (platform5 v)?> then\n    set [para? v] to [10]\n    set [jetpack? v] to [0]\n    set [immortal? v] to [0]\n    show variable [time v]\nend\nif <(####) > [0]> then\n    show variable [time v]\nend\nif <<<(mouse x) < (x position)> and <mouse down?>> or <<key (left arrow v) pressed?> or <key (a v) pressed?>>> then\n    set [&&&&offline v] to [100]\n    set [&&&&offline v] to [500]\n    change [sx v] by (-2)\n    point in direction (-90)\nend\nif <<<(x position) < (mouse x)> and <mouse down?>> or <<key (right arrow v) pressed?> or <key (d v) pressed?>>> then\n    set [&&&&offline v] to [100]\n    set [&&&&offline v] to [500]\n    change [sx v] by (2)\n    point in direction (90)\nend\nset [sx v] to ((sx) * (0.8))\nif <[0.9] < ([abs v] of (sx) )> then\n    CHANGE PLAYER X By (round (sx))\nend\nif <<<(y position) < (mouse y)> and <mouse down?>> or <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n    set [&&&&offline v] to [100]\n    set [&&&&offline v] to [500]\n    if <not <touching (ladders v)?>> then\n        if <not <(Jetpack?) > [0]>> then\n            if <(inair) < [4]> then\n                set [sy v] to [16]\n                if <(Para?) > [0]> then\n                    set [sy v] to [25]\n                end\n            end\n        else\n            set [sy v] to [8]\n        end\n    end\nend\nif <(sy) > [-20]> then\n    if <not <touching (ladders v)?>> then\n        change [sy v] by (-2)\n    end\nend\nif <touching (ladders v)?> then\n    set [inair v] to [0]\n    set [sy v] to [0]\n    if <<<(y position) < (mouse y)> and <mouse down?>> or <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n        set [&&&&offline v] to [100]\n        set [&&&&offline v] to [500]\n        CHANGE PLAYER Y BY [8]\n    end\n    if <<<(mouse y) < (y position)> and <mouse down?>> or <<key (down arrow v) pressed?> or <key (s v) pressed?>>> then\n        set [&&&&offline v] to [100]\n        set [&&&&offline v] to [500]\n        CHANGE PLAYER Y BY [-8]\n    end\nend\nCHANGE PLAYER Y BY (sy)\nTEST-DIE\nchange [scroll x v] by (round (((x) - (SCROLL X)) / (8)))\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\nend\nif <[960] < (SCROLL X)> then\n    set [scroll x v] to [960]\nend\nchange [scroll y v] by (round (((y) - (SCROLL Y)) / (8)))\nif <(SCROLL Y) < [0]> then\n    set [scroll y v] to [0]\nend\nif <[900] < (SCROLL Y)> then\n    set [scroll y v] to [900]\nend\nPosition\nif <(Jetpack?) > [0]> then\n    switch costume to (costume3 v)\n    if <<<(y position) < (mouse y)> and <mouse down?>> or <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n        set [&&&&offline v] to [100]\n        set [&&&&offline v] to [500]\n        switch costume to (costume4 v)\n    end\nelse\n    if <(Immortal?) > [0]> then\n        switch costume to (costume5 v)\n    else\n        if <<(inair) > [0]> and <(Para?) > [0]>> then\n            switch costume to (costume6 v)\n            set [sy v] to [-1]\n        end\n    end\nend\n\nswitch costume to (costume2 v)\n\nwhen I receive [begin v]\nset [is the chat open v] to [0]\nshow list [chat v]\nforever\n    Chat\n    if <<key (t v) pressed?> or <<touching (mouse-pointer v)?> and <mouse down?>>> then\n        if <(is the chat open) = [1]> then\n            show list [chat v]\n            set [is the chat open v] to [0]\n        else\n            set [is the chat open v] to [1]\n            hide list [chat v]\n        end\n        wait until <not <key (t v) pressed?>>\n    end\nend\n\ndefine GAME - DIE\nset [exit v] to []\nbroadcast (tick v)\n\ndefine TEST-DIE\nif <touching (dangers  v)?> then\n    if <not <(Immortal?) > [0]>> then\n        set [exit v] to [die]\n    end\nend\n\ndefine CHANGE PLAYER X By (sx)\nchange [x v] by (sx)\nPosition\nif <touching (platform v)?> then\n    repeat (18)\n        change [y v] by (1)\n        Position\n        if <not <touching (platform v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-18)\n    repeat until <not <touching (platform 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\nwhen flag clicked\nset [max players v] to [10]\nset [my player # v] to [0]\nbroadcast (setups v) and wait\nbroadcast (joining v)\nbroadcast (join game v) and wait\nif <(My Player #) > [0]> then\n    start sound [Connect v]\n    broadcast (joined v)\nelse\n    start sound [Disconnect v]\n    broadcast (full v)\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]\nset [level v] to [1]\nforever\n    broadcast (reset v) and wait\n    broadcast (SETUP v) and wait\n    GAME ON\n    repeat until <(EXIT) > []>\n        TICK\n        broadcast (tick v)\n        if <(My Player #) > [0]> then\n            send cloud data\n        end\n    end\n    if <(EXIT) = [win]> then\n        Game-Win\n    else\n        GAME - DIE\n    end\nend\n\ndefine set cloud # (player) to (value)\nif <(player) = [1]> then\n    set [☁ new new p1 v] to (value)\nelse\n    if <(player) = [2]> then\n        set [☁ new new p2 v] to (value)\n    else\n        if <(player) = [3]> then\n            set [☁ new p3 v] to (value)\n        else\n            if <(player) = [4]> then\n                set [☁ new p4 v] to (value)\n            else\n                if <(player) = [5]> then\n                    set [☁ new new p5 v] to (value)\n                else\n                    if <(player) = [6]> then\n                        set [☁ new p6 v] to (value)\n                    else\n                        if <(player) = [7]> then\n                            set [☁ new new p7 v] to (value)\n                        else\n                            if <(player) = [8]> then\n                                set [☁ new p8 v] to (value)\n                            else\n                                if <(player) = [9]> then\n                                    set [☁ p9 v] to (value)\n                                else\n                                    if <(player) = [10]> then\n                                        set [☁ new p10 v] to (value)\n                                    end\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 ((###LOCAL TIME) * (10))) to encoded\nwrite (direction) to encoded\nwrite (costume [number v]) to encoded\nwrite (x) to encoded\nwrite (y) to encoded\nwrite (Chat) to encoded\nset cloud # (My Player #) to (encodied)\n\nwhen I receive [begin v]\nswitch backdrop to (blank v)\n\nwhen I receive [@test-die v]\nbroadcast (tick v)\nGAME - DIE\nif <touching (enemy v)?> then\n    set [exit v] to [die]\nend\n\nshow\n\nwhen flag clicked\nforever\n    if <(Jetpack?) > [0]> then\n        change [jetpack? v] by (-1)\n        wait (1) seconds\n    end\nend\n\nwhen flag clicked\nhide variable [time v]\nforever\n    if <(Immortal?) > [0]> then\n        change [immortal? v] by (-1)\n        wait (1) seconds\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Para?) > [0]> then\n        change [para? v] by (-1)\n        wait (1) seconds\n    end\nend\n\nchange [sy v] by (-1)\n\nswitch costume to (costume6 v)\n\nwhen flag clicked\nset [collected v] to [0]\nhide variable [##display val v]\nset [###local time v] to [0]\nforever\n    change [###local time v] by (1)\nend\n\nwhen I receive [begin v]\nshow variable [##display val v]\n\nwhen flag clicked\nforever\n    if <(COLLECTED) > [50]> then\n        set [collected v] to [50]\n    end\nend\n\nwhen I receive [joined v]\nset [&&&&offline v] to [500]\nforever\n    change [&&&&offline v] by (-1)\n    if <(&&&&OFFLINE) = [0]> then\n        stop [all v]\n    end\nend\n\n@opponents\n\ndefine Decode chat (chat)\nif <(chat) = [0]> then\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 size 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\n    go to [front v] layer\nend\n\ndefine value=Cloud # (player)\nif <(player) = [1]> then\n    set [value v] to (☁ NEW NEW P1)\nelse\n    if <(player) = [2]> then\n        set [value v] to (☁ NEW NEW P2)\n    else\n        if <(player) = [3]> then\n            set [value v] to (☁ NEW P3)\n        else\n            if <(player) = [4]> then\n                set [value v] to (☁ NEW P4)\n            else\n                if <(player) = [5]> then\n                    set [value v] to (☁ NEW NEW P5)\n                else\n                    if <(player) = [6]> then\n                        set [value v] to (☁ NEW P6)\n                    else\n                        if <(player) = [7]> then\n                            set [value v] to (☁ NEW NEW P7)\n                        else\n                            if <(player) = [8]> then\n                                set [value v] to (☁ NEW P8)\n                            else\n                                if <(player) = [9]> then\n                                    set [value v] to (☁ P9)\n                                else\n                                    if <(player) = [10]> then\n                                        set [value v] to (☁ NEW P10)\n                                    end\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\nif <(names) = [1]> then\n    say (join (player #) (join [:] (value)))\nelse\n    say []\nend\nvalue=read from encode\nvalue=read from encode\npoint in direction (value)\nvalue=read from encode\nswitch costume to (value)\nvalue=read from encode\nset [x val v] to ((value) - (SCROLL X))\nvalue=read from encode\nset [y val v] to ((value) - (SCROLL Y))\nPOSTION (x val) (y val)\nvalue=read from encode\nbroadcast (Decode chat v)\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 I receive [decode chat v]\nDecode chat (value)\n\nDecode chat (value)\n\nwhen I receive [begin v]\nset [names v] to [1]\nforever\n    if <key (n v) pressed?> then\n        if <(names) = [1]> then\n            wait until <not <key (n v) pressed?>>\n            set [names v] to [0]\n        else\n            wait until <not <key (n v) pressed?>>\n            set [names v] to [1]\n        end\n    end\nend\n\ndefine POSTION (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    clear graphic effects\nelse\n    set [ghost v] effect to (100)\nend\n\nwhen I receive [tick v]\n\ngo to [front v] layer\n\n@PLATFORM\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPOSTION ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (3/1 v)\n    CLONE AT X [480] Y [0]\n    CLONE AT X [480] Y [0]\n    CLONE AT X [-960] Y [360]\n    CLONE AT X [480] Y [0]\n    CLONE AT X [480] Y [0]\n    CLONE AT X [-960] Y [360]\n    CLONE AT X [480] Y [0]\n    CLONE AT X [480] Y [0]\nend\n\ndefine POSTION (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\ndefine CLONE AT X (x) Y (y)\ncreate clone of (_myself_ v)\ngo [backward v] (1) layers\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\n@DANGERs \n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\ngo to [back v] layer\nPOSTION ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1 1 v)\n    CLONE AT X [480] Y [0]\n    CLONE AT X [480] Y [0]\n    CLONE AT X [-960] Y [320]\n    CLONE AT X [480] Y [0]\n    CLONE AT X [480] Y [0]\n    CLONE AT X [-960] Y [320]\n    CLONE AT X [480] Y [0]\n    CLONE AT X [480] Y [0]\nend\n\ndefine POSTION (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\ndefine CLONE AT X (x) Y (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\n@Coins\n\nwhen flag clicked\nforever\n    set [display value v] to (join (COLLECTED) (join [ / ] (COLLECT MAX)))\nend\n\nwhen [space v] key pressed\nset [mesee v] to (join ((mouse x) + (SCROLL X)) (join [,] ((mouse y) + (SCROLL Y))))\n\nwhen I start as a clone\nforever\n    if <touching (player v)?> then\n        change [collected v] by (1)\n        if <(COLLECTED) = (COLLECT MAX)> then\n            broadcast (Open exit v)\n        end\n        delete this clone\n    end\nend\n\nwhen flag clicked\nhide\nset [collected v] to [0]\nset [collect max v] to [50]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (dot v)\n    Clone at x: [-20] y: [-40]\n    Clone at x: [60] y: [-40]\n    Clone at x: [-20] y: [40]\n    Clone at x: [-100] y: [40]\n    Clone at x: [-140] y: [40]\n    Clone at x: [300] y: [-80]\n    Clone at x: [340] y: [0]\n    Clone at x: [420] y: [-80]\n    Clone at x: [660] y: [-120]\n    Clone at x: [620] y: [-40]\n    Clone at x: [20] y: [200]\n    Clone at x: [-140] y: [560]\n    Clone at x: [580] y: [80]\n    Clone at x: [420] y: [200]\n    Clone at x: [900] y: [-120]\n    Clone at x: [740] y: [-120]\n    Clone at x: [740] y: [40]\n    Clone at x: [1020] y: [240]\n    Clone at x: [940] y: [240]\n    Clone at x: [940] y: [400]\n    Clone at x: [80] y: [100]\n    Clone at x: [-100] y: [320]\n    Clone at x: [140] y: [320]\n    Clone at x: [-100] y: [860]\n    Clone at x: [-100] y: [900]\n    Clone at x: [-100] y: [940]\n    Clone at x: [-100] y: [980]\n    Clone at x: [260] y: [200]\n    Clone at x: [-100] y: [1020]\n    Clone at x: [540] y: [320]\n    Clone at x: [620] y: [320]\n    Clone at x: [740] y: [200]\n    Clone at x: [1180] y: [-80]\n    Clone at x: [1140] y: [-80]\n    Clone at x: [1140] y: [160]\n    Clone at x: [1180] y: [160]\n    Clone at x: [860] y: [480]\n    Clone at x: [944] y: [600]\n    Clone at x: [1140] y: [600]\n    Clone at x: [1140] y: [680]\n    Clone at x: [1140] y: [760]\n    Clone at x: [1140] y: [840]\n    Clone at x: [979] y: [1022]\n    Clone at x: [900] y: [920]\n    Clone at x: [140] y: [600]\n    Clone at x: [460] y: [760]\n    Clone at x: [300] y: [320]\n    Clone at x: [340] y: [320]\n    Clone at x: [865] y: [0]\n    Clone at x: [820] y: [1140]\n    Clone at x: [740] y: [80]\nelse\nend\nset [x v] to [-99999]\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nnext costume\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\ndefine Clone at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\n\nwhen I receive [tick v]\nset [##display val v] to (join (COLLECTED) (join [ / ] (join (COLLECT MAX) [ Coins])))\n\n@Ladders\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPOSTION ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (3/1 v)\n    CLONE AT X [480] Y [0]\n    CLONE AT X [480] Y [0]\n    CLONE AT X [-960] Y [360]\n    CLONE AT X [480] Y [0]\n    CLONE AT X [480] Y [0]\n    CLONE AT X [-960] Y [360]\n    CLONE AT X [480] Y [0]\n    CLONE AT X [480] Y [0]\nend\n\ndefine POSTION (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\ndefine CLONE AT X (x) Y (y)\ngo to [back v] layer\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\n@Enemy\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPOSTION ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\ndefine POSTION (x) (y)\nset rotation style [left-right v]\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\ndefine CLONE (sx) (sy)\npoint in direction (90)\nset [x v] to (sx)\nset [y v] to (sy)\nset [startx v] to (sx)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nforever\n    Smooth Gliding ((startx) - (80))\n    Smooth Gliding (startx)\nend\n\ndefine Smooth Gliding (end)\npoint in direction ((direction) * (-1))\nrepeat until <(round (x)) = (end)>\n    change [x v] by (((end) - (x)) / (6))\nend\n\ndelete this clone\n\nstop [this script v]\n\nwhen I start as a clone\nforever\n    if <touching (player v)?> then\n        if <(Player Y) > (y)> then\n            set [sy v] to [16]\n            repeat (10)\n                change [ghost v] effect by (10)\n            end\n            delete this clone\n        else\n            broadcast (@Test-Die v)\n        end\n    end\nend\n\nwhen flag clicked\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    CLONE [-60] [-125]\n    CLONE [580] [-125]\n    CLONE [220] [195]\n    CLONE [-20] [555]\n    CLONE [860] [320]\n    CLONE [380] [555]\n    CLONE [1100] [600]\nend\nset [x v] to [-99999]\n\n@Checkpoint \n\nwhen flag clicked\nset [checkpoint v] to [0]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    set [# v] to [0]\n    switch costume to (close flag v)\n    Clone at x: [-200] y: [-140]\n    Clone at x: [40] y: [300]\n    Clone at x: [520] y: [20]\n    Clone at x: [1030] y: [20]\n    Clone at x: [1030] y: [385]\n    Clone at x: [120] y: [660]\n    Clone at x: [1180] y: [900]\nend\nset [x v] to [-99999]\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <(costume [number v]) = [2]> then\n    if <touching (player v)?> then\n        switch costume to (green flag v)\n        set [##spawnx v] to ((x) - (15))\n        set [##spawny v] to ((y) + (20))\n        set [checkpoint v] to (#)\n    end\nend\nif <not <(Checkpoint) = (#)>> then\n    switch costume to (close flag v)\nend\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\ndefine Clone at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\nchange [# v] by (1)\ncreate clone of (_myself_ v)\n\n@Bouncy\n\nwhen flag clicked\nset [checkpoint v] to [0]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    set [# v] to [0]\n    switch costume to (bouncy_2 v)\n    Clone at x: [260] y: [-140]\n    Clone at x: [660] y: [60]\n    Clone at x: [-220] y: [380]\n    Clone at x: [20] y: [540]\n    Clone at x: [700] y: [180]\n    Clone at x: [420] y: [540]\n    Clone at x: [780] y: [460]\nend\nset [x v] to [-99999]\n\nClone at x: [4307] y: [100]\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\ngo to [back v] layer\nPosition ((x) - (SCROLL X)) (((y) - (SCROLL Y)) + (2))\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\ndefine Clone at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\nchange [# v] by (1)\ncreate clone of (_myself_ v)\n\nset [checkpoint v] to (#)\n\nset [sy v] to [32]\n\nwhen I start as a clone\nforever\n    if <touching (player v)?> then\n        set [sy v] to [28]\n        switch costume to (bouncy v)\n        repeat (2)\n            next costume\n        end\n        repeat (2)\n            switch costume to ((costume [number v]) - (1))\n        end\n    else\n        switch costume to (bouncy v)\n    end\nend\n\n@Loading...\n\nwhen I start as a clone\nshow\nswitch costume to (run_r1 v)\nforever\n    next costume\n    wait (.05) seconds\nend\n\nwhen I receive [joined v]\ndelete this clone\n\nwhen flag clicked\nhide\ncreate clone of (_myself_ v)\n\n@PLATFORM2\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPOSTION ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (3/1 v)\n    CLONE AT X [480] Y [0]\n    CLONE AT X [480] Y [0]\n    CLONE AT X [-960] Y [360]\n    CLONE AT X [480] Y [0]\n    CLONE AT X [480] Y [0]\n    CLONE AT X [-960] Y [360]\n    CLONE AT X [480] Y [0]\n    CLONE AT X [480] Y [0]\nend\n\ndefine POSTION (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\ndefine CLONE AT X (x) Y (y)\ncreate clone of (_myself_ v)\ngo to [back v] layer\ngo [backward v] (1) layers\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\n@PLATFORM3\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPOSTION ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (3/1 v)\n    CLONE AT X [480] Y [0]\n    CLONE AT X [480] Y [0]\n    CLONE AT X [-960] Y [360]\n    CLONE AT X [480] Y [0]\n    CLONE AT X [480] Y [0]\n    CLONE AT X [-960] Y [360]\nend\n\ndefine POSTION (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\ndefine CLONE AT X (x) Y (y)\nchange [x v] by (x)\nchange [y v] by (y)\ngo to [back v] layer\n\n@PLATFORM4\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPOSTION ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (3/1 v)\n    CLONE AT X [480] Y [0]\n    CLONE AT X [480] Y [0]\n    create clone of (_myself_ v)\nend\n\ndefine POSTION (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\ndefine CLONE AT X (x) Y (y)\nchange [x v] by (x)\nchange [y v] by (y)\ngo to [back v] layer\n\n@PLATFORM5\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPOSTION ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (3/1 v)\n    CLONE AT X [480] Y [0]\n    CLONE AT X [480] Y [0]\n    CLONE AT X [0] Y [360]\n    CLONE AT X [0] Y [360]\n    create clone of (_myself_ v)\nend\n\ndefine POSTION (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\ndefine CLONE AT X (x) Y (y)\nchange [x v] by (x)\nchange [y v] by (y)\ngo to [back v] layer\n\ncreate clone of (_myself_ v)\n\n@PLATFORM6\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPOSTION ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\ndefine POSTION (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\n    if <(COLLECTED) = [50]> then\n        switch costume to (level 1 2 v)\n        if <touching (player v)?> then\n            set [win v] to [1]\n            stop [all v]\n        end\n    else\n        switch costume to (level 1 8 v)\n    end\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine CLONE AT X (x) Y (y)\ngo [backward v] (1) layers\nchange [x v] by (x)\nchange [y v] by (y)\n\nwhen flag clicked\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (3/1 v)\n    CLONE AT X [480] Y [0]\n    CLONE AT X [480] Y [0]\n    CLONE AT X [-960] Y [360]\n    CLONE AT X [480] Y [0]\n    CLONE AT X [480] Y [0]\n    CLONE AT X [-960] Y [360]\n    CLONE AT X [480] Y [0]\nend\n\nwhen flag clicked\nset [win v] to [0]\n\n@Sprite1\n\nwhen [timer v] > (0.01)\ngo to [front v] layer\nset [shake v] to [15]\nhide variable [##display val v]\nhide variable [time v]\nset size to (115) %\nrepeat (15)\n    switch costume to (costume2 v)\n    go to x: (pick random ((0) - (shake)) to (shake)) y: (pick random ((0) - (shake)) to (shake))\n    change [shake v] by (-1)\n    change size by (-1)\n    if <(win) = [1]> then\n        switch costume to (yay you win v)\n    else\n        switch costume to (costume1 v)\n    end\nend\ngo to x: (0) y: (0)\n\nwhen flag clicked\nforever\n    go to [front v] layer\n    set [ghost v] effect to (100)\n    reset timer\nend\n\nset [collected v] to [50]\n\n