Massive Multiplayer Platformer custom level

Instructions: 10000 views!

@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop3 v)\n\nwhen flag clicked\n\nif <not <<(username) = [griffpatch]> or <(username) = [griffpatch_tutor]>>> then\n    stop [all v]\nend\n\nwhen I receive [message - show v]\nswitch backdrop to (reload v)\n\n@Blank\n\nset [debug v] to [0]\n\nwhen [m v] key pressed\nif <(DEBUG) = [1]> then\n    set [@spawn x v] to (@Player X)\n    set [@spawn y v] to (@Player Y)\nend\n\n@Game\n\ndefine fix player (x) (y)\nset [t v] to [1]\nrepeat ((length of [fix v]) / (2))\n    set [@player x v] to ((x) + (item (t) of [fix v]))\n    set [@player y v] to ((y) + (item ((t) + (1)) of [fix v]))\n    Check Collide\n    if <(touch) = [0]> then\n        stop [this script v]\n    end\n    change [t v] by (2)\nend\nset [@player x v] to (x)\nset [@player y v] to (y)\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) < [-370]> then\n    set [@scroll x v] to [-370]\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 - Left / Right\nPlayer Tick - Up / Down\nif <touching (lava v)?> then\n    set [@player die v] to [1]\nend\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]\nset [@slope v] to [0]\nset [@crouching v] to [0]\ndelete all of [debug v]\ndelete all of [slope history v]\nScroll Level\n\nwhen flag clicked\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]\nif <(DEBUG) < [1]> then\n    set [@spawn x v] to [-500]\n    set [@spawn y v] to [76]\nend\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)\n    if <(DEBUG) = [1]> then\n        if <key (p v) pressed?> then\n            wait until <not <key (p v) pressed?>>\n            repeat until <key (p v) pressed?>\n                broadcast (game loop tick v)\n            end\n            wait until <not <key (p v) pressed?>>\n        end\n    end\nend\nbroadcast (Message - Show v) and wait\n\nwhen I receive [player - pre-move v]\nget speed (@Player SX) (@Player SY)\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) = [-500]>> 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 [-500]\n    set [@spawn y v] to [76]\n    set [clock v] to [0]\n    Reset Player\n    broadcast (Reset v)\nend\nif <(@crouching) = [2]> then\n    Check Slide []\nend\nSlope Detect\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) > [2]> or <(@walking) > [-1]>> then\n    set [@slope v] to [0]\nelse\n    switch costume to (slope-4 v)\n    if <<touching (level v)?> or <touching (moving platform v)?>> then\n        next costume\n        if <<touching (level v)?> or <touching (moving platform v)?>> then\n            next costume\n            if <<touching (level v)?> or <touching (moving platform v)?>> then\n                next costume\n                if <<touching (level v)?> or <touching (moving platform v)?>> then\n                    next costume\n                end\n            end\n        end\n    end\n    set [@slope v] to ((costume [number v]) - (7))\n    switch costume to (slope4 v)\n    if <<touching (level v)?> or <touching (moving platform v)?>> then\n        switch costume to (slope3 v)\n        if <<touching (level v)?> or <touching (moving platform v)?>> then\n            switch costume to (slope2 v)\n            if <<touching (level v)?> or <touching (moving platform v)?>> then\n                switch costume to (slope1 v)\n                if <<touching (level v)?> or <touching (moving platform v)?>> then\n                    switch costume to (slope-1 v)\n                end\n            end\n        end\n    end\n    change [@slope v] by ((costume [number v]) - (6))\nend\ndelete (3) of [slope history v]\ninsert (@Slope) at (1) of [slope history v] \nchange [@slope v] by (item (2) of [slope history v])\nchange [@slope v] by (item (3) of [slope history v])\nset [@slope v] to (round ((@Slope) / (length of [slope history v])))\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 (@Player X) (@Player Y)\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\nelse\n    Check Collide\n    if <(touch) > [0]> then\n        fix player (@Player X) (@Player Y)\n    end\nend\n\ndefine Player Tick - Crouch / Jump Key\nif <(DEBUG) > [0]> then\n    if <key (2 v) pressed?> then\n        set [@player sy v] to [8]\n        set [@falling v] to [4]\n        set [@player mode v] to []\n        stop [this script v]\n    end\nend\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    \n        Check Slide ((@Player SX) / ([abs v] of (@Player SX) ))\n    end\n    if <<not <(key left right) = [0]>> and <([abs v] of (@Player SX) ) > [0]>> 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        set [@crouching v] to [0]\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            if <([abs v] of (@Player SX) ) > [9]> then\n                set [@player sx v] to ((10) * ((@Player SX) / ([abs v] of (@Player SX) )))\n            end\n        else\n            set [@player sy v] to [17]\n            set [@player mode v] to [High jump]\n        end\n    else\n        set [@crouching v] to [0]\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]\nif <(@crouching) = [2]> then\n    change [@player y v] by (-4)\nend\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        slide off ledge\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            if <(@crouching) = [2]> then\n                set [@player sy v] to ((@Player SY) / (1.5))\n            else\n                set [@player sy v] to ((@Player SY) / (2))\n            end\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\nif <(@Player X) < [-605]> then\n    set [@player x v] to [-605]\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 (5)\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        stop [this script v]\n    end\nend\nset [@player y v] to (t)\nset [@slope v] to [0]\n\nswitch costume to (slope0 v)\nif <not <<touching (level v)?> or <touching (moving platform v)?>>> then\n    set [@slope v] to [0]\n    set [@crouching v] to [0]\nelse\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\nend\nswitch costume to (hitbox v)\nif <not <(t) = (@Player Y)>> then\n    set [@falling v] to [0]\nend\nstop [this script v]\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\nswitch costume to (slope0 v)\nif <not <<touching (level v)?> or <touching (moving platform v)?>>> then\n    set [@slope v] to [0]\nelse\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\nend\n\ndefine slide off ledge\nchange [@player x v] by (-2)\nchange [@player y v] by (-5)\nCheck Collide\nchange [@player y v] by (5)\nchange [@player x v] by (1)\nif <(touch) = [0]> then\n    Check Collide\n    if <(touch) = [0]> then\n        stop [this script v]\n    end\nend\nchange [@player x v] by (3)\nchange [@player y v] by (-5)\nCheck Collide\nchange [@player y v] by (5)\nchange [@player x v] by (-1)\nif <(touch) = [0]> then\n    Check Collide\n    if <(touch) = [0]> then\n        stop [this script v]\n    end\nend\nchange [@player x v] by (-1)\n\nset [@crouching v] to [0]\n\ndefine get speed (dx) (dy)\nset [player speed v] to ([sqrt v] of (((dx) * (dx)) + ((dy) * (dy))) )\nset [start x v] to (@Player X)\nset [start y v] to (@Player Y)\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) > [3]> 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@background\n\nwhen I receive [setup level v]\nset [ghost v] effect to (95)\ngo [backward v] (1000) layers\nshow\n\nswitch costume to (costume1 v)\nset [x v] to [0]\nset [showing v] to [0]\n\nwhen I receive [game loop tick v]\nposition (round ((0) - (((@Scroll X) * (0.75)) mod (36)))) (round ((0) - (((@Scroll Y) * (0.75)) mod (36))))\n\nif <(showing) = [0]> then\nelse\n    position (round ((0) - (((@Scroll X) * (0.75)) mod (192)))) ((0) - (((10) * (0.75)) mod (192)))\nend\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\n\ncreate clone of (_myself_ v)\nset [x v] to [470]\n\n@Level\n\nwhen I receive [setup level v]\nsetup\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)))\nset [costume v] to (costume [number v])\ncreate clone of (_myself_ v)\n\ndefine position (x) (y)\nif <(showing) = [1]> then\n    switch costume to (big v)\nend\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    set [showing v] to [1]\n    switch costume to (costume)\n    show\nelse\n    if <(showing) = [1]> then\n        set [showing v] to [0]\n        hide\n    end\nend\n\nif <(showing) = [0]> then\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 setup\ngo to [front v] layer\nswitch costume to ((1) + (1))\nrepeat until <(costume [number v]) = [1]>\n    set [t v] to (costume [name v])\n    if <(letter (1) of (t)) = [L]> then\n        set [y v] to (join (letter (4) of (t)) (letter (5) of (t)))\n        set [x v] to (join (letter (7) of (t)) (letter (8) of (t)))\n        setup clone at x,y: (round (x)) (round (y))\n    end\n    next costume\nend\nset [showing v] to [-1]\nnext costume\n\nwhen I start as a clone\nswitch costume to (big v)\n\n@moving platform\n\nwhen I receive [setup level v]\nset rotation style [all around v]\npoint in direction (90)\nswitch costume to (barrier v)\nsetup clone at x,y: (-238) (78) typ [1] width [20] time [0.5] costume [] mul []\nsetup clone at x,y: (50) (14) typ [21] width [105] time [0] costume [] mul []\nsetup clone at x,y: (-50) (173) typ [20] width [105] time [0.7] costume [] mul []\nsetup clone at x,y: (308) (2) typ [14] width [180] time [0] costume [] mul []\nsetup clone at x,y: (1320) (321) typ [13] width [220] time [0] costume [] mul []\nsetup clone at x,y: (1850) (260) typ [20] width [100] time [0] costume [] mul []\nsetup clone at x,y: (2100) (200) typ [21] width [100] time [0.125] costume [] mul []\nsetup clone at x,y: (3750) (0) typ [10] width [40] time [0.5] costume [] mul []\nsetup clone at x,y: (4100) (787) typ [21] width [105] time [0] costume [] mul [0.5]\nsetup clone at x,y: (4300) (870) typ [20] width [105] time [0] costume [] mul [0.5]\nsetup clone at x,y: (5150) (0) typ [10] width [40] time [0.5] costume [] mul []\nset [showing v] to [-1]\n\ndefine move to (x) (y) cycle (cycle)\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)) + ((cycle) / (2))) mod (cycle)) - ((cycle) / (2)))\n        set [@platform sy v] to (((((y) - (y)) + ((cycle) / (2))) mod (cycle)) - ((cycle) / (2)))\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) costume (costume) mul (mul)\ngo to x: (0) y: (0)\npoint in direction (90)\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 (barriernew 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    if <(typ) < [20]> then\n        if <(typ) < [12]> then\n            switch costume to (lift2 v)\n            set [height v] to [1000]\n        else\n            if <(typ) = [13]> then\n                switch costume to (3white v)\n            else\n                if <(typ) = [14]> then\n                    set [time iterations v] to [0.25]\n                    set [height v] to (width)\n                    switch costume to (escalator v)\n                end\n            end\n        end\n    else\n        if <(width) = [100]> then\n            set [time iterations v] to [1]\n            switch costume to (squareeye v)\n        else\n            if <(costume) = []> then\n                switch costume to (circle4 v)\n            else\n                switch costume to (costume)\n            end\n        end\n        set [height v] to (width)\n    end\nend\nif <(mul) > []> then\n    set [time iterations v] to (mul)\nend\npre move (@timer)\ncreate clone of (_myself_ v)\n\ndefine position (x) (y)\nif <(showing) = [1]> then\n    switch costume to (big v)\nend\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    set [showing v] to [1]\n    switch costume to (costume)\n    show\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)) ))))) cycle []\nelse\n    if <(typ) = [2]> then\n        move to (round ((ox) + ((64) + (([sin v] of ((timer) * (360)) ) * (64))))) (oy) cycle []\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))))) cycle []\n        else\n            if <(typ) = [4]> then\n                move to (ox) (round ((oy) + ((24) + ((24) * ([sin v] of (([sin v] of ((timer) * (360)) ) * (90)) ))))) cycle []\n            end\n        end\n    end\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)))) cycle []\nelse\n    if <(percent) > [0.85]> then\n        move to (round ((ox) + ((percent) * (len)))) (round ((oy) - (((percent) - (0.85)) * (800)))) cycle []\n    else\n        move to (round ((ox) + ((percent) * (len)))) (round (oy)) cycle []\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)) ))) cycle []\nelse\n    if <(typ) = [11]> then\n        move to (ox) ((round ((oy) + ((48) + ((48) * ([sin v] of ((timer) * (360)) ))))) + ((96) * ([floor v] of ((@Scroll Y) / (96)) ))) cycle []\n    else\n        if <(typ) = [12]> then\n            move to (round ((ox) + (((1) - (timer)) * (170)))) (oy) cycle [170]\n        else\n            if <(typ) = [13]> then\n                move to (round ((ox) + ((timer) * (170)))) (oy) cycle [170]\n            else\n                if <(typ) = [14]> then\n                    move to (round ((ox) + ((timer) * (32)))) (round ((oy) + (((1) - (timer)) * (32)))) cycle [32]\n                end\n            end\n        end\n    end\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        else\n            if <(typ) = [20]> then\n                rotate (((1) - (time)) mod (1))\n            else\n                if <(typ) = [21]> then\n                    rotate (time)\n                end\n            end\n        end\n    end\nend\n\ndefine rotate (timer)\nset [t v] to (direction)\npoint in direction ((timer) * (360))\nset [t v] to (((((direction) - (t)) + (45)) mod (90)) - (45))\nset [ox v] to (((@Player X) - (x)) * (1))\nif <([abs v] of (ox) ) < (width)> then\n    set [oy v] to (((@Player Y) - (y)) * (1))\n    if <([abs v] of (oy) ) < (height)> then\n        set [@platform sx v] to ((ox) - (((ox) * ([cos v] of (t) )) - ((oy) * ([sin v] of (t) ))))\n        set [@platform sy v] to ((oy) - (((ox) * ([sin v] of (t) )) + ((oy) * ([cos v] of (t) ))))\n    end\nend\n\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 start as a clone\nset [costume v] to (costume [number v])\nswitch costume to (big v)\nset [showing v] to [0]\n\nsetup clone at x,y: (3880) (200) typ [21] width [270] time [0.5] costume [4eyes] mul []\nsetup clone at x,y: (4010) (200) typ [21] width [270] time [0] costume [4eyes] mul []\n\nsetup clone at x,y: (540) (200) typ [3] width [60] time [0.2] costume [] mul []\nsetup clone at x,y: (540) (200) typ [3] width [60] time [0.7] costume [] mul []\nsetup clone at x,y: (1046) (0) typ [10] width [40] time [0.08] costume [] mul []\nsetup clone at x,y: (3414) (14) typ [4] width [60] time [0.8] costume [] mul []\nsetup clone at x,y: (3912) (0) typ [11] width [40] time [0.8] costume [] mul []\n\nsetup clone at x,y: (3750) (200) typ [21] width [270] time [0] costume [4eyes] mul []\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]\nset size to (100) %\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 (costume1 v)\nset [flag count v] to [0]\nsetup clone at x,y: (-518) (77)\nsetup clone at x,y: (1150) (337)\nsetup clone at x,y: (2336) (228)\nsetup clone at x,y: (3601) (101)\nsetup clone at x,y: (5014) (475)\nset [showing v] to [-1]\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        if <(length of [player names v]) = [199]> then\n            stop [this script v]\n        end\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@Music\n\nwhen flag clicked\nset [sync frames v] to [63]\nif  then\n    forever\n        play sound [Volcano Theme \(New Super Mario Bros v] until done\n    end\nend\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@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@Closest\n\ndefine insert (d) (x) (y)\nif <(d) > [5.5]> then\n    stop [this script v]\nend\nset [i v] to (length of [xy v])\nrepeat until <not <(d) < (item (i) of [xy v])>>\n    change [i v] by (-1)\nend\nchange [i v] by (1)\ninsert (d) at (i) of [xy v] \ninsert (y) at (((i) * (2)) - (1)) of [fix v] \ninsert (x) at (((i) * (2)) - (1)) of [fix v] \n\ndefine create fixer (rad)\ndelete all of [xy v]\ndelete all of [fix v]\nset [y v] to ((-0.1) - (rad))\nrepeat (((rad) * (2)) + (1))\n    set [x v] to ((0) - (rad))\n    repeat (((rad) * (2)) + (1))\n        set [t v] to ([sqrt v] of (((x) * (x)) + ((y) * (y))) )\n        insert (t) (x) (round (y))\n        change [x v] by (1)\n    end\n    change [y v] by (1)\nend\n\ncreate fixer [3]\n\n@Lava\n\nwhen flag clicked\ngo to [back v] layer\ngo [forward v] (1) layers\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\n\nwhen I receive [game loop tick v]\nset [x v] to (@Scroll X)\nset [y v] to ((0) + ((5) * ([sin v] of ((timer) * (110)) )))\nposition (round ((x) - (@Scroll X))) (round ((y) - (@Scroll Y)))\n\n@Boulders\n\nwhen flag clicked\n\nwhen I start as a clone\nshow\nif <(costume [number v]) = [1]> then\n    start sound [Slide Whistle v]\nelse\n    start sound [Slide Whistle2 v]\nend\nforever\n    turn left (pick random (3) to (20)) degrees\n    change y by (-10)\n    if <touching (player v)?> then\n        set [@player die v] to [0]\n    end\n    if <<<touching (level v)?> or <touching (lava v)?>> or > then\n        if <(costume [number v]) = [1]> then\n            start sound [Oops v]\n        else\n            start sound [Oops2 v]\n        end\n        hide\n        wait (1) seconds\n        delete this clone\n    end\nend\n\nforever\n    switch costume to (pick random (1) to (2))\n    hide\n    go to x: (pick random (200) to (-200)) y: (10000000)\n    wait (0.5) seconds\n    create clone of (_myself_ v)\nend\n\n