candy platformer


@Stage\n\n@Banners\n\ndefine Turbo mode detector\nreset timer\nrepeat (10)\n    move (0) steps\nend\nif <(timer) > [0.1]> then\n    set [turbo mode v] to [false]\nelse\n    set [turbo mode v] to [true]\n    broadcast (Turbo Mode v) and wait\nend\n\nwhen I receive [start v]\nif <(Full?) = [True]> then\n    repeat (10)\n        change [brightness v] effect by (-10)\n    end\n    switch costume to (full v)\n    repeat (10)\n        change [brightness v] effect by (10)\n    end\n    clear graphic effects\n    wait (1) seconds\n    hide\nelse\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\n    hide\nend\n\nwhen I receive [initialise  v]\nswitch costume to (connecting v)\nshow\nclear graphic effects\ngo to x: (0) y: (0)\ngo to [front v] layer\nset [full? v] to [False]\nset [kick v] to [False]\nset [moved? v] to [800]\n\nwhen I receive [you have been booted. v]\nswitch costume to (booted v)\nshow\nclear graphic effects\ngo to x: (0) y: (0)\ngo to [front v] layer\n\nwhen I receive [tick v]\nif <<<<key (any v) pressed?> or <(username) = [Cloud-Multiplayer]>> or <mouse down?>> or <(Full?) = [True]>> then\n    set [moved? v] to [800]\nend\nchange [moved? v] by (-1)\nCheck (username)\nif <(Moved?) < [1]> then\n    broadcast (You have been booted. v)\n    stop [all v]\nend\n\nwhen flag clicked\nbroadcast (Initialise  v) and wait\nGet Player Slot\nset [moved? v] to [600]\nif <not <(@PlayerSlot) > [0]>> then\n    set [full? v] to [True]\nend\nbroadcast (start v)\nforever\n    broadcast (Tick v) and wait\nend\n\ndefine Get Player Slot\nset [@playerslot v] to [0]\nbroadcast (Get Data v) and wait\nset [moved? v] to [0]\ndelete all of [check v]\nrepeat (10)\n    change [moved? v] by (1)\n    add (item (((Moved?) * (Cloud List Length)) - (1)) of [cloud list v]) to [check v]\nend\nwait (pick random (1.9) to (3.1)) seconds\nbroadcast (Get Data v) and wait\nset [moved? v] to [0]\nrepeat (10)\n    change [moved? v] by (1)\n    if <(item (Moved?) of [check v]) = (item (((Moved?) * (Cloud List Length)) - (1)) of [cloud list v])> then\n        set [@playerslot v] to (Moved?)\n        stop [this script v]\n    end\nend\n\nwhen I receive [turbo mode v]\ngo to [front v] layer\nclear graphic effects\nswitch costume to (turbo mode v)\nshow\nstop [all v]\n\nwhen I receive [start v]\nforever\n    Turbo mode detector\nend\n\ndefine Check (username)\nset [i v] to [0]\ndelete all of [other check v]\nrepeat (10)\n    change [i v] by (1)\n    if <<not <(i) = (@PlayerSlot)>> and <not <(item (i) of [active check v]) = [Off]>>> then\n        add (item ((i) * (4)) of [cloud list v]) to [other check v]\n    end\nend\nset [i v] to [0]\nrepeat (length of [other check v])\n    change [i v] by (1)\n    if <<(item (i) of [other check v]) = (username)> and <(@PlayerSlot) < (i)>> then\n        set [@playerslot v] to [0]\n    end\nend\n\nwhen [space v] key pressed\nset [full? v] to [True]\n\n@Thumbnail\n\nwhen I receive [initialise  v]\nclear graphic effects\nset size to (100) %\ngo to [front v] layer\nset [ghost v] effect to (100)\ngo to x: (0) y: (0)\n\ngo to x: (0) y: (0)\nshow\ngo to [front v] layer\n\n@Cloud\n\ndefine Decode (data)\ndelete all of [cloud list v]\nset [output v] to []\nset [i v] to [0]\nrepeat ((length of (data)) / (2))\n    change [i v] by (2)\n    switch costume to (join (letter ((I) - (1)) of (data)) (letter (I) of (data)))\n    if <(costume [name v]) = [~]> then\n        add (Output) to [cloud list v]\n        set [output v] to []\n    else\n        set [output v] to (join (Output) (costume [name v]))\n    end\nend\n\ndefine Encode\nset [output v] to []\nset [n v] to [0]\nrepeat (length of [my list v])\n    set [i v] to [0]\n    change [n v] by (1)\n    repeat (length of (item (n) of [my list v]))\n        change [i v] by (1)\n        switch costume to (letter (I) of (item (n) of [my list v]))\n        if <(costume [number v]) < [10]> then\n            set [output v] to (join (Output) (join [0] (costume [number v])))\n        else\n            set [output v] to (join (Output) (costume [number v]))\n        end\n    end\n    set [output v] to (join (Output) [53])\nend\n\ndefine Update Players List (id)\nif <(id) = [1]> then\n    set [player list v] to [0]\n    delete all of [check v]\n    repeat (10)\n        change [player list v] by (1)\n        add (item (((Player List) * (Cloud List Length)) - (1)) of [cloud list v]) to [check v]\n    end\nelse\n    if <(id) = [2]> then\n        set [player list v] to [0]\n        repeat (10)\n            change [player list v] by (1)\n            if <not <(@PlayerSlot) = (Player List)>> then\n                if <(item (Player List) of [check v]) = (item (((Player List) * (Cloud List Length)) - (1)) of [cloud list v])> then\n                    replace item (Player List) of [active check v] with [Off]\n                else\n                    replace item (Player List) of [active check v] with [On]\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [initialise  v]\ndelete all of [active check v]\nrepeat (10)\n    add [off] to [active check v]\nend\n\nwhen I receive [start v]\nforever\n    Update Players List [1]\n    wait (1) seconds\n    Update Players List [2]\nend\n\nwhen I receive [get data v]\nDecode Data\n\ndefine Save Data (id)\nEncode\nif <(id) = [1]> then\n    set [☁ p1 v] to (Output)\nelse\n    if <(id) = [2]> then\n        set [☁ p2 v] to (Output)\n    else\n        if <(id) = [3]> then\n            set [☁ p3 v] to (Output)\n        else\n            if <(id) = [4]> then\n                set [☁ p4 v] to (Output)\n            else\n                if <(id) = [5]> then\n                    set [☁ p5 v] to (Output)\n                else\n                    if <(id) = [6]> then\n                        set [☁ p6 v] to (Output)\n                    else\n                        if <(id) = [7]> then\n                            set [☁ p7 v] to (Output)\n                        else\n                            if <(id) = [8]> then\n                                set [☁ p8 v] to (Output)\n                            else\n                                if <(id) = [9]> then\n                                    set [☁ p9 v] to (Output)\n                                else\n                                    if <(id) = [10]> then\n                                        set [☁ p10 v] to (Output)\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [tick v]\nDecode Data\nSave Data (@PlayerSlot)\nDetermine Players\n\ndefine Decode Data\nDecode (join (☁ P1) (join (☁ P2) (join (☁ P3) (join (☁ P4) (join (☁ P5) (join (☁ P6) (join (☁ P7) (join (☁ P8) (join (☁ P9) (☁ P10))))))))))\n\ndefine Determine Players\nset [players v] to [1]\nset [i v] to [0]\nrepeat (10)\n    change [i v] by (1)\n    if <(item (I) of [active check v]) = [On]> then\n        change [players v] by (1)\n    end\nend\n\nwhen I receive [do thingy v]\nDecode Data\nUpdate Players List [1]\nwait (1) seconds\nDecode Data\nUpdate Players List [2]\n\n@Player\n\nchange x by (((x position) - ((item (((id) * (Cloud List Length)) - (3)) of [cloud list v]) - (ScrollX))) / (-5))\nchange y by (((y position) - (item (((id) * (Cloud List Length)) - (2)) of [cloud list v])) / (-5))\n\ndefine Touch Ground <up?>\nchange [falling? v] by (1)\nrepeat until <not <touching (level hitbox v)?>>\n    if <up?> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [falling? v] to [0]\n    end\n    set [speed y v] to [0]\nend\n\ndefine Walk (direction) (speed)\npoint in direction (direction)\nchange x by (speed)\nset [slope v] to [0]\nrepeat until <<(slope) = [8]> or <not <touching (level hitbox v)?>>>\n    change y by (1)\n    change [slope v] by (1)\nend\nif <(slope) = [8]> then\n    change x by ((0) - (speed))\n    change y by ((0) - (slope))\nend\nchange [frame v] by (0.5)\n\ndefine Set Costume\nif <(falling?) < [6]> then\n    if <(frame) = [0]> then\n        switch costume to (stand v)\n    else\n        switch costume to ([floor v] of ((4) + ((frame) mod (8))) )\n    end\nelse\n    if <(speed y) > [0]> then\n        switch costume to (jump_1 v)\n    else\n        switch costume to (fall_1 v)\n    end\nend\n\ndefine Griffpatch Platforming Engine (speed)\nswitch costume to (hitbox v)\nif <<(speed y) < [4]> or <<key (w v) pressed?> or <key (up arrow v) pressed?>>> then\n    change [speed y v] by (-1)\nelse\n    change [speed y v] by (-2)\nend\nchange y by (speed y)\nTouch Ground <(speed y) > [0]>\nif <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n    Walk (-90) ((speed) * (-1))\nelse\n    if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n        Walk (90) (speed)\n    else\n        set [frame v] to [0]\n    end\nend\nif <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n    if <<(jump key) = [0]> and <(falling?) < [3]>> then\n        start sound [jump v]\n        set [speed y v] to [14]\n        set [falling? v] to [6]\n        set [jump key v] to [1]\n    end\nelse\n    set [jump key v] to [0]\nend\nif <(y position) < [-180]> then\n    start sound [fall v]\n    go to x: (0) y: (0)\n    point in direction (90)\n    set [scrollx v] to [0]\n    set [speed y v] to [0]\nend\nSet Costume\nScrolling Blocks\n\ndefine Reset Player\nshow\nset size to (40) %\nset rotation style [left-right v]\npoint in direction (90)\ngo to x: (0) y: (100)\nset [speed y v] to [0]\nset [falling? v] to [10]\nset [scrollx v] to [0]\nhide\n\ndefine Scrolling Blocks\nchange [scrollx v] by (x position)\nset x to (0)\n\nwhen flag clicked\nhide\n\nwhen I receive [setup v]\nReset Player\n\ndefine Quick Scroll\nif <key (right arrow v) pressed?> then\n    change [scrollx v] by (100)\nend\nif <key (left arrow v) pressed?> then\n    change [scrollx v] by (-100)\nend\n\ndefine Movement (id)\nshow\nthink (username)\nSave My Data\nGriffpatch Platforming Engine [5]\n\ndefine Player (id)\nif <not <(id) = [11]>> then\n    if <(item (id) of [active check v]) = [Off]> then\n        hide\n    else\n        if <<(x position) > [237]> or <(x position) < [-237]>> then\n            hide\n        else\n            show\n        end\n        think (item (((id) * (Cloud List Length)) - (0)) of [cloud list v])\n        switch costume to (item (((id) * (Cloud List Length)) - (4)) of [cloud list v])\n        point in direction (item (((id) * (Cloud List Length)) - (5)) of [cloud list v])\n        go to x: ((item (((id) * (Cloud List Length)) - (3)) of [cloud list v]) - (ScrollX)) y: (item (((id) * (Cloud List Length)) - (2)) of [cloud list v])\n    end\nelse\n    hide\nend\n\ndefine Tick\nif <(Clone ID) = (@PlayerSlot)> then\n    Movement (Clone ID)\nelse\n    Player (Clone ID)\nend\nif <(Full?) = [True]> then\n    set [scrollx v] to (item (((1) * (Cloud List Length)) - (3)) of [cloud list v])\nend\n\nwhen I receive [tick v]\nTick\n\nwhen I receive [initialise  v]\nhide\nbroadcast (Transition In v) and wait\nbroadcast (Delete All Clones v) and wait\nbroadcast (SetUp v) and wait\nset [username v] to (username)\nset [clone id v] to [0]\nrepeat (11)\n    change [clone id v] by (1)\n    create clone of (_myself_ v)\nend\n\ndefine Save My Data\ndelete all of [my list v]\nadd (direction) to [my list v]\nadd (costume [number v]) to [my list v]\nadd (ScrollX) to [my list v]\nadd (y position) to [my list v]\nadd (pick random (9999) to (999999)) to [my list v]\nadd (username) to [my list v]\n\n@Level ART\n\ndefine Create\nFind Costume Number\nrepeat ((Level Costumes) - (1))\n    create clone of (_myself_ v)\n    change [level_x v] by (480)\n    next costume\nend\n\nwhen I receive [tick v]\nset x to ((Level_X) - (ScrollX))\nif <([abs v] of ((Level_X) - (ScrollX)) ) > [480]> then\n    hide\nelse\n    show\nend\n\nwhen I receive [setup v]\nshow\nclear graphic effects\ngo to x: (0) y: (0)\nset [level_x v] to [0]\nswitch costume to (costume1 v)\nCreate\nhide\n\ndefine Find Costume Number\nset [level costumes v] to [1]\nswitch costume to ((1) / (1))\nnext costume\nrepeat until <(costume [number v]) = [1]>\n    change [level costumes v] by (1)\n    next costume\nend\n\n@Level HITBOX\n\ndefine Create\nrepeat ((Level Costumes) - (1))\n    create clone of (_myself_ v)\n    change [level_x v] by (480)\n    next costume\nend\n\nwhen I receive [tick v]\nset x to ((Level_X) - (ScrollX))\nif <([abs v] of ((Level_X) - (ScrollX)) ) > [480]> then\n    hide\nelse\n    show\nend\n\nwhen I receive [setup v]\nshow\nclear graphic effects\ngo to x: (0) y: (0)\nset [level_x v] to [0]\nswitch costume to (costume1 v)\nCreate\nhide\n\ndefine Find Costume Number\nset [level costumes v] to [1]\nswitch costume to ((1) / (1))\nnext costume\nrepeat until <(costume [number v]) = [1]>\n    change [level costumes v] by (1)\n    next costume\nend\n\n@93e00483c9220575d8a5b2f074df5096\n\nwhen flag clicked\nhide\nhide\nforever\n    wait (0.1) seconds\n    next costume\nend\n\nwhen I receive [hearts v]\nshow\n\nwhen I receive [hide v]\nhide\n\n@8a28edf62619a72f6daf0817f3286f4f\n\n@ee9f051da737a23d2f0eb065a1c04597\n\n@93e00483c9220575d8a5b2f074df2\n\n@7eb4766553253e1923e7389e31c2a39d\n\n@Sprite1\n\n@Sprite2\n\n