Cloud Platformer Collaboration
@Stage\n\nwhen flag clicked\nset [music v] to [1]\nforever\n    if <(Music) = [0]> then\n        set [current song v] to (Music)\n        stop all sounds\n    end\n    if <(Music) = [1]> then\n        set [current song v] to (Music)\n        play sound [As it goes; On and On v] until done\n    end\n    if <(Music) = [2]> then\n        set [current song v] to (Music)\n        play sound [Burned v] until done\n    end\n    if <(Music) = [3]> then\n        set [current song v] to (Music)\n        play sound [Happy Bass v] until done\n    end\n    if <(Music) = [4]> then\n        set [current song v] to (Music)\n        play sound [Pressure v] until done\n    end\n    if <(Music) = [5]> then\n        set [current song v] to (Music)\n        play sound [Thright Thrash - Skitzoid v] until done\n    end\n    if <(Music) = [6]> then\n        set [current song v] to (Music)\n        play sound [The Discovery v] until done\n    end\n    if <(Music) = [7]> then\n        set [current song v] to (Music)\n        play sound [Give and Take and Leave a Wake - Skitzoid v] until done\n    end\n    if <(Music) = [8]> then\n        set [current song v] to (Music)\n        play sound [Anthematic - Skitzoid v] until done\n    end\n    if <(Music) = [9]> then\n        set [current song v] to (Music)\n        play sound [Knight Blade v] until done\n    end\n    if <(Music) = [10]> then\n        set [current song v] to (Music)\n        play sound [Ambient Title v] until done\n    end\nend\n\nwhen flag clicked\nforever\n    if <(loading) = [0]> then\n        set volume to (100) %\n    else\n        set volume to (20) %\n    end\n    if <not <(current song) = (Music)>> then\n        stop all sounds\n    end\nend\n\n@Tile\n\nwhen [space v] key pressed\nif <<(Editor?) = [1]> and <(waiting) = [0]>> then\n    next costume\nend\n\ndefine None\nerase all\nset [loading v] to [1]\nset [waiting v] to [1]\nset [reload # v] to [1]\ngo to x: (-240) y: (162)\nrepeat (20)\n    set x to (-240)\n    repeat (21)\n        switch costume to (error v)\n        switch costume to (join (letter (reload #) of (item (level) of [maps v])) (letter ((reload #) + (1)) of (item (level) of [maps v])))\n        stamp\n        change x by (18)\n        change [reload # v] by (2)\n    end\n    change y by (-18)\nend\nset [waiting v] to [0]\nset [loading v] to [0]\n\nwhen [e v] key pressed\nif <<(username) = [skitzoid]> or <(moderator) = [1]>> then\n    if <(Editor?) = [1]> then\n        set [editor? v] to [0]\n    else\n        set [editor? v] to [1]\n    end\nend\n\ndefine None\nset [after# v] to (((letter#) * (2)) - (1))\nset [reader# v] to [1]\nset [save v] to (item (map) of [maps v])\nset [aquire v] to []\nrepeat (((after#) - (1)) / (2))\n    set [aquire v] to (join (aquire) (join (letter (reader#) of (save)) (letter ((reader#) + (1)) of (save))))\n    change [reader# v] by (2)\nend\nset [aquire v] to (join (aquire) (newitem))\nset [reader# v] to ((after#) + (2))\nrepeat ((420) - (letter#))\n    set [aquire v] to (join (aquire) (join (letter (reader#) of (save)) (letter ((reader#) + (1)) of (save))))\n    change [reader# v] by (2)\nend\nreplace item (map) of [maps v] with (aquire)\n\nwhen I receive [next level v]\nif <(Level) > (Total levels)> then\n    if <(moderator) = [0]> then\n        broadcast (moderator obtained v)\n        stop [this script v]\n    end\nend\nLoad level (Level)\nwait until <(waiting) = [0]>\nbroadcast (start v) and wait\n\nwhen I receive [load v]\nLoad level (Level)\n\nwhen flag clicked\nerase all\nset [loading v] to [1]\nset [mylevel v] to []\nset [my tiles v] to []\nset [moderator v] to [0]\nset [on right v] to [0]\nset [level v] to [1]\nset [completed? v] to [0]\nset [submitted? v] to [0]\nset [editor? v] to [0]\nhide variable [music v]\nshow variable [music v]\nbroadcast (download v) and wait\nbroadcast (Load v)\nbroadcast (start v)\n\nset [start v] to []\nrepeat (21)\n    set [start v] to (join (start) [01])\nend\nset [start v] to (join (start) [01])\nset [start v] to (join (start) [12])\nrepeat (18)\n    set [start v] to (join (start) [05])\nend\nset [start v] to (join (start) [01])\nrepeat (17)\n    set [start v] to (join (start) [01])\n    repeat (19)\n        set [start v] to (join (start) [05])\n    end\n    set [start v] to (join (start) [01])\nend\nrepeat (21)\n    set [start v] to (join (start) [01])\nend\n\nwhen I receive [start v]\nforever\n    if <(waiting) = [0]> then\n        if <(Editor?) = [1]> then\n            set [on right v] to [0]\n            show\n            go to x: (((round ((mouse x) / (18))) * (18)) + (-6)) y: (((round ((mouse y) / (18))) * (18)) + (0))\n            set [tiley v] to ((-1) * ((round ((mouse y) / (18))) - (9)))\n            set [tilex v] to ((round ((mouse x) / (18))) + (14))\n            set [preadd v] to (((tiley) * (21)) + (tilex))\n            if <mouse down?> then\n                if <<(x position) < [121]> and <<(x position) > [-241]> and <<(y position) < [163]> and <(y position) > [-181]>>>> then\n                    set [completed? v] to [0]\n                    if <(length of (costume [number v])) < [2]> then\n                        replace map (Level) letter (preAdd) with (join [0] (costume [number v]))\n                        stamp\n                    else\n                        replace map (Level) letter (preAdd) with (costume [number v])\n                        stamp\n                    end\n                end\n            end\n        else\n            hide\n        end\n    end\n    if <(moderator) = [1]> then\n        show variable [completed? v]\n        show variable [editor? v]\n    else\n        hide variable [completed? v]\n        hide variable [editor? v]\n    end\nend\n\nwhen I receive [moderator obtained v]\nadd (start) to [maps v]\nset [moderator v] to [1]\nchange [total levels v] by (1)\nset [completed? v] to [0]\nset [mylevel v] to (Total levels)\nbroadcast (Next level v)\n\nwhen [left arrow v] key pressed\nif <<(Editor?) = [1]> and <(waiting) = [0]>> then\n    switch costume to ((costume [number v]) - (1))\nend\n\nwhen [right arrow v] key pressed\nif <<(Editor?) = [1]> and <(waiting) = [0]>> then\n    next costume\nend\n\n@Player\n\ndefine ResenseX\nif <(Xv) > [0]> then\n    repeat until <touching color (#000000)?>\n        change x by (1)\n    end\n    change x by (-1)\nelse\n    if <[0] > (Xv)> then\n        repeat until <touching color (#000000)?>\n            change x by (-1)\n        end\n        change x by (1)\n    end\nend\n\ndefine ResenseY\nif <(Yv) > [0]> then\n    repeat until <not <touching color (#000000)?>>\n        change y by (-1)\n    end\nelse\n    if <[0] > (Yv)> then\n        repeat until <not <touching color (#000000)?>>\n            change y by (1)\n        end\n    end\nend\n\ndefine Next level\nif <(on right) = [1]> then\n    set [completed? v] to [1]\nend\nhide\nset [yv v] to [0]\nset [xv v] to [0]\nif <(moderator) = [0]> then\n    change [level v] by (1)\nend\nif <(moderator) = [1]> then\n    findstart\n    set [on right v] to [1]\nelse\nend\nbroadcast (Next level v)\n\nwhen I receive [start v]\nshow\nset [vertical offset v] to [1]\nset [yv v] to [0]\nset [xv v] to [0]\nset [savey v] to [0]\nset [savex v] to [0]\nfindstart\nwait until <(loading) = [0]>\nset [spawnx v] to (x position)\nset [spawny v] to (y position)\nchange y by (Vertical offset)\nforever\n    change y by ((-1) * (Vertical offset))\n    if <<(Editor?) = [0]> and <(loading) = [0]>> then\n        set [savey v] to (y position)\n        set [savex v] to (x position)\n        go to x: (SaveX) y: (SaveY)\n        go to [front v] layer\n        if <(waiting) = [0]> then\n            if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n                point in direction (90)\n                change [xv v] by (0.8)\n            end\n            if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n                point in direction (-90)\n                change [xv v] by (-0.8)\n            end\n        end\n        change y by (1)\n        set [xv v] to ((Xv) * (0.9))\n        if <(waiting) = [0]> then\n            if <not <touching color (#000000)?>> then\n                change x by (Xv)\n            end\n        end\n        if <touching color (#000000)?> then\n            change y by (1)\n            if <touching color (#000000)?> then\n                change y by (1)\n                if <touching color (#000000)?> then\n                    change y by (1)\n                    if <touching color (#000000)?> then\n                        change y by (1)\n                        if <touching color (#000000)?> then\n                            change y by (1)\n                            if <touching color (#000000)?> then\n                                change y by (1)\n                                if <touching color (#000000)?> then\n                                    change y by (1)\n                                    if <touching color (#000000)?> then\n                                        change y by (1)\n                                        if <touching color (#000000)?> then\n                                            change y by (1)\n                                            if <touching color (#000000)?> then\n                                                change y by (1)\n                                                if <touching color (#000000)?> then\n                                                    change x by ((-1) * (Xv))\n                                                    ResenseX\n                                                    change y by (-10)\n                                                    if <(waiting) = [0]> then\n                                                        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <not <touching (_edge_ v)?>>> then\n                                                            if <(Xv) > [0]> then\n                                                                set [xv v] to [-7]\n                                                            else\n                                                                set [xv v] to [7]\n                                                            end\n                                                            set [yv v] to [10]\n                                                        else\n                                                            set [xv v] to [0]\n                                                        end\n                                                    end\n                                                end\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        if <not <(SavePos) = [0]>> then\n            set [waiting v] to [1]\n        end\n        if <(waiting) = [0]> then\n            change [yv v] by (-1)\n        end\n        change y by (Yv)\n        if <touching color (#000000)?> then\n            ResenseY\n            set [yv v] to [0]\n        end\n        change y by (-1)\n        if <touching color (#000000)?> then\n            if <(waiting) = [0]> then\n                if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                    set [yv v] to [10]\n                end\n            end\n        end\n        if <touching color (#00ff55)?> then\n            Next level\n        end\n        if <<<key (r v) pressed?> or <touching color (#d54211)?>> or <touching (_edge_ v)?>> then\n            respawn\n        end\n        if <touching color (#ffff00)?> then\n            set [yv v] to [15]\n        end\n        if <touching color (#003fff)?> then\n            set [yv v] to [-15]\n        end\n        if <touching color (#7f00ff)?> then\n            set [xv v] to [-15]\n        end\n        if <touching color (#00ffff)?> then\n            set [xv v] to [15]\n        end\n    end\n    change y by (Vertical offset)\nend\n\ndefine findstart\nset [loading v] to [1]\nset [waiting v] to [1]\ngo to x: (-232) y: (171)\nrepeat (20)\n    set x to (-232)\n    repeat (21)\n        show\n        if <touching color (#009999)?> then\n            set [loading v] to [0]\n            set [waiting v] to [0]\n            set [spawnx v] to (x position)\n            set [spawny v] to (y position)\n            stop [this script v]\n        end\n        change x by (18)\n        hide\n    end\n    change y by (-18)\nend\nshow\nsay [LOAD ERROR: COULD NOT FIND START]\nstop [other scripts in sprite v]\n\ndefine respawn\nset [yv v] to [0]\nset [xv v] to [0]\nif <(moderator) = [1]> then\n    findstart\n    set [on right v] to [1]\n    go to x: (spawnx) y: (spawny)\nelse\n    go to x: (spawnx) y: (spawny)\nend\n\nwhen flag clicked\nreset timer\n\nwhen [n v] key pressed\nif <(username) = [skitzoid]> then\n    Next level\nend\n\n@Load screen\n\nwhen flag clicked\ngo to x: (175) y: (30)\nset size to (800) %\nset [ghost v] effect to (20)\nforever\n    next costume\n    if <(loading) = [1]> then\n        show\n    else\n        hide\n    end\nend\n\n@save button\n\nwhen I receive [start v]\nhide\ngo to x: (185) y: (-11)\nif <(username) = [skitzoid]> then\n    show\nelse\n    hide\nend\nforever\n    if <(submitted?) = [0]> then\n        if <not <(username) = [skitzoid]>> then\n            if <(mouse x) < [137]> then\n                if <(completed?) = [1]> then\n                    if <(submitted?) = [0]> then\n                        show\n                    end\n                else\n                    hide\n                end\n            else\n            end\n        else\n            if <(submitted?) = [0]> then\n                show\n            else\n                hide\n            end\n        end\n    else\n        hide\n    end\nend\n\nwhen this sprite clicked\nhide\nif <<(username) = [skitzoid]> or <(moderator) = [1]>> then\n    if <(moderator) = [1]> then\n        if <(completed?) = [1]> then\n            if <(submitted?) = [0]> then\n                hide\n                set [my tiles v] to (item (mylevel) of [maps v])\n                set [submitted? v] to [1]\n                broadcast (update v) and wait\n                wait until <(submitted?) = [0]>\n            end\n        end\n    else\n        if <(username) = [skitzoid]> then\n            set [submitted? v] to [1]\n            hide\n            broadcast (update v) and wait\n            wait until <(submitted?) = [0]>\n        end\n    end\nelse\n    hide\nend\n\nwhen I receive [submitted v]\nset [submitted? v] to [1]\nhide\nstop [other scripts in sprite v]\n\n@load button\n\nwhen I receive [start v]\ngo to x: (185) y: (-50)\nshow\n\nwhen this sprite clicked\nhide\nif <(moderator) = [1]> then\n    broadcast (download v) and wait\n    if <(submitted?) = [1]> then\n        if <not <(mylevel) = (Total levels)>> then\n            set [moderator v] to [0]\n        end\n    end\nelse\n    broadcast (download v) and wait\nend\n\nwhen I receive [moderator obtained v]\nsay [Moderator status obtained. you can now edit this level and save it] for (5) seconds\n\n@Thumbnail\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\ngo to [front v] layer\nset [ghost v] effect to (100)\n\n@Infinite Cloud Engine\n\ndefine None\nset [ice.i v] to [0]\ndelete (all) of [infinitelist v]\nrepeat (length of (☁ Encoded))\n    change [ice.i v] by (1)\n    insert (letter (ICE.i) of (☁ Encoded)) at (last) of [infinitelist v] \nend\nset [ice.i v] to [0]\nrepeat (length of (data))\n    change [ice.i v] by (1)\n    insert (letter (ICE.i) of (data)) at (last) of [infinitelist v] \nend\nset [☁ encoded v] to (InfiniteList)\n\nwhen I receive [update v]\nshow\nset [submitted? v] to [1]\nset [updated? v] to [0]\nUpdate Cloud\nwait until <(updated?) = [1]>\nrepeat until <((length of (☁ Encoded)) / (840)) = (Total levels)>\n    set [updated? v] to [0]\n    Update Cloud\n    wait until <(updated?) = [1]>\nend\nhide\nif <(username) = [skitzoid]> then\n    set [submitted? v] to [0]\nend\n\nwhen I receive [download v]\nshow\nUpdate Local\nset [total levels v] to (length of [maps v])\nhide\n\nwhen I receive [special request v]\nshow\nset [waiting v] to [1]\nUpdate Local\nwait until <(waiting) = [0]>\nset [waiting v] to [1]\nadd (my tiles) to [maps v]\nset [total levels v] to (length of [maps v])\nset [updated? v] to [0]\nUpdate Cloud\nset [waiting v] to [1]\nwait until <(updated?) = [1]>\nset [waiting v] to [1]\nrepeat until <((length of (☁ Encoded)) / (840)) = (Total levels)>\n    set [updated? v] to [0]\n    Update Cloud\n    set [waiting v] to [1]\n    wait until <(updated?) = [1]>\n    set [waiting v] to [1]\nend\nwait until <(loading) = [0]>\nhide\nbroadcast (submitted v)\n\ndefine Update Cloud\nset [loading v] to [1]\nset [waiting v] to [1]\nDelete All of cloud\nset [## v] to [0]\nset [☁ encoded v] to []\nset [## v] to [0]\nset [## v] to [0]\ndelete (all) of [infinitelist v]\nrepeat (length of [maps v])\n    change [## v] by (1)\n    set [### v] to [0]\n    repeat (840)\n        change [### v] by (1)\n        add (letter (###) of (item (##) of [maps v])) to [infinitelist v]\n    end\nend\nset [test v] to (InfiniteList)\nrepeat until <(InfiniteList) = (☁ Encoded)>\n    set [## v] to [0]\n    delete (all) of [infinitelist v]\n    repeat (length of [maps v])\n        change [## v] by (1)\n        set [### v] to [0]\n        repeat (840)\n            change [### v] by (1)\n            add (letter (###) of (item (##) of [maps v])) to [infinitelist v]\n        end\n    end\n    set [test v] to (InfiniteList)\n    set [☁ encoded v] to (test)\nend\nrepeat until <(mr) = (InfiniteList)>\n    set [mr v] to (InfiniteList)\nend\nrepeat until <(☁ Encoded) = (InfiniteList)>\n    set [☁ encoded v] to (InfiniteList)\n    if <not <(☁ Encoded) = (InfiniteList)>> then\n        set [☁ encoded v] to (mr)\n    end\nend\nset [loading v] to [0]\nset [waiting v] to [0]\nset [updated? v] to [1]\n\ndefine Condense\nset [## v] to ((counter#) * (840))\nset [to add v] to []\nrepeat (840)\n    change [## v] by (1)\n    set [to add v] to (join (to add) (letter (##) of (☁ Encoded)))\nend\n\ndefine Cloud encode []\nset [endoced? v] to [0]\nset [ice.i v] to [1]\nrepeat (length of (data))\n    add (letter (ICE.i) of (data)) to [infinitelist v]\n    change [ice.i v] by (1)\nend\nrepeat until <(☁ Encoded) = (InfiniteList)>\n    set [☁ encoded v] to (InfiniteList)\nend\nset [endoced? v] to [1]\n\ndefine Delete All of cloud\nset [☁ encoded v] to []\ndelete (all) of [infinitelist v]\n\ndefine Update Local\nset [waiting v] to [1]\ndelete (all) of [maps v]\nset [counter# v] to [0]\nrepeat ((length of (☁ Encoded)) / (840))\n    Condense\n    add (to add) to [maps v]\n    change [counter# v] by (1)\nend\nset [total levels v] to (length of [maps v])\nset [waiting v] to [0]\n\nrepeat until <(InfiniteList) = (Maps)>\n    set [## v] to [0]\n    delete (all) of [infinitelist v]\n    repeat (length of [maps v])\n        change [## v] by (1)\n        set [endoced? v] to [0]\n        Cloud encode (item (##) of [maps v])\n        wait until <(endoced?) = [1]>\n    end\nend\n\nset [## v] to [0]\ndelete (all) of [infinitelist v]\nrepeat (length of [maps v])\n    change [## v] by (1)\n    set [endoced? v] to [0]\n    Cloud encode (item (##) of [maps v])\n    wait until <(endoced?) = [1]>\nend\n\nset [☁ backup v] to (☁ Encoded)\n\nset [☁ encoded v] to (☁ Backup)\n\nwhen [i v] key pressed\nshow\nsay (join (join [Local=] ((InfiniteList) / (840))) (join (join [Cloud=] ((length of (☁ Encoded)) / (840))) (join [Backup=] ((length of (☁ Backup)) / (840))))) for (6) seconds\nhide\n\n