TEST - MMO Platformer v0.7


@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop2 v)\n\nwhen I receive [test v]\nswitch backdrop to (artboard 1 copy@2x v)\n\nwhen I receive [message - show v]\nswitch backdrop to (reload v)\n\n@Blank\n\n@Game\n\ndefine fix player\nset [t v] to [1]\nrepeat (8)\n    change [@player x v] by (item (t) of [fix v])\n    change [t v] by (1)\n    change [@player y v] by (item (t) of [fix v])\n    change [t v] by (1)\n    Check Collide\n    if <(touch) = [0]> then\n        stop [this script v]\n    end\nend\nchange [@player x v] by (item (t) of [fix v])\nchange [t v] by (1)\nchange [@player y v] by (item (t) of [fix v])\nset [t v] to [1]\nrepeat (8)\n    change [@player x v] by ((item (t) of [fix v]) * (2))\n    change [t v] by (1)\n    change [@player y v] by ((item (t) of [fix v]) * (2))\n    change [t v] by (1)\n    Check Collide\n    if <(touch) = [0]> then\n        stop [this script v]\n    end\nend\nchange [@player x v] by ((item (t) of [fix v]) * (2))\nchange [t v] by (1)\nchange [@player y v] by (((item (t) of [fix v]) * (2)) - (1))\n\ndefine Move Out Of Collision dir x,y: (dx) (dy) limit: (limit)\nset [lim v] to [1]\nrepeat until <<(lim) > (limit)> or <(touch) < [100]>>\n    change [@player x v] by (dx)\n    change [@player y v] by (dy)\n    change [lim v] by (1)\n    Check Collide\nend\nif <(lim) > (limit)> then\n    change [@player x v] by ((0) - ((dx) * (limit)))\n    change [@player y v] by ((0) - ((dy) * (limit)))\n    if <<(@Player SX) = [0]> or <not <(dx) = [0]>>> then\n        set [@player die v] to [1]\n    else\n        Check Collide\n        if <(@Player SX) > []> then\n            if <(@Player SX) > [0.01]> then\n                Move Out Of Collision dir x,y: (-1) (0) limit: (24)\n            else\n                if <(@Player SX) < [-0.01]> then\n                    Move Out Of Collision dir x,y: (1) (0) limit: (24)\n                end\n            end\n        end\n        set [@player sx v] to [0]\n    end\n    set [lim v] to [999]\nend\n\ndefine Check Collide\ngo to x: (round ((@Player X) - (@Scroll X))) y: (round ((@Player Y) - (@Scroll Y)))\nif <touching (level v)?> then\n    set [touch v] to [101]\nelse\n    if <touching (moving platform v)?> then\n        set [touch v] to [102]\n    else\n        set [touch v] to [0]\n    end\nend\n\ndefine Scroll Level\nchange [@scroll x v] by (round (((@Player X) - (@Scroll X)) * (0.1)))\nif <(@Scroll X) < [0]> then\n    set [@scroll x v] to [0]\nend\nchange [@scroll y v] by (round (((@Player Y) - (@Scroll Y)) * (0.1)))\nif <(@Scroll Y) < [0]> then\n    set [@scroll y v] to [0]\nend\n\ndefine Player Tick\nif <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <key (space v) pressed?>>> then\n    change [jump key v] by (1)\nelse\n    set [jump key v] to [0]\nend\nset [pushed sx v] to [0]\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    set [key left right v] to [1]\nelse\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        set [key left right v] to [-1]\n    else\n        set [key left right v] to [0]\n    end\nend\nPlayer Tick - Fix Up\nPlayer Tick - Crouch / Jump Key\nPlayer Tick - Up / Down\nPlayer Tick - Left / Right\n\ndefine Reset Player\nset [@player x v] to (@Spawn X)\nset [@player y v] to (@Spawn Y)\nset [@scroll x v] to (@Player X)\nset [@scroll y v] to (@Player Y)\nset [@player sx v] to [0]\nset [@player sy v] to [0]\nset [@falling v] to [0]\nset [@walking v] to [-1]\nset [@player die v] to [0]\nset [@player mode v] to [0]\nset [onground v] to [100]\nScroll Level\n\nwhen flag clicked\nset [debug v] to [0]\ndelete all of [emoji spawn v]\nif <<(username) = [griffpatch_tutor]> or <(username) = [griffpatch]>> then\n    set [reload v] to [26]\n    set [☁ online v] to (reload)\nelse\n    if <not <(reload) = (☁ ONLINE)>> then\n        broadcast (Message - Show v) and wait\n    end\nend\nbroadcast (Green Flag v) and wait\nbroadcast (Cloud - Setup v) and wait\nset [frame v] to [0]\nset [fps time v] to [1]\nset [ghost v] effect to (100)\nset [@level v] to [1]\nset [@totalflags v] to [0]\nset [@timer v] to [0]\nset [@player dir v] to [90]\nset [@spawn x v] to [-180]\nset [@spawn y v] to [32]\nset [clock v] to [0]\nReset Player\nbroadcast (setup level v) and wait\nbroadcast (game loop tick v) and wait\ngo to [front v] layer\nbroadcast (pre game loop v)\nrepeat until <not <(reload) = (☁ ONLINE)>>\n    broadcast (Player - pre-move v)\n    broadcast (Player - Begin Frame v)\n    broadcast (game loop tick v)\n    broadcast (Cloud - tick v)\n    broadcast (Players - Tick v)\nend\nbroadcast (Message - Show v) and wait\n\nwhen I receive [player - pre-move v]\nset [active players v] to [1]\nset [@platform sx v] to []\nset [@platform sy v] to []\nchange [@timer v] by (1)\nif <<not <(@Player X) = [-180]>> and <(FLAG COUNT) > [0]>> then\n    change [clock v] by (1)\nend\nShow Time (clock)\nchange [mouse inactive v] by (1)\nif <not <<(mouse x) = (mouse x)> and <(mouse y) = (mouse y)>>> then\n    set [mouse x v] to (mouse x)\n    set [mouse y v] to (mouse y)\n    set [mouse inactive v] to [0]\nend\n\nwhen I receive [player - begin frame v]\nswitch costume to (hitbox v)\nif <(@Player Die) = [0]> then\n    Player Tick\n    if <(@Player Y) < [-200]> then\n        set [@player die v] to [25]\n    end\nelse\n    change [@player die v] by (1)\n    if <(@Player Die) > [60]> then\n        Reset Player\n    end\nend\nif <<key (q v) pressed?> and <key (r v) pressed?>> then\n    set [@spawn x v] to [-180]\n    set [@spawn y v] to [32]\n    set [clock v] to [0]\n    Reset Player\n    broadcast (Reset v)\nend\nif <(@crouching) = [2]> then\n    Check Slide []\nelse\n    Slope Detect\nend\nScroll Level\n\ndefine Show Time (frame)\nset [t v] to ([floor v] of (((frame) / (30)) * (10)) )\nset [time v] to ((t) mod (10))\nset [t v] to ([floor v] of ((t) / (10)) )\nset [time v] to (join [.] (TIME))\nset [time v] to (join ((t) mod (10)) (TIME))\nset [t v] to ([floor v] of ((t) / (10)) )\nset [time v] to (join ((t) mod (6)) (TIME))\nset [t v] to ([floor v] of ((t) / (6)) )\nset [time v] to (join ['] (TIME))\nset [time v] to (join ((t) mod (10)) (TIME))\nset [t v] to ([floor v] of ((t) / (10)) )\nset [time v] to (join ((t) mod (10)) (TIME))\nif <(t) = [0]> then\n    stop [this script v]\nend\nset [time v] to (join [:] (TIME))\nset [time v] to (join ((t) mod (10)) (TIME))\nset [t v] to ([floor v] of ((t) / (10)) )\nset [time v] to (join ((t) mod (10)) (TIME))\n\ndefine Slope Detect\ngo to x: (round ((@Player X) - (@Scroll X))) y: (round ((@Player Y) - (@Scroll Y)))\nif <<(@Falling) > [1]> or <(@walking) > [-1]>> then\n    set [@slope v] to [0]\nelse\n    switch costume to (slope0 v)\n    if <not <<touching (level v)?> or <touching (moving platform v)?>>> then\n        set [@slope v] to [0]\n    else\n        switch costume to (slope-4 v)\n        if <not <<touching (level v)?> or <touching (moving platform v)?>>> then\n            set [@slope v] to [-4]\n        else\n            switch costume to (slope4 v)\n            if <not <<touching (level v)?> or <touching (moving platform v)?>>> then\n                set [@slope v] to [4]\n            else\n                switch costume to (slope-3 v)\n                if <not <<touching (level v)?> or <touching (moving platform v)?>>> then\n                    set [@slope v] to [-3]\n                else\n                    switch costume to (slope3 v)\n                    if <not <<touching (level v)?> or <touching (moving platform v)?>>> then\n                        set [@slope v] to [3]\n                    else\n                        switch costume to (slope-2 v)\n                        if <not <<touching (level v)?> or <touching (moving platform v)?>>> then\n                            set [@slope v] to [-2]\n                        else\n                            switch costume to (slope2 v)\n                            if <not <<touching (level v)?> or <touching (moving platform v)?>>> then\n                                set [@slope v] to [2]\n                            else\n                                switch costume to (slope-1 v)\n                                if <not <<touching (level v)?> or <touching (moving platform v)?>>> then\n                                    set [@slope v] to [-1]\n                                else\n                                    switch costume to (slope1 v)\n                                    if <not <<touching (level v)?> or <touching (moving platform v)?>>> then\n                                        set [@slope v] to [1]\n                                    else\n                                        set [@slope v] to [0]\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nswitch costume to (hitbox v)\n\ndefine Player Tick - Fix Up\nif <(on platform) = []> then\n    Check Collide\n    if <(touch) = [102]> then\n        set [pushed sx v] to (@Player X)\n        change [@player x v] by (@Platform SX)\n        Check Collide\n        if <(touch) > [100]> then\n            if <(touch) = [102]> then\n                fix player\n            else\n                Move Out Of Collision dir x,y: (0) (1) limit: (([abs v] of (@Platform SX) ) + (2))\n                if <(@Player Die) > [0]> then\n                    set [pushed sx v] to [0]\n                    stop [this script v]\n                end\n                set [@player sy v] to [0]\n                set [@falling v] to [0]\n            end\n        end\n        set [pushed sx v] to ((@Player X) - (pushed sx))\n        set [@platform sx v] to [0]\n    end\nend\n\ndefine Player Tick - Crouch / Jump Key\nset [t v] to <<key (down arrow v) pressed?> or <<key (s v) pressed?> or <key (z v) pressed?>>>\nif <<(t) = [true]> and <<(@Falling) < [3]> or <(@crouching) > [1]>>> then\n    set [@on wall v] to [0]\n    Check Slide ((@Player SX) / ([abs v] of (@Player SX) ))\n    if <<not <(key left right) = [0]>> and <([abs v] of (@Player SX) ) > [2]>> then\n        if <([abs v] of (@Slope) ) > [1]> then\n            if <<(@Slope) < [0]> = <(@Player SX) < [0]>> then\n                set [@crouching v] to [2]\n            end\n        end\n    end\n    if <(@crouching) < [2]> then\n        if <([abs v] of (@Slope) ) < [2]> then\n            set [@crouching v] to [1]\n        else\n            if <(@crouching) > [0]> then\n                set [@crouching v] to [-3]\n            end\n            if <(@crouching) < [0]> then\n                change [@crouching v] by (1)\n            end\n        end\n    end\nelse\n    if <(@crouching) > [0]> then\n        set [@crouching v] to [-3]\n    end\n    if <(@crouching) < [0]> then\n        change [@crouching v] by (1)\n    end\n    if <<(t) = [true]> and <(@On Wall) > [0]>> then\n        set [@on wall v] to [0]\n    end\nend\nif <<(JUMP KEY) > [0]> and <(@Falling) < [3]>> then\n    set [@falling v] to [3]\n    set [onground v] to [0]\n    if <<not <(@crouching) = [0]>> and <(JUMP KEY) < [2]>> then\n        if <<not <(key left right) = [0]>> and <([abs v] of (@Player SX) ) > [1]>> then\n            accelerate ((7) * ((@Player SX) / ([abs v] of (@Player SX) ))) percent [1]\n            set [@player sy v] to [10]\n            set [@player mode v] to [long jump]\n        else\n            set [@player sy v] to [17]\n            set [@player mode v] to [High jump]\n        end\n    else\n        set [@player sy v] to [14]\n        set [@player mode v] to [jump]\n    end\nelse\n    if <(@On Wall) > [0]> then\n        if <(JUMP KEY) = [1]> then\n            Wall Kick / Jump\n        else\n            if <<(JUMP KEY) > [0]> and <((key left right) * (-90)) = (@Player Dir)>> then\n                Wall Kick / Jump\n            end\n        end\n    end\nend\n\ndefine Player Tick - Up / Down\nif <(@Player SY) > [-16]> then\n    if <<(@Player Mode) = [long jump]> and <(@Player SY) > [-10]>> then\n        change [@player sy v] by (-0.6)\n    else\n        if <<(@On Wall) > [0]> and <(@Player SY) < [1]>> then\n            change [@player sy v] by (((-5) - (@Player SY)) * (0.1))\n        else\n            change [@player sy v] by (-1.2)\n        end\n    end\nend\nif <<(@Player SY) < [-8]> and <<key (space v) pressed?> and <(FLAG COUNT) < [1]>>> then\n    set [@player mode v] to [Parachute]\nend\nif <(@Player Mode) = [Parachute]> then\n    set [@player sy v] to ((@Player SY) * (0.6))\n    if <not <key (space v) pressed?>> then\n        set [@player mode v] to []\n    end\nend\nchange [@player y v] by (@Player SY)\nif <not <(on platform) = []>> then\n    change [@player y v] by (-5)\n    Check Collide\n    if <not <(touch) = [102]>> then\n        change [@player y v] by (5)\n    end\nend\nset [on platform v] to [0]\nCheck Collide\nif <(touch) = [102]> then\n    set [on platform v] to (@Platform SX)\nelse\n    set [on platform v] to []\nend\nchange [onground v] by (1)\nif <(onGround) > [4]> then\n    set [@player mode v] to []\nend\nif <(touch) > [100]> then\n    if <<(@Player Mode) = [Long Jump]> or <(@Player Mode) = [Wall Jump]>> then\n        set [@player mode v] to []\n    end\n    if <(@Player SY) > [0]> then\n        Move Out Of Collision dir x,y: (0) (-1) limit: (22)\n        if <(@Player Die) > [0]> then\n            set [@player die v] to [0]\n            Move Out Of Collision dir x,y: (0) (1) limit: (22)\n            set [@player sy v] to ((@Player SY) / (2))\n            set [@falling v] to [0]\n        else\n            set [@falling v] to [3]\n            set [@player sy v] to [0]\n        end\n        set [onground v] to [0]\n    else\n        if <(@Player Mode) = [Parachute]> then\n            set [@player mode v] to []\n        end\n        Move Out Of Collision dir x,y: (0) (1) limit: (22)\n        if <(@Player Die) > [0]> then\n            set [@player die v] to [0]\n            Move Out Of Collision dir x,y: (0) (-1) limit: (22)\n            set [@falling v] to [3]\n            set [@player sy v] to ((@Platform SY) - (2))\n        else\n            set [@player sy v] to ((@Player SY) / (2))\n            set [@falling v] to [0]\n        end\n    end\nelse\n    set [onground v] to [0]\n    change [@falling v] by (1)\nend\n\ndefine Player Tick - Left / Right\nif <<<(@Player Mode) = [long jump]> or <(@Player Mode) = [Wall jump]>> and <(@Player SY) > [5]>> then\nchange [@player x v] by (@Player SX)\nCheck Collide\nif <(touch) > [100]> then\n    if <<(@Player Mode) = [Long Jump]> or <(@Player Mode) = [Wall Jump]>> then\n        set [@player mode v] to []\n    end\n    Move Out Of Collision dir x,y: (0) (1) limit: (round ((([abs v] of (@Player SX) ) * (2)) + (2)))\n    if <<(lim) > [2]> and <(lim) < [999]>> then\n        set [@player sx v] to ((@Player SX) * (0.6))\n        Check Still On Wall\n    else\n        if <<(@Falling) > [2]> and <(@Player SY) < [6]>> then\n            if <not <(@Player Mode) = [Parachute]>> then\n                change [@on wall v] by (1)\n                set [@player mode v] to []\n            end\n        else\n            set [@on wall v] to [0]\n        end\n    end\nelse\n    Check Still On Wall\nend\nif <not <(pushed sx) = [0]>> then\n    accelerate (pushed sx) percent [0.5]\nend\n\ndefine Check Still On Wall\nif <(@On Wall) = [0]> then\n    stop [this script v]\nend\nif <(@Falling) < [1]> then\n    set [@on wall v] to [0]\n    stop [this script v]\nend\nchange [@player x v] by ((@Player Dir) / (45))\nCheck Collide\nchange [@player x v] by ((@Player Dir) / (-45))\nif <(touch) = [0]> then\n    set [@on wall v] to [0]\n    stop [this script v]\nend\n\ndefine Wall Kick / Jump\nset [@falling v] to [3]\nset [onground v] to [0]\nset [@player dir v] to ((-1) * (@Player Dir))\nset [@player sx v] to ((7) * ((@Player Dir) / ([abs v] of (@Player Dir) )))\nset [@player sy v] to [14]\nset [@player mode v] to [wall jump]\nset [@crouching v] to [0]\nset [@on wall v] to [0]\n\ndefine Check Slide (dir1)\nswitch costume to (hitbox v)\nset [t v] to (@Player Y)\ngo to x: (round ((@Player X) - (@Scroll X))) y: (round ((@Player Y) - (@Scroll Y)))\nrepeat ((4) + ([abs v] of (@Player SX) ))\n    change [@player y v] by (-1)\n    change y by (-1)\n    if <<touching (level v)?> or <touching (moving platform v)?>> then\n        change y by (1)\n        change [@player y v] by (1)\n        switch costume to (slope0 v)\n        if <not <<touching (level v)?> or <touching (moving platform v)?>>> then\n            set [@slope v] to [0]\n            set [@crouching v] to [0]\n        else\n            switch costume to (slope-8 v)\n            if <not <<touching (level v)?> or <touching (moving platform v)?>>> then\n                set [@slope v] to [0]\n                set [@crouching v] to [0]\n            else\n                switch costume to (slope8 v)\n                if <not <<touching (level v)?> or <touching (moving platform v)?>>> then\n                    set [@slope v] to [0]\n                    set [@crouching v] to [0]\n                else\n                    switch costume to (slope-4 v)\n                    if <not <<touching (level v)?> or <touching (moving platform v)?>>> then\n                        set [@slope v] to [-4]\n                    else\n                        switch costume to (slope4 v)\n                        if <not <<touching (level v)?> or <touching (moving platform v)?>>> then\n                            set [@slope v] to [4]\n                        else\n                            switch costume to (slope-3 v)\n                            if <not <<touching (level v)?> or <touching (moving platform v)?>>> then\n                                set [@slope v] to [-3]\n                            else\n                                switch costume to (slope3 v)\n                                if <not <<touching (level v)?> or <touching (moving platform v)?>>> then\n                                    set [@slope v] to [3]\n                                else\n                                    switch costume to (slope-2 v)\n                                    if <not <<touching (level v)?> or <touching (moving platform v)?>>> then\n                                        set [@slope v] to [-2]\n                                    else\n                                        switch costume to (slope2 v)\n                                        if <not <<touching (level v)?> or <touching (moving platform v)?>>> then\n                                            set [@slope v] to [2]\n                                        else\n                                            switch costume to (slope-1 v)\n                                            if <not <<touching (level v)?> or <touching (moving platform v)?>>> then\n                                                set [@slope v] to [-1]\n                                            else\n                                                switch costume to (slope1 v)\n                                                if <not <<touching (level v)?> or <touching (moving platform v)?>>> then\n                                                    set [@slope v] to [1]\n                                                else\n                                                    set [@slope v] to [0]\n                                                    set [@crouching v] to [0]\n                                                    set [@player y v] to (t)\n                                                end\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        switch costume to (hitbox v)\n        if <not <(t) = (@Player Y)>> then\n            set [@falling v] to [0]\n        end\n        stop [this script v]\n    end\nend\nset [@slope v] to [0]\nset [@player y v] to (t)\n\nif <not <(@Slope) = [0]>> then\n    stop [this script v]\nend\n\ndefine accelerate (target) percent (friction)\nset [lim v] to (((target) - (@Player SX)) * (friction))\nif <<(@Falling) < [3]> or <(key left right) = [0]>> then\n    change [@player sx v] by (lim)\n    stop [this script v]\nend\nif <<(key left right) > [0]> = <(lim) > [0]>> then\n    change [@player sx v] by (lim)\n    stop [this script v]\nend\n\nchange [@player sx v] by (((((key left right) * (7)) + (on platform)) - (@Player SX)) * (0.02))\n\nchange [@player sx v] by (((10) - (@Player SX)) * (0.02))\n\nchange [@player sx v] by (((10) - (@Player SX)) * (0.1))\n\nchange [@player sx v] by (((10) - (@Player SX)) * (0.35))\n\n@Player\n\ndefine Set Costume (costume#)\nif <not <(costume#) = (costume [number v])>> then\n    switch costume to (costume#)\n    if <(costume#) = [14]> then\n        point in direction (90)\n        set rotation style [all around v]\n    else\n        set rotation style [left-right v]\n    end\nend\n\nwhen I receive [setup level v]\nset rotation style [left-right v]\ndelete all of [record v]\nshow\nwait (0.1) seconds\ngo to [front v] layer\n\nwhen I receive [game loop tick v]\ngo to x: (round ((@Player X) - (@Scroll X))) y: (round ((@Player Y) - (@Scroll Y)))\nif <(@Player Die) = [0]> then\n    if <(last Die) > [0]> then\n        set size to (100) %\n        set [ghost v] effect to (0)\n    end\n    if <<(@Player Mode) = [Long Jump]> or <(@Player Mode) = [Wall Jump]>> then\n        Set Costume (14)\n        turn right ((20) * ((@Player SX) / ([abs v] of (@Player SX) ))) degrees\n        change y by (12)\n    else\n        if <<(@Player Mode) = [High Jump]> and <(@Falling) > [2]>> then\n            if <(@Player SY) > [12]> then\n                Set Costume (2)\n            else\n                set [t v] to (item ((round (((12) - (@Player SY)) / (1.3))) + (1)) of [flip costumes v])\n                if <(t) > []> then\n                    Set Costume (t)\n                else\n                    Set Costume (4)\n                end\n            end\n        else\n            if <(@On Wall) > [0]> then\n                Set Costume (20)\n            else\n                if <(@Player Mode) = [Parachute]> then\n                    Set Costume (13)\n                else\n                    if <(@crouching) > [0]> then\n                        if <(@crouching) = [2]> then\n                            Set Costume (21)\n                        else\n                            Set Costume (8)\n                        end\n                    else\n                        if <(@Falling) > [2]> then\n                            if <(@Player SY) > [0]> then\n                                Set Costume (2)\n                            else\n                                if <(@Player SY) > [-2]> then\n                                    Set Costume (3)\n                                else\n                                    Set Costume (4)\n                                end\n                            end\n                        else\n                            if <(@walking) < [0]> then\n                                if <(@Slope) = [0]> then\n                                    Set Costume (1)\n                                else\n                                    if <(@Slope) < [0]> then\n                                        set [@player dir v] to [90]\n                                        Set Costume ((8) + ([abs v] of (@Slope) ))\n                                    else\n                                        set [@player dir v] to [-90]\n                                        Set Costume ((8) + ([abs v] of (@Slope) ))\n                                    end\n                                end\n                            else\n                                if <((@walking) mod (9)) < [3]> then\n                                    Set Costume (5)\n                                else\n                                    if <((@walking) mod (9)) < [6]> then\n                                        Set Costume (6)\n                                    else\n                                        Set Costume (7)\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        if <not <(@Player Dir) = (direction)>> then\n            point in direction (@Player Dir)\n        end\n    end\nelse\n    if <(@Player Die) < [25]> then\n        set size to ((size) + (10)) %\n        change [ghost v] effect by (4)\n        change [@player y v] by (-1)\n    else\n        change [ghost v] effect by (100)\n    end\n    set [last die v] to [1]\nend\nif <((@timer) mod (2)) = [0]> then\n    add (round (@Player X)) to [record v]\n    add (round (@Player Y)) to [record v]\n    if <(@Player Die) > [0]> then\n        add [0] to [record v]\n    else\n        if <(@Player Emoji) > [0]> then\n            add ((@Player Emoji) + (100)) to [record v]\n            set [@player emoji v] to []\n        else\n            if <(direction) < [0]> then\n                add ((0) - (costume [number v])) to [record v]\n            else\n                add (costume [number v]) to [record v]\n            end\n        end\n    end\nend\n\n@Cloud Players\n\nwhen I receive [players - tick v]\nif <(pid) > [0]> then\n    Player Tick (item (pid) of [player names v])\nend\n\ndefine Player Tick (name)\nif <not <(name) = (username)>> then\n    set [username v] to (name)\n    set [¬inactive v] to [0]\n    delete all of [parsenext v]\n    set [parsestr v] to []\n    set [lastframestart v] to []\n    if <(name) = []> then\n        hide\n    else\n        init\n    end\nend\nif <(name) = []> then\n    stop [this script v]\nend\nchange [active players v] by (1)\nif <(item (pid) of [pdata v]) > []> then\n    if <not <(skip) < [7]>> then\n        set [parsestr v] to []\n    end\n    set [skip v] to [0]\n    set [¬inactive v] to [0]\n    add (item (pid) of [pdata v]) to [parsenext v]\n    add (item (pid) of [pidx v]) to [parsenext v]\n    replace item (pid) of [pdata v] with []\n    if <(length of [parsenext v]) > [12]> then\n        repeat until <(length of [parsenext v]) < [7]>\n            delete (1) of [parsenext v]\n            delete (1) of [parsenext v]\n        end\n        if <((((¬frame) - (@timer)) + (0)) mod (SYNC FRAMES)) = [0]> then\n            skip forward (¬frame)\n        else\n            set [parsestr v] to []\n        end\n    end\n    if <(parseStr) = []> then\n        Catch up\n    end\nend\nif <(parseStr) > []> then\n    if <((((¬frame) - (@timer)) + (0)) mod (SYNC FRAMES)) = [0]> then\n        change [¬frame v] by (1)\n        if <(skip) < [7]> then\n            if <((¬frame) mod (2)) = [0]> then\n                Process Tick [2]\n            else\n                change [~x v] by (sx)\n                change [~y v] by (sy)\n            end\n        else\n            change [parseidx v] by (3)\n        end\n    end\nelse\n    change [¬inactive v] by (1)\n    if <(¬inactive) > [30]> then\n        replace item (pid) of [player names v] with []\n        hide\n        stop [this script v]\n    end\nend\nif <(costume) = [0]> then\n    set size to ((size) + (10)) %\n    change [ghost v] effect by (4)\n    position ((~x) - (@Scroll X)) ((~y) - (@Scroll Y))\nelse\n    Set Costume ([abs v] of (costume) )\n    set [ghost v] effect to (0)\n    if <(costume [number v]) = [14]> then\n        turn right ((20) * ((sx) / ([abs v] of (sx) ))) degrees\n        position ((~x) - (@Scroll X)) (((~y) - (@Scroll Y)) + (12))\n    else\n        if <<(costume) < [0]> = <(direction) > [0]>> then\n            point in direction ((0) - (direction))\n        end\n        position ((~x) - (@Scroll X)) ((~y) - (@Scroll Y))\n    end\nend\n\nwhen I start as a clone\nchange [clones v] by (1)\nset [pid v] to (CLONES)\nset [x v] to [0]\nset [y v] to [0]\nset [action v] to []\nset [team v] to []\nset [color v] to [0xff7000]\nset [immune v] to [0]\nset [costume v] to [1]\n\nwhen I receive [green flag v]\nset [color v] effect to (-110)\nhide\nset [show names v] to [2]\nset [pid v] to [0]\nset [clones v] to [0]\nset [username v] to (username)\nset [action v] to []\nset [team v] to []\nset [lastcmd v] to []\nset [immune v] to [0]\ninit\n\ndefine init\nset [¬frame v] to [0]\nset [skip v] to [0]\nif <<(username) = [griffpatch]> or <(username) = [griffpatch_tutor]>> then\n    set [color v] effect to (15)\nelse\n    set [color v] effect to (-110)\nend\n\ndefine Read Number\nset [?val v] to []\nrepeat (letter (parseIdx) of (parseStr))\n    change [parseidx v] by (1)\n    set [?val v] to (join (?Val) (letter (parseIdx) of (parseStr)))\nend\nif <(letter (1) of (?Val)) = [0]> then\n    set [?val v] to ((0) - (?Val))\nend\nchange [parseidx v] by (1)\n\ndefine Read Change\nset [?val v] to (join (letter (parseIdx) of (parseStr)) (letter ((parseIdx) + (1)) of (parseStr)))\nchange [parseidx v] by (2)\nif <(?Val) = [0]> then\n    Read Number\nelse\n    change [?val v] by (-50)\nend\n\ndefine position (x) (y)\nshow\nif <<([abs v] of (x) ) > [250]> or <([abs v] of (y) ) > [190]>> then\n    if <(skip) < [1]> then\n        set [skip v] to ([ceiling v] of ((([abs v] of (x) ) + ([abs v] of (y) )) / (180)) )\n    end\n    switch costume to (offscreen v)\n    set rotation style [left-right v]\n    set size to (100) %\n    set [_i v] to (((y) / ([abs v] of (x) )) * (235))\n    if <([abs v] of (_i) ) < [175]> then\n        go to x: ((235) * ((x) / ([abs v] of (x) ))) y: (_i)\n    else\n        set [_i v] to (((x) / ([abs v] of (y) )) * (175))\n        go to x: (_i) y: ((175) * ((y) / ([abs v] of (y) )))\n    end\nelse\n    set [skip v] to [0]\n    if <(costume) = [0]> then\n        go to x: (round (x)) y: (round (y))\n    else\n        go to x: (round (x)) y: (round (y))\n        if <not <(size) = [100]>> then\n            set size to (100) %\n        end\n    end\n    if <<(distance to [mouse-pointer v]) < [50]> and <(MOUSE INACTIVE) < [45]>> then\n        if <(name time) < [1]> then\n            say (username)\n        end\n        set [name time v] to [30]\n    end\nend\nif <(name time) > [0]> then\n    change [name time v] by (-1)\n    if <not <(name time) > [0]>> then\n        say []\n    end\nend\n\ndefine Process Tick (rate)\nrepeat until <(parseIdx) < (length of (parseStr))>\n    if <(length of [parsenext v]) = [0]> then\n        set [parsestr v] to []\n        stop [this script v]\n    end\n    Catch up\nend\nRead Change\nset [sx v] to ((?Val) / (rate))\nchange [~x v] by (sx)\nRead Change\nset [sy v] to ((?Val) / (rate))\nchange [~y v] by (sy)\nRead Change\nif <(?Val) > [100]> then\n    add (?Val) to [emoji spawn v]\n    add (~x) to [emoji spawn v]\n    add (~y) to [emoji spawn v]\nelse\n    set [costume v] to (?Val)\nend\n\ndefine Catch up\nset [parsestr v] to (item (3) of [parsenext v])\nset [parseidx v] to (item (4) of [parsenext v])\nRead Number\nrepeat until <<(?Val) > (¬frame)> or <(?Val) = []>>\n    delete (1) of [parsenext v]\n    delete (1) of [parsenext v]\n    set [parsestr v] to (item (3) of [parsenext v])\n    set [parseidx v] to (item (4) of [parsenext v])\n    Read Number\nend\nset [parsestr v] to (item (1) of [parsenext v])\nset [parseidx v] to (item (2) of [parsenext v])\ndelete (1) of [parsenext v]\ndelete (1) of [parsenext v]\nRead Number\nif <not <(lastFrameStart) < (?Val)>> then\n    set [parsestr v] to []\n    stop [this script v]\nend\nset [lastframestart v] to (?Val)\nif <(?Val) < (¬frame)> then\n    set [_i v] to ((¬frame) - (?Val))\n    Read Number\n    set [~x v] to (?Val)\n    Read Number\n    set [~y v] to (?Val)\n    Read Change\n    repeat ([floor v] of (((_i) / (2)) - (1)) )\n        Read Change\n        if <(?Val) = []> then\n            Catch up\n            stop [this script v]\n        end\n        change [~x v] by (?Val)\n        Read Change\n        change [~y v] by (?Val)\n        Read Change\n    end\n    set [costume v] to (?Val)\n    set [sx v] to [0]\n    set [sy v] to [0]\nelse\n    set [¬frame v] to (?Val)\n    Read Number\n    set [~x v] to (?Val)\n    Read Number\n    set [~y v] to (?Val)\n    Read Change\n    set [costume v] to (?Val)\n    set [sx v] to [0]\n    set [sy v] to [0]\nend\n\ndefine skip forward (from frame)\nCatch up\nset [¬frame v] to ((lastFrameStart) + ((from frame) mod (SYNC FRAMES)))\n\nwhen I receive [setup level v]\nwait (0.05) seconds\ngo to [front v] layer\n\ndefine Set Costume (costume#)\nif <not <(costume#) = (costume [number v])>> then\n    switch costume to (costume#)\n    if <(costume#) = [14]> then\n        point in direction (90)\n        set rotation style [all around v]\n    else\n        set rotation style [left-right v]\n    end\nend\n\n@Level\n\nwhen I receive [setup level v]\ngo to [front v] layer\nswitch costume to (l1 x0 y0 v)\nsetup clone at x,y: (0) (0)\nswitch costume to (l1 x1 y0 v)\nsetup clone at x,y: (1) (0)\nswitch costume to (l1 x1b y0 v)\nsetup clone at x,y: (2) (0)\nswitch costume to (l1 x2 y0 v)\nsetup clone at x,y: (3) (0)\nswitch costume to (l1 x2 y1 v)\nsetup clone at x,y: (2) (1)\nswitch costume to (l1 x1 y4 v)\nsetup clone at x,y: (2) (2)\nswitch costume to (l1 x3 y0 v)\nsetup clone at x,y: (3.7) (0.5)\nswitch costume to (l1 x4 y0 v)\nsetup clone at x,y: (4.9) (0.5)\nswitch costume to (l1 x5 y0 v)\nsetup clone at x,y: (5.6) (0)\nswitch costume to (l1 x6 y0 v)\nsetup clone at x,y: (6.6) (0)\nswitch costume to (l1 x6 y0 b v)\nsetup clone at x,y: (7.7) (0)\nswitch costume to (l1 x7 y0 v)\nsetup clone at x,y: (8.5) (0)\nswitch costume to (l1 x7 y0 v)\nsetup clone at x,y: (8.5) (0.84)\nswitch costume to (l1 x4 y0 v)\nsetup clone at x,y: (9.35) (0.88)\nswitch costume to (l1 x5 y0 v)\nsetup clone at x,y: (10.0) (0.4)\nswitch costume to (end v)\nsetup clone at x,y: (10.7) (0.4)\nswitch costume to (l0x0x v)\nSetup2 [12] [0]\nswitch costume to (l0x1x v)\nSetup2 [13] [0]\nswitch costume to (02.07.00 v)\nSetup2 [14] [0]\nswitch costume to (02.08.00 v)\nSetup2 [15] [0]\nset [showing v] to [-1]\n\ndefine setup clone at x,y: (x) (y)\ngo to x: (0) y: (0)\nhide\nset [showing v] to [0]\nset [x v] to (round ((x) * (460)))\nset [y v] to (round ((y) * (340)))\ncreate clone of (_myself_ v)\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    if <(showing) = [0]> then\n        set [showing v] to [1]\n        show\n    end\nelse\n    if <(showing) = [1]> then\n        set [showing v] to [0]\n        hide\n    end\nend\n\nwhen I receive [game loop tick v]\nif <(showing) > [-1]> then\n    position (round ((x) - (@Scroll X))) (round ((y) - (@Scroll Y)))\nend\n\nwhen I receive [test v]\nset [@player x v] to ((13) * (460))\nset [@scroll x v] to (@Player X)\n\nwhen [t v] key pressed\nbroadcast (Test v)\n\ndefine Setup2 (x) (y)\ngo to x: (0) y: (0)\nhide\nset [showing v] to [0]\nset [x v] to (round ((x) * (464)))\nset [y v] to (round ((y) * (344)))\ncreate clone of (_myself_ v)\n\n@moving platform\n\nwhen I receive [setup level v]\nswitch costume to (barrier v)\nsetup clone at x,y: (50) (14) typ [1] width [20] time [0]\nsetup clone at x,y: (110) (14) typ [1] width [20] time [0.5]\nsetup clone at x,y: (540) (200) typ [3] width [60] time [0.2]\nsetup clone at x,y: (540) (200) typ [3] width [60] time [0.7]\nsetup clone at x,y: (1046) (0) typ [10] width [40] time [0.08]\nsetup clone at x,y: (3414) (14) typ [4] width [60] time [0.8]\nsetup clone at x,y: (3912) (0) typ [11] width [40] time [0.8]\nset [showing v] to [-1]\n\ndefine move to (x) (y)\nif <([abs v] of ((@Player X) - (x)) ) < (width)> then\n    if <([abs v] of ((@Player Y) - (y)) ) < (height)> then\n        set [@platform sx v] to ((x) - (x))\n        set [@platform sy v] to ((y) - (y))\n    end\nend\nset [x v] to (x)\nset [y v] to (y)\n\ndefine setup clone at x,y: (x) (y) typ (typ) width (width) time (time)\ngo to x: (0) y: (0)\nhide\nset [typ v] to (typ)\nset [time iterations v] to [1]\nset [width v] to (width)\nset [ox v] to (x)\nset [oy v] to (y)\nset [x v] to (x)\nset [y v] to (y)\nset [time v] to (time)\nset [showing v] to [0]\nset [height v] to [48]\nif <(typ) < [10]> then\n    if <(typ) = [1]> then\n        switch costume to (barrier v)\n    else\n        switch costume to (barrier2 v)\n        if <(typ) = [3]> then\n            set [time iterations v] to [2]\n        else\n            if <(typ) = [4]> then\n                switch costume to (stomper v)\n            end\n        end\n    end\nelse\n    switch costume to (lift1 v)\n    set [height v] to [1000]\nend\npre move (@timer)\ncreate clone of (_myself_ v)\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    if <(showing) = [0]> then\n        set [showing v] to [1]\n        show\n    end\nelse\n    if <(showing) = [1]> then\n        set [showing v] to [0]\n        hide\n    end\nend\n\nwhen I receive [player - pre-move v]\nif <(showing) > [-1]> then\n    pre move ((((@timer) / ((SYNC FRAMES) * (time iterations))) + (time)) mod (1))\n    position (round ((x) - (@Scroll X))) (round ((y) - (@Scroll Y)))\nend\n\ndefine moving platform? (timer)\nif <(typ) = [1]> then\n    move to (ox) (round ((oy) + ((20) + ((20) * ([sin v] of (([sin v] of ((timer) * (360)) ) * (90)) )))))\nelse\n    if <(typ) = [2]> then\n        move to (round ((ox) + ((64) + (([sin v] of ((timer) * (360)) ) * (64))))) (oy)\n    else\n        if <(typ) = [3]> then\n            move to (round ((ox) + ((128) + (([sin v] of ((timer) * (360)) ) * (128))))) (round ((oy) + ((0) + (([cos v] of ((timer) * (360)) ) * (90)))))\n        else\n            if <(typ) = [4]> then\n                move to (ox) (round ((oy) + ((24) + ((24) * ([sin v] of (([sin v] of ((timer) * (360)) ) * (90)) )))))\n            end\n        end\n    end\nend\n\n    move to (ox) (round ((oy) + (([abs v] of ((timer) - (0.5)) ) * (80))))\nend\n\ndefine barrier (percent) run length (len)\nif <(percent) < [0.15]> then\n    move to (round ((ox) + ((percent) * (len)))) (round ((oy) - (((0.15) - (percent)) * (800))))\nelse\n    if <(percent) > [0.85]> then\n        move to (round ((ox) + ((percent) * (len)))) (round ((oy) - (((percent) - (0.85)) * (800))))\n    else\n        move to (round ((ox) + ((percent) * (len)))) (round (oy))\n    end\nend\nset [ox v] to (round ((7.9) * (460)))\n\nwhen I receive [game loop tick v]\nif <(showing) > [-1]> then\n    position (round ((x) - (@Scroll X))) (round ((y) - (@Scroll Y)))\nend\n\ndefine move lift (timer)\nif <(typ) = [10]> then\n    move to (ox) ((round ((oy) + ((timer) * (96)))) + ((96) * ([floor v] of ((@Scroll Y) / (96)) )))\nelse\n    move to (ox) ((round ((oy) + ((48) + ((48) * ([sin v] of ((timer) * (360)) ))))) + ((96) * ([floor v] of ((@Scroll Y) / (96)) )))\nend\n\ndefine pre move (time)\nif <(typ) > [0]> then\n    if <(typ) < [10]> then\n        moving platform? (time)\n    else\n        if <(typ) < [20]> then\n            move lift (time)\n        end\n    end\nend\n\nmove to (ox) (round ((oy) + ((20) + ((20) * ([sin v] of (([sin v] of ((timer) * (360)) ) * (90)) )))))\n\nsetup clone at x,y: (3414) (14) typ [4] width [60] time [0.92]\nsetup clone at x,y: (3912) (0) typ [11] width [40] time [0.92]\n\n@YouTube\n\nwhen flag clicked\nshow\ngo to x: (0) y: (0)\ngo to [front v] layer\nwait (0.06) seconds\ngo to [front v] layer\nwait (0.06) seconds\ngo to [front v] layer\nwait (10) seconds\nhide\n\n@Music\n\nwhen flag clicked\nset [sync frames v] to [63]\nif <not <(username) = [griffpatch]>> then\n    forever\n        play sound [y2mate v] until done\n    end\nend\n\n@background\n\nwhen I receive [setup level v]\ngo [backward v] (1000) layers\nswitch costume to (costume1 v)\nset [x v] to [0]\nset [showing v] to [0]\nshow\ncreate clone of (_myself_ v)\nset [x v] to [470]\n\nwhen I receive [game loop tick v]\nif <(showing) = [0]> then\n    position (round ((x) - (((@Scroll X) * (0.75)) mod (470)))) ((0) - ((@Scroll Y) * (0.75)))\nelse\n    position (round ((0) - (((@Scroll X) * (0.75)) mod (192)))) ((0) - (((@Scroll Y) * (0.75)) mod (192)))\nend\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\n\nwhen I receive [test v]\nif  then\n    delete this clone\nend\nset [showing v] to [1]\nswitch costume to (artboard 1 copy 3 v)\n\n@Edge Fade\n\nwhen I receive [setup level v]\ngo to x: (0) y: (0)\ngo to [front v] layer\nshow\n\nwhen I receive [test v]\nhide\n\n@Check Points\n\ndefine setup clone at x,y: (x) (y)\ngo to x: (0) y: (0)\nhide\nset [showing v] to [0]\nset [x v] to (x)\nset [y v] to (y)\nset [spawn y v] to (y)\nchange [@totalflags v] by (1)\nchange [flag count v] by (1)\nset [flag id v] to (FLAG COUNT)\ncreate clone of (_myself_ v)\n\nwhen I receive [game loop tick v]\nif <(showing) > [-1]> then\n    position (round ((x) - (@Scroll X))) (round ((y) - (@Scroll Y)))\n    if <(showing) > [25]> then\n        set [showing v] to [-2]\n        hide\n    end\nend\n\nwhen I receive [setup level v]\nsetup\n\ndefine on screen\nif <((@timer) mod (5)) = [0]> then\n    next costume\nend\nif <touching (game v)?> then\n    set [showing v] to [2]\n    set [@spawn x v] to (x)\n    set [@spawn y v] to (y)\n    change [@totalflags v] by (-1)\n    if <(flag id) = [1]> then\n        set [flag count v] to [0]\n    end\n    if <(flag id) = (FLAG COUNT)> then\n        set [flag count v] to [1]\n    end\nend\n\ndefine position (x) (y)\nif <<(flag id) = [1]> and <(FLAG COUNT) > [1]>> then\n    stop [this script v]\nend\ngo to x: (x) y: (y)\nif <(showing) < [2]> then\n    if <<(x) = (x position)> and <(y) = (y position)>> then\n        if <(showing) = [0]> then\n            set [showing v] to [1]\n            show\n        end\n        on screen\n    else\n        if <(showing) = [1]> then\n            set [showing v] to [0]\n            hide\n        end\n    end\nelse\n    set size to ((size) + (15)) %\n    change [ghost v] effect by (4)\n    change [y v] by (5)\n    change [showing v] by (1)\nend\n\nwhen I receive [reset v]\nif <(showing) = [-1]> then\n    setup\nelse\n    delete this clone\nend\n\ndefine setup\nswitch costume to (l1 x0 y0 v)\nset [flag count v] to [0]\nsetup clone at x,y: (-137) (32)\nsetup clone at x,y: (457) (-54)\nsetup clone at x,y: (1198) (63)\nsetup clone at x,y: (2483) (62)\nsetup clone at x,y: (3705) (-54)\nsetup clone at x,y: (4779) (48)\nset [showing v] to [-1]\n\n@Emoji\n\nwhen flag clicked\nset size to (40) %\nhide\nset [id v] to []\nset [e frame v] to [0]\nset [@player emoji v] to []\n\nwhen I receive [pre game loop v]\nforever\n    wait until <<key (e v) pressed?> or <key (r v) pressed?>>\n    set [@player emoji v] to [0]\n    if <key (r v) pressed?> then\n        spawn ui [34] [60]\n    else\n        spawn ui [1] [33]\n    end\n    hide\n    wait until <not <<key (e v) pressed?> or <key (r v) pressed?>>>\n    set [@player emoji v] to []\n    wait (0.4) seconds\nend\n\ndefine spawn ui (from) (to)\nset [id v] to [0]\nset size to (40) %\nclear graphic effects\nset y to (-75)\ngo to [front v] layer\nshow\nswitch costume to (from)\nset [ghost v] effect to (100)\nrepeat (3)\n    set x to (((11) - (1)) * (-20))\n    repeat (11)\n        create clone of (_myself_ v)\n        if <(costume [number v]) = (to)> then\n            set [id v] to []\n            stop [this script v]\n        end\n        change x by (40)\n        next costume\n    end\n    change y by (-40)\nend\nset [id v] to []\n\nwhen I start as a clone\nif <(id) = [0]> then\n    UI\nelse\n    set size to (20) %\n    change [y v] by (22)\n    position (round ((x) - (@Scroll X))) (round ((y) - (@Scroll Y)))\n    repeat (5)\n        change [ghost v] effect by (-20)\n        change size by (4)\n    end\n    wait (1.5) seconds\n    repeat (10)\n        change [ghost v] effect by (10)\n        change size by (-5)\n    end\n    delete this clone\nend\n\ndefine UI\nset size to (40) %\nrepeat (5)\n    change size by (4)\n    change y by (1)\n    change [ghost v] effect by (-20)\nend\nrepeat until <not <(@Player Emoji) = [0]>>\n    if <(distance to [mouse-pointer v]) < [20]> then\n        if <(size) < [90]> then\n            change size by (10)\n        end\n    else\n        if <(size) > [60]> then\n            change size by (-5)\n        end\n    end\nend\nif <(distance to [mouse-pointer v]) < [20]> then\n    set [@player emoji v] to (costume [number v])\n    set [id v] to [1]\n    set [x v] to (@Player X)\n    set [y v] to (@Player Y)\n    create clone of (_myself_ v)\n    set [id v] to []\nend\nrepeat (5)\n    change [ghost v] effect by (10)\n    change y by (-1)\n    change size by (-4)\nend\ndelete this clone\n\nwhen I receive [game loop tick v]\nif <(id) > [0]> then\n    change [y v] by (1)\n    position (round ((x) - (@Scroll X))) (round ((y) - (@Scroll Y)))\nelse\n    if <(id) = []> then\n        spawn emoji\n    end\nend\n\ndefine spawn emoji\nset [id v] to [1]\nrepeat until <(length of [emoji spawn v]) = [0]>\n    set [x v] to (item (2) of [emoji spawn v])\n    set [y v] to (item (3) of [emoji spawn v])\n    if <<([abs v] of ((x) - (@Scroll X)) ) < [280]> and <([abs v] of ((y) - (@Scroll Y)) ) < [200]>> then\n        switch costume to ((item (1) of [emoji spawn v]) - (100))\n        create clone of (_myself_ v)\n    end\n    delete (1) of [emoji spawn v]\n    delete (1) of [emoji spawn v]\n    delete (1) of [emoji spawn v]\nend\nset [id v] to []\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    if <(showing) = [0]> then\n        set [showing v] to [1]\n        show\n    end\nelse\n    if <(showing) = [1]> then\n        set [showing v] to [0]\n        hide\n    end\nend\n\n@Cloud\n\ndefine Cloud Tick\nProcess Cloud [1] (join [=] (☁ CLOUD1))\nProcess Cloud [2] (join [=] (☁ CLOUD2))\nProcess Cloud [3] (join [=] (☁ CLOUD3))\nProcess Cloud [4] (join [=] (☁ CLOUD4))\nProcess Cloud [5] (join [=] (☁ CLOUD5))\nProcess Cloud [6] (join [=] (☁ CLOUD6))\nProcess Cloud [7] (join [=] (☁ CLOUD7))\nProcess Cloud [8] (join [=] (☁ CLOUD8))\nProcess Cloud [9] (join [=] (☁ CLOUD9))\nif <<(timer) < (next post)> or <((@timer) mod (2)) = [1]>> then\n    stop [this script v]\nend\nset [next post v] to ((timer) + (pick random (0.5) to (0.7)))\nEncode Player\nset [_i v] to (pick random (1) to (length of [cloud data v]))\nif <(_i) < [5]> then\n    if <(_i) < [3]> then\n        if <(_i) < [2]> then\n            set [☁ cloud1 v] to (parseStr)\n        else\n            set [☁ cloud2 v] to (parseStr)\n        end\n    else\n        if <(_i) < [4]> then\n            set [☁ cloud3 v] to (parseStr)\n        else\n            set [☁ cloud4 v] to (parseStr)\n        end\n    end\nelse\n    if <(_i) < [7]> then\n        if <(_i) < [6]> then\n            set [☁ cloud5 v] to (parseStr)\n        else\n            set [☁ cloud6 v] to (parseStr)\n        end\n    else\n        if <(_i) < [8]> then\n            set [☁ cloud7 v] to (parseStr)\n        else\n            if <(_i) < [9]> then\n                set [☁ cloud8 v] to (parseStr)\n            else\n                set [☁ cloud9 v] to (parseStr)\n            end\n        end\n    end\nend\n\ndefine Write Number (val)\nif <(val) < [0]> then\n    if <(val) < [-99999999]> then\n        set [?val v] to [0]\n    else\n        set [?val v] to (join [0] ([abs v] of (round (val)) ))\n    end\nelse\n    if <(val) > [99999999]> then\n        set [?val v] to [0]\n    else\n        set [?val v] to (round (val))\n    end\nend\nset [parsestr v] to (join (parseStr) (join (length of (?Val)) (?Val)))\n\ndefine Init Reader (text)\nset [parsestr v] to (text)\nset [parseidx v] to [1]\n\ndefine Write String (txt)\nWrite Number (length of (txt))\nset [?val v] to []\nset [i3 v] to [1]\nrepeat (length of (txt))\n    set [i2 v] to (item # of (letter (i3) of (txt)) in [_encode v])\n    if <(i2) < [10]> then\n        set [?val v] to (join (?Val) (join [0] (i2)))\n    else\n        set [?val v] to (join (?Val) (i2))\n    end\n    change [i3 v] by (1)\nend\nset [parsestr v] to (join (parseStr) (?Val))\n\ndefine Skip String\nRead Number\nchange [parseidx v] by ((?Val) * (2))\n\ndefine Read String\nRead Number\nif <((parseIdx) + ((?Val) * (2))) > ((length of (parseStr)) + (1))> then\n    set [i2 v] to ((((length of (parseStr)) + (1)) - (parseIdx)) / (2))\nelse\n    set [i2 v] to (?Val)\nend\nset [?val v] to []\nrepeat (i2)\n    set [i2 v] to (join (letter (parseIdx) of (parseStr)) (letter ((parseIdx) + (1)) of (parseStr)))\n    set [?val v] to (join (?Val) (item (i2) of [_encode v]))\n    change [parseidx v] by (2)\nend\n\nset [_chars v] to [ !"#$%&'\(\)*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~]\n\ndefine Read Number\nset [?val v] to []\nrepeat (letter (parseIdx) of (parseStr))\n    change [parseidx v] by (1)\n    set [?val v] to (join (?Val) (letter (parseIdx) of (parseStr)))\nend\nif <(letter (1) of (?Val)) = [0]> then\n    set [?val v] to ((0) - (?Val))\nend\nchange [parseidx v] by (1)\n\nwhen I receive [cloud - setup v]\nhide variable [tag player v]\nset [show names v] to [0]\nshow list [player names v]\ndelete all of [player names v]\ndelete all of [pidx v]\ndelete all of [pdata v]\ndelete all of [say v]\nInit Reader []\nWrite String (username)\nset [encoded name v] to (parseStr)\nset [next post v] to ((timer) + (0.2))\nInit Cloud Data\nif <(TEST) > [0]> then\n    add (username) to [player names v]\n    add [] to [pidx v]\n    add [] to [pdata v]\nend\n\ndefine Process Cloud (id) (var)\nif <(var) = (item (id) of [cloud data v])> then\n    stop [this script v]\nend\nreplace item (id) of [cloud data v] with (var)\nInit Reader (var)\nchange [parseidx v] by (1)\nRead String\nif <(?Val) = (username)> then\n    stop [this script v]\nend\nset [pid v] to (item # of (?Val) in [player names v])\nif <(pid) = [0]> then\n    set [pid v] to (item # of [] in [player names v])\n    if <(pid) = [0]> then\n        add (?Val) to [player names v]\n        add [] to [pidx v]\n        add [] to [pdata v]\n        set [pid v] to (length of [player names v])\n        create clone of (cloud players v)\n    else\n        replace item (pid) of [player names v] with (?Val)\n    end\nend\nreplace item (pid) of [pidx v] with (parseIdx)\nreplace item (pid) of [pdata v] with (parseStr)\n\nwhen I receive [cloud - tick v]\nCloud Tick\n\ndefine Init Cloud Data\ndelete all of [cloud data v]\nadd (join [=] (☁ CLOUD1)) to [cloud data v]\nadd (join [=] (☁ CLOUD2)) to [cloud data v]\nadd (join [=] (☁ CLOUD3)) to [cloud data v]\nadd (join [=] (☁ CLOUD4)) to [cloud data v]\nadd (join [=] (☁ CLOUD5)) to [cloud data v]\nadd (join [=] (☁ CLOUD6)) to [cloud data v]\nadd (join [=] (☁ CLOUD7)) to [cloud data v]\nadd (join [=] (☁ CLOUD8)) to [cloud data v]\nadd (join [=] (☁ CLOUD9)) to [cloud data v]\n\ndefine Encode Player\nInit Reader (Encoded Name)\nset [i2 v] to (((length of [record v]) / (3)) - (1))\nWrite Number ((@timer) - ((i2) * (2)))\nset [nx v] to (item (1) of [record v])\nset [ny v] to (item (2) of [record v])\nWrite Number (nx)\nWrite Number (ny)\nWrite Change (item (3) of [record v])\nset [_i v] to [4]\nrepeat (i2)\n    set [lx v] to (nx)\n    set [ly v] to (ny)\n    set [nx v] to (item (_i) of [record v])\n    set [ny v] to (item ((_i) + (1)) of [record v])\n    Write Change ((nx) - (lx))\n    Write Change ((ny) - (ly))\n    Write Change (item ((_i) + (2)) of [record v])\n    change [_i v] by (3)\nend\nrepeat ((length of [record v]) - ((3) * (15)))\n    delete (1) of [record v]\nend\n\ndefine Write Change (val)\nif <([abs v] of (val) ) < [50]> then\n    if <(val) < [-40]> then\n        set [parsestr v] to (join (parseStr) (join [0] ((val) + (50))))\n    else\n        set [parsestr v] to (join (parseStr) ((val) + (50)))\n    end\nelse\n    set [parsestr v] to (join (parseStr) [00])\n    Write Number (val)\nend\n\nwhen [n v] key pressed\nif <(show names) > [0]> then\n    set [show names v] to [0]\n    show list [player names v]\nelse\n    set [show names v] to [1]\n    hide list [player names v]\nend\n\n@001\n\nwhen I receive [setup level v]\ngo to [back v] layer\nswitch costume to (02.07.05 v)\nSetup2 [14] [0]\nswitch costume to (02.08.00 v)\nSetup2 [15] [0]\nset [showing v] to [-1]\n\nwhen I receive [test v]\nset [@player x v] to ((13) * (460))\nset [@scroll x v] to (@Player X)\n\nwhen [t v] key pressed\nbroadcast (Test v)\n\ndefine setup clone at x,y: (x) (y)\ngo to x: (0) y: (0)\nhide\nset [showing v] to [0]\nset [x v] to (round ((x) * (460)))\nset [y v] to (round ((y) * (340)))\ncreate clone of (_myself_ v)\n\nwhen I receive [game loop tick v]\nif <(showing) > [-1]> then\n    position (round ((x) - (@Scroll X))) (round ((y) - (@Scroll Y)))\nend\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    if <(showing) = [0]> then\n        set [showing v] to [1]\n        show\n    end\nelse\n    if <(showing) = [1]> then\n        set [showing v] to [0]\n        hide\n    end\nend\n\ndefine Setup2 (x) (y)\ngo to x: (0) y: (0)\nhide\nset [showing v] to [0]\nset [x v] to (round ((x) * (464)))\nset [y v] to (round ((y) * (344)))\ncreate clone of (_myself_ v)\n\n