The Meadow ↪ Cloud Multiplayer Scrolling Platformer
@Stage\n\nwhen [m v] key pressed\nshow variable [mouse v]\nset [mouse v] to (join ((mouse x) + (SCROLL X)) (join [,] ((mouse y) + (SCROLL Y))))\nwait (2) seconds\nhide variable [mouse v]\n\nwhen I receive [green flag v]\nswitch backdrop to (backdrop1 v)\n\nwhen I receive [play game v]\nswitch backdrop to (backdrop2 v)\n\nwhen flag clicked\nforever\n    play sound [bensound-memories v] until done\nend\n\n@Blank\n\n@Cloud\n\nwhen I receive [quick loop v]\nAdd Cloud Data\n\ndefine Add Cloud Data\ndelete all of [_cloud data v]\nadd (☁ P1) to [_cloud data v]\nadd (☁ P2) to [_cloud data v]\nadd (☁ P3) to [_cloud data v]\nadd (☁ P4) to [_cloud data v]\nadd (☁ P5) to [_cloud data v]\nadd (☁ P6) to [_cloud data v]\nadd (☁ P7) to [_cloud data v]\nadd (☁ P8) to [_cloud data v]\nadd (☁ P9) to [_cloud data v]\nadd (☁ P10) to [_cloud data v]\nBuild Username List\n\nwhen I receive [begin v]\nforever\n    set [_data ^ v] to (join (join [.] (join (round (([x v] of [player v]) + (2000))) (round (([y v] of [player v]) + (2000))))) (_MyUsername))\n    if <(_PlayerSlot) = [1]> then\n        set [☁ p1 v] to (_Data ^)\n    end\n    if <(_PlayerSlot) = [2]> then\n        set [☁ p2 v] to (_Data ^)\n    end\n    if <(_PlayerSlot) = [3]> then\n        set [☁ p3 v] to (_Data ^)\n    end\n    if <(_PlayerSlot) = [4]> then\n        set [☁ p4 v] to (_Data ^)\n    end\n    if <(_PlayerSlot) = [5]> then\n        set [☁ p5 v] to (_Data ^)\n    end\n    if <(_PlayerSlot) = [6]> then\n        set [☁ p6 v] to (_Data ^)\n    end\n    if <(_PlayerSlot) = [7]> then\n        set [☁ p7 v] to (_Data ^)\n    end\n    if <(_PlayerSlot) = [8]> then\n        set [☁ p8 v] to (_Data ^)\n    end\n    if <(_PlayerSlot) = [9]> then\n        set [☁ p9 v] to (_Data ^)\n    end\n    if <(_PlayerSlot) = [10]> then\n        set [☁ p10 v] to (_Data ^)\n    end\n    wait (0.1) seconds\nend\n\ndefine Build Username List\ndelete all of [_usernames v]\nset [_i v] to [0]\nrepeat (10)\n    change [_i v] by (1)\n    Letter [10] to (length of (item (_i) of [_cloud data v])) of (item (_i) of [_cloud data v])\n    set [_anscc v] to [1]\n    set [_temp v] to []\n    repeat ((length of (_ans)) / (2))\n        switch costume to (join (letter (_anscc) of (_ans)) (letter ((_anscc) + (1)) of (_ans)))\n        set [_temp v] to (join (_temp) (costume [name v]))\n        change [_anscc v] by (2)\n    end\n    if <(item (_i) of [_on/off v]) = [1]> then\n        add (_temp) to [_usernames v]\n    else\n        add [] to [_usernames v]\n    end\nend\n\ndefine Letter (1st) to (2nd) of (text)\nset [_ans v] to []\nset [_ansc v] to (1st)\nrepeat (((2nd) - (1st)) + (1))\n    set [_ans v] to (join (_ans) (letter (_ansc) of (text)))\n    change [_ansc v] by (1)\nend\n\ndefine Encode (username)\nset [_ansc v] to [1]\nset [_myusername v] to []\nrepeat (length of (username))\n    switch costume to (letter (_ansc) of (username))\n    set [_myusername v] to (join (_MyUsername) (costume [number v]))\n    change [_ansc v] by (1)\nend\n\nwhen flag clicked\nset [toggle usernames? v] to [1]\nEncode (username)\nforever\n    broadcast (Quick Loop v)\nend\n\nwhen I receive [begin v]\nforever\n    wait until <key (n v) pressed?>\n    if <(toggle usernames?) = [1]> then\n        set [toggle usernames? v] to [0]\n    else\n        set [toggle usernames? v] to [1]\n    end\n    wait until <not <key (n v) pressed?>>\nend\n\nwhen I receive [begin v]\nforever\n    set [kick? v] to (_Data ^)\n    wait (30) seconds\n    if <(kick?) = (_Data ^)> then\n        broadcast (Inactive v) and wait\n        stop [all v]\n    end\nend\n\n@Banners\n\nwhen flag clicked\nset size to (75) %\nset [__players v] to [1]\nJoining 1st\nswitch costume to (connecting v)\nshow\nset [ghost v] effect to (100)\ngo to x: (-50) y: (95)\nrepeat (25)\n    change y by (((45) - (y position)) / (5))\n    change [ghost v] effect by (-4)\nend\nwait (3) seconds\nJoining 2nd\nwait (1) seconds\nrepeat (10)\n    change y by (((95) - (y position)) / (20))\n    change [ghost v] effect by (10)\nend\n\ndefine Joining 1st\ndelete all of [_on/off v]\nrepeat (10)\n    add [0] to [_on/off v]\nend\nset [_playerslot v] to [null]\ndelete all of [_joining v]\nset [_i v] to [0]\nrepeat (10)\n    change [_i v] by (1)\n    add (item (_i) of [_cloud data v]) to [_joining v]\nend\n\ndefine Joining 2nd\nset [_i v] to [0]\nrepeat (10)\n    change [_i v] by (1)\n    if <(item (_i) of [_cloud data v]) = (item (_i) of [_joining v])> then\n        set [_playerslot v] to (_i)\n        switch costume to (connected v)\n        broadcast (Begin v)\n        stop [this script v]\n    end\nend\nset [_playerslot v] to [0]\nswitch costume to (full v)\n\ndefine Inactive 1st\ndelete all of [_joining v]\nset [_i v] to [0]\nrepeat (10)\n    change [_i v] by (1)\n    add (item (_i) of [_cloud data v]) to [_joining v]\nend\n\ndefine Inactive 2nd\nset [_i v] to [0]\nrepeat (10)\n    change [_i v] by (1)\n    if <(item (_i) of [_cloud data v]) = (item (_i) of [_joining v])> then\n        replace item (_i) of [_on/off v] with [0]\n    else\n        replace item (_i) of [_on/off v] with [1]\n    end\nend\nreplace item (_PlayerSlot) of [_on/off v] with [1]\nset [_i v] to [0]\nset [__players v] to [0]\nrepeat (10)\n    if <(item (_i) of [_on/off v]) = [1]> then\n        change [__players v] by (1)\n    end\n    change [_i v] by (1)\nend\nif <(item (1) of [_on/off v]) = [0]> then\n    set [☁ p1 v] to []\nend\nif <(item (2) of [_on/off v]) = [0]> then\n    set [☁ p2 v] to []\nend\nif <(item (3) of [_on/off v]) = [0]> then\n    set [☁ p3 v] to []\nend\nif <(item (4) of [_on/off v]) = [0]> then\n    set [☁ p4 v] to []\nend\nif <(item (5) of [_on/off v]) = [0]> then\n    set [☁ p5 v] to []\nend\nif <(item (6) of [_on/off v]) = [0]> then\n    set [☁ p6 v] to []\nend\nif <(item (7) of [_on/off v]) = [0]> then\n    set [☁ p7 v] to []\nend\nif <(item (8) of [_on/off v]) = [0]> then\n    set [☁ p8 v] to []\nend\nif <(item (9) of [_on/off v]) = [0]> then\n    set [☁ p9 v] to []\nend\nif <(item (10) of [_on/off v]) = [0]> then\n    set [☁ p10 v] to []\nend\n\nwhen I receive [begin v]\nreplace item (_PlayerSlot) of [_on/off v] with [1]\nforever\n    Inactive 1st\n    wait (6) seconds\n    Inactive 2nd\nend\n\nwhen I receive [inactive v]\nset size to (100) %\ngo to x: (0) y: (0)\nswitch costume to (kicked v)\nshow\nclear graphic effects\ngo to [front v] layer\nwait (3) seconds\nstop [all v]\n\n@Other Players\n\nwhen I receive [begin v]\nCloning\n\ndefine Cloning\nset [_clone id v] to [0]\nrepeat (10)\n    change [_clone id v] by (1)\n    if <not <(_clone id) = (_PlayerSlot)>> then\n        create clone of (_myself_ v)\n    end\nend\nset [_clone id v] to [P]\nhide\n\nwhen I receive [quick loop v]\nif <not <(_clone id) = [P]>> then\n    Decode (item (_clone id) of [_cloud data v])\nend\n\ndefine Decode (data)\nRead Values (data)\nPosition\n\ndefine Read Values (data)\nLetter [2] to [5] of (data)\nset [x v] to ((_ans) - (2000))\nLetter [6] to [9] of (data)\nset [y v] to ((_ans) - (2000))\nif <(toggle usernames?) = [1]> then\n    say (item (_clone id) of [_usernames v])\nelse\n    say []\nend\n\ndefine Position\nchange x by ((((x) - (SCROLL X)) - (x position)) / (3))\nchange y by ((((y) - (SCROLL Y)) - (y position)) / (3))\nset size to (65) %\nif <<<((x) - (SCROLL X)) < [-240]> or <((x) - (SCROLL X)) > [240]>> or <<((y) - (SCROLL Y)) > [180]> or <((y) - (SCROLL Y)) < [-180]>>> then\n    hide\nelse\n    if <(item (_clone id) of [_on/off v]) = [0]> then\n        hide\n    else\n        show\n    end\nend\n\ndefine Letter (1st) to (2nd) of (text)\nset [_ans v] to []\nset [_i v] to (1st)\nrepeat (((2nd) - (1st)) + (1))\n    set [_ans v] to (join (_ans) (letter (_i) of (text)))\n    change [_i v] by (1)\nend\n\n@Player\n\nwhen flag clicked\nbroadcast (Green Flag v) and wait\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [play game v]\nset [checkpoint v] to [0]\nset [_jump height v] to [16]\nset [_walk speed v] to [2]\nforever\n    broadcast (Reset v) and wait\n    broadcast (Setup v) and wait\n    Game On\n    repeat until <(EXIT) > []>\n        Tick\n        broadcast (Tick v)\n    end\n    if <(EXIT) = [Die]> then\n        Game - Die\n    else\n        repeat (50)\n            point towards (portal v)\n            turn right (65) degrees\n            move ((distance to [portal v]) / (2)) steps\n            change size by (-1)\n            change [ghost v] effect by (2)\n        end\n        broadcast (Win v)\n    end\nend\n\ndefine Game On\npoint in direction (90)\nif <(CHECKPOINT) = [0]> then\n    set [x v] to [-200]\n    set [y v] to [50]\nelse\n    set [x v] to (item (CHECKPOINT) of [cp x v])\n    set [y v] to (item (CHECKPOINT) of [cp y v])\nend\nset [sx v] to [0]\nset [sy v] to [0]\nset [in air v] to [0]\nset [exit v] to []\nset [scroll x v] to (x)\nset [scroll y v] to (y)\nset [frame v] to [0]\nset size to (65) %\nshow\nset [ghost v] effect to (0)\nswitch costume to (hitbox v)\n\ndefine Change Player y by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nPosition\nrepeat until <not <touching (platforms v)?>>\n    if <(sy) > [0]> then\n        change [y v] by (-1)\n    else\n        change [y v] by (1)\n        set [in air v] to [0]\n    end\n    Position\n    set [sy v] to [0]\nend\nPosition\nrepeat until <not <touching (underneath v)?>>\n    change [y v] by (1)\n    set [in air v] to [0]\n    Position\nend\nPosition\nrepeat until <not <touching (mv v)?>>\n    if <(sy) > [0]> then\n        change [y v] by (-1)\n    else\n        change [y v] by (1)\n        set [in air v] to [0]\n    end\n    Position\n    set [sy v] to [0]\nend\n\ndefine Position\ngo to x: ((x) - (SCROLL X)) y: ((y) - (SCROLL Y))\n\ndefine Change Player x by (sx)\nchange [x v] by (sx)\nPosition\nif <touching (platforms v)?> then\n    repeat (12)\n        change [y v] by (1)\n        Position\n        if <not <touching (platforms v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-12)\n    Position\n    repeat until <not <touching (platforms v)?>>\n        if <(sx) > [0]> then\n            change [x v] by (-1)\n        else\n            change [x v] by (1)\n        end\n        Position\n    end\nend\nPosition\nif <touching (mv v)?> then\n    repeat (12)\n        change [y v] by (1)\n        Position\n        if <not <touching (mv v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-12)\n    Position\n    repeat until <not <touching (mv v)?>>\n        if <(sx) > [0]> then\n            change [x v] by (-1)\n        else\n            change [x v] by (1)\n        end\n        Position\n    end\nend\n\nif <<key (up arrow v) pressed?> or <<mouse down?> and <((mouse y) - (y position)) > [50]>>> then\n    if <(sx) > [0]> then\n        set [sx v] to [-16]\n    else\n        set [sx v] to [16]\n    end\n    set [in air v] to [0]\nelse\n    set [sx v] to [0]\nend\n\ndefine Game - Die\nrepeat (4)\n    change [ghost v] effect by (25)\nend\nwait (0.75) seconds\nset [exit v] to []\n\ndefine Test - Collision\nif <touching (trampolines v)?> then\n    start sound [Big Boing v]\n    set [sy v] to [34]\n    broadcast (Bounce v)\nend\nif <<touching (danger v)?> or <<touching (spinning spikes v)?> or <touching (enemy v)?>>> then\n    start sound [explode_11 v]\n    set [exit v] to [Die]\nend\nif <touching (portal v)?> then\n    set [exit v] to [Win]\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Tick\nset rotation style [left-right v]\nif <<key (left arrow v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>> then\n    change [sx v] by ((_Walk Speed) * (-1))\nend\nif <<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>> then\n    change [sx v] by (_Walk Speed)\nend\nset [sx v] to ((sx) * (0.8))\nif <([abs v] of (sx) ) > [0.9]> then\n    Change Player x by (round (sx))\nend\nif <<key (up arrow v) pressed?> or <<mouse down?> and <((mouse y) - (y position)) > [50]>>> then\n    change [y v] by (10)\n    Position\n    if <(in air) < [4]> then\n        set [sy v] to (_Jump Height)\n    end\n    change [y v] by (-10)\nend\nif <(sy) > [-20]> then\n    change [sy v] by (-2)\nend\nChange Player y by (sy)\nPosition\nTest - Collision\nchange [scroll x v] by (round (((x) - (SCROLL X)) / (5)))\nchange [scroll y v] by (round (((y) - (SCROLL Y)) / (5)))\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\nend\nif <(SCROLL Y) < [0]> then\n    set [scroll y v] to [0]\nend\nPosition\nif <(y) < [-175]> then\n    set [exit v] to [Die]\nend\nswitch costume to (hitbox v)\n\ngo to (player v)\n\nwhen I receive [mv v]\nMv\n\ndefine Mv\nchange [y v] by (-2)\nPosition\nif <touching (mv v)?> then\n    change [x v] by (item (1) of [mv v])\nend\nchange [y v] by (2)\nPosition\n\nwhen [timer v] > (0.000001)\nhide\n\nset [x v] to [2745]\nset [y v] to [-25]\nset [scroll x v] to [2745]\nset [scroll y v] to [-25]\n\nwhen flag clicked\nwait until <key (l v) pressed?>\nwait until <key (o v) pressed?>\nwait until <key (l v) pressed?>\nwait until <(_Coins) > [24]>\nforever\n    set [fisheye v] effect to (([cos v] of (((days since 2000) * (100000)) * (100)) ) * (30))\nend\n\n@Platforms\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nswitch costume to (level 1 1 v)\nClone at x: [950] y: [0]\nClone at x: [1300] y: [0]\nClone at x: [300] y: [600]\nClone at x: [480] y: [0]\nClone at x: [480] y: [0]\nClone at x: [0] y: [-360]\nClone at x: [0] y: [-360]\nClone at x: [-480] y: [0]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nshow\n\nbroadcast (Reset v)\nbroadcast (Setup v)\n\n@Danger\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nswitch costume to (spike v)\nClone at x: [950] y: [0]\nClone at x: [1600] y: [600]\nClone at x: [960] y: [0]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nbroadcast (Reset v)\nbroadcast (Setup v)\n\n@Deco\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nswitch costume to (nothing v)\nClone at x: [950] y: [0]\nClone at x: [2080] y: [600]\nClone at x: [0] y: [-720]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\nset size to (65) %\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\n@Trampolines\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nswitch costume to (0 v)\nClone at x: [2046] y: [237]\nClone at x: [2406] y: [368]\nset [x v] to [-99999]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\n\nwhen I receive [bounce v]\nswitch costume to (-2 v)\nwait (0.03) seconds\nswitch costume to (-1 v)\nwait (0.03) seconds\nswitch costume to (0 v)\nwait (0.03) seconds\nswitch costume to (1 v)\nwait (0.03) seconds\nswitch costume to (2 v)\nwait (0.03) seconds\nswitch costume to (1 v)\nwait (0.03) seconds\nswitch costume to (0 v)\n\n@Mv\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nset [prev x v] to (x)\nset [x v] to ((ox) + (([cos v] of (((days since 2000) * (100000)) * (45)) ) * (150)))\nset [x diff v] to ((x) - (prev x))\nreplace item (clone) of [mv v] with (x diff)\nbroadcast (Mv v)\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nset [clone v] to [0]\ndelete all of [mv v]\nswitch costume to (mv v)\nClone at x: [1600] y: [0]\nset [x v] to [-9999999999]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\nset [ox v] to (x)\nchange [clone v] by (1)\nadd [] to [mv v]\ncreate clone of (_myself_ v)\n\n@Spinning Spikes\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nset size to (65) %\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nturn right (10) degrees\nif <(special) = [1]> then\n    set [x v] to ((ox) + (([cos v] of (((days since 2000) * (100000)) * (170)) ) * (150)))\nend\n\nwhen I receive [setup v]\nhide\npoint in direction (90)\nset [x v] to [0]\nset [y v] to [0]\nswitch costume to (collectable v)\nset [x v] to [-9999999999]\nClone at x: [3408] y: [-80] special: [1]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y) special: (special)\nset [ox v] to (x)\nset [x v] to (x)\nset [y v] to (y)\nset [special v] to (special)\ncreate clone of (_myself_ v)\n\nbroadcast (Reset v)\nbroadcast (Setup v)\n\n@Coins\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nset size to (65) %\ngo to [back v] layer\nset [y v] to ((oy) + (([cos v] of ((days since 2000) * ((100000) * (150))) ) * (5)))\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <touching (player v)?> then\n    start sound [Collect v]\n    change [_coins v] by (1)\n    delete this clone\nend\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nset [_coins v] to [0]\nswitch costume to (collectable v)\nClone at x: [-25] y: [110]\nClone at x: [-25] y: [70]\nClone at x: [295] y: [65]\nClone at x: [255] y: [65]\nClone at x: [215] y: [65]\nClone at x: [425] y: [150]\nClone at x: [910] y: [20]\nClone at x: [1020] y: [120]\nClone at x: [1150] y: [20]\nClone at x: [2195] y: [150]\nClone at x: [2565] y: [615]\nClone at x: [2720] y: [615]\nClone at x: [2760] y: [615]\nClone at x: [2915] y: [615]\nClone at x: [2955] y: [615]\nClone at x: [2995] y: [615]\nClone at x: [3035] y: [615]\nClone at x: [3075] y: [615]\nClone at x: [3115] y: [615]\nClone at x: [3155] y: [615]\nClone at x: [3195] y: [615]\nClone at x: [3235] y: [615]\nClone at x: [3275] y: [615]\nClone at x: [3725] y: [615]\nClone at x: [3765] y: [615]\nClone at x: [3875] y: [400]\nClone at x: [3728] y: [235]\nClone at x: [3875] y: [100]\nClone at x: [3728] y: [-50]\nset [x v] to [-9999999999]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\nset [oy v] to (y)\ncreate clone of (_myself_ v)\n\n@Checkpoints\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <touching (player v)?> then\n    if <not <(CHECKPOINT) = (clone)>> then\n        start sound [Coin v]\n        set [checkpoint v] to (clone)\n    end\n    switch costume to (1 v)\nend\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nset [clone v] to [0]\ndelete all of [cp x v]\ndelete all of [cp y v]\nset size to (50) %\nswitch costume to (9 v)\nClone at x: [2055] y: [30]\nClone at x: [3565] y: [620]\nset [x v] to [-9999999999]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\nchange [clone v] by (1)\nadd (x) to [cp x v]\nadd (y) to [cp y v]\ncreate clone of (_myself_ v)\n\n@TN\n\nwhen flag clicked\nshow\nforever\n    reset timer\n    set [ghost v] effect to (100)\n    go to [front v] layer\nend\n\nwhen flag clicked\nbroadcast (Play Game v)\n\n@Clouds\n\nwhen I start as a clone\nshow\nset [yv v] to [0]\nshow\nset size to (100) %\nset [ghost v] effect to (pick random (30) to (70))\nswitch costume to (pick random (1) to (3))\nshow\nshow\ngo to x: ((([x v] of [player v]) - (SCROLL X)) - (pick random (75) to (50))) y: ((([y v] of [player v]) - (SCROLL Y)) + (pick random (100) to (150)))\nchange [clones v] by (1)\nset [x v] to ((x position) + (SCROLL X))\nset [y v] to ((y position) + (SCROLL Y))\nset [cloud xv v] to (pick random (1) to (2))\nset [yv v] to [0]\nrepeat until <(x) > [1999]>\n    go to x: ((x) + ((0) - (SCROLL X))) y: ((y) + ((0) - (SCROLL Y)))\n    change [x v] by (cloud xv)\n    change [y v] by (Yv)\n    if <<<(x position) > [290]> or <(x position) < [-290]>> or <<(y position) > [180]> or <(y position) < [-180]>>> then\n        hide\n    else\n        show\n    end\nend\nchange [clones v] by (-1)\ndelete this clone\n\ndefine Clone (#)\nrepeat (#)\n    create clone of (_myself_ v)\nend\n\nwhen flag clicked\nset [clones v] to [0]\nwait (1) seconds\nClone [1]\nforever\n    wait (pick random (7) to (10)) seconds\n    Clone [1]\nend\n\nwhen flag clicked\nforever\n    go to [back v] layer\nend\n\nwhen flag clicked\nforever\nend\n\nset [old mouse x v] to (mouse x)\nset [old mouse y v] to (mouse y)\nset [keypressed? v] to <key (any v) pressed?>\nwait (6) seconds\nif <<<(mouse x) = (old mouse x)> and <(mouse y) = (old mouse y)>> and <(keypressed?) = [false]>> then\n    set [idle? v] to [true]\nelse\n    set [idle? v] to [false]\nend\n\n@Water\n\nwhen I receive [tick v]\nset [ghost v] effect to (60)\nerase all\nset [ghost v] effect to (100)\n\nWater at [0] [50]\nWater at [550] [75]\n\ndefine Water at (x) (y)\nswitch costume to (costume3 v)\nset size to (999999) %\nset x to ((x) - (SCROLL X))\nset [y v] to ((y) + (([sin v] of ((((days since 2000) * (100000)) + (1)) * (300)) ) * (8)))\nset y to ((y) - (SCROLL Y))\nswitch costume to (costume2 v)\nset size to (100) %\nstamp\nswitch costume to (costume3 v)\nset size to (999999) %\nset x to ((x) - (SCROLL X))\nset [y v] to ((y) + (([sin v] of ((((days since 2000) * (100000)) + (2)) * (300)) ) * (8)))\nset y to ((y) - (SCROLL Y))\nswitch costume to (costume2 v)\nset size to (100) %\nstamp\nswitch costume to (costume3 v)\nset size to (999999) %\nset x to ((x) - (SCROLL X))\nset [y v] to ((y) + (([sin v] of ((((days since 2000) * (100000)) + (3)) * (300)) ) * (8)))\nset y to ((y) - (SCROLL Y))\nswitch costume to (costume2 v)\nset size to (100) %\nstamp\n\n@Score Engine\n\nwhen flag clicked\nset [brightness v] effect to (100)\nshow\nset size to (200) %\ngo to x: (190) y: (150)\nset [i v] to [1]\nrepeat (2)\n    create clone of (_myself_ v)\n    change [i v] by (1)\n    change x by (25)\nend\nset [i v] to [0]\nswitch costume to (c v)\ngo to x: (160) y: (150)\nclear graphic effects\nset size to (65) %\n\nwhen I receive [tick v]\nif <(i) > [0]> then\n    switch costume to (letter (i) of (_Coins))\n    if <(length of (_Coins)) < (i)> then\n        hide\n    else\n        show\n    end\n    go [forward v] (1) layers\nend\nif <(length of (_Coins)) < [2]> then\n    set [_coins v] to (join [0] (_Coins))\nend\n\n@Enemy\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nset [x v] to ((ox) + (([cos v] of (((days since 2000) * (100000)) * (30)) ) * (150)))\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset size to (65) %\nset [x v] to [0]\nset [y v] to [0]\nset [clone v] to [0]\nswitch costume to (mv v)\nClone at x: [3075] y: [609]\nset [x v] to [-9999999999]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\nset [x v] to (x)\nset [y v] to (y)\nset [ox v] to (x)\nchange [clone v] by (1)\ncreate clone of (_myself_ v)\n\n@Trail\n\nwhen flag clicked\nhide\nforever\n    if <mouse down?> then\n        clone (pick random (7) to (11))\n    end\nend\n\ndefine clone (#)\nrepeat (#)\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\npoint in direction (90)\nset [ghost v] effect to (50)\nset size to (65) %\nshow\ngo to x: (mouse x) y: (mouse y)\nset rotation style [all around v]\nrepeat (25)\n    turn right (14.4) degrees\n    change [ghost v] effect by (2)\n    change size by (-2)\nend\nhide\ndelete this clone\n\nwhen I start as a clone\nglide (10) secs to (random position v)\n\n@Shop\n\nwhen flag clicked\n\nCloning\nset size to (100) %\nswitch costume to (button v)\ngo to x: (165) y: (-135)\nset [_shop v] to [0]\nforever\n    if <touching (mouse-pointer v)?> then\n        change size by (((115) - (size)) / (4))\n        set [brightness v] effect to (10)\n    end\n    if <not <touching (mouse-pointer v)?>> then\n        change size by (((100) - (size)) / (4))\n        clear graphic effects\n    end\nend\n\ndefine Cloning\nset [clone id v] to [1]\nrepeat (3)\n    create clone of (_myself_ v)\n    change [clone id v] by (1)\nend\n\nwhen I start as a clone\nif <(clone id) = [1]> then\n    set size to (100) %\n    switch costume to (bg v)\n    go to x: (0) y: (0)\n    forever\n        if <(_Shop) = [1]> then\n            show\n        else\n            hide\n        end\n    end\nend\nif <<(clone id) = [2]> or <(clone id) = [3]>> then\n    set size to (100) %\n    switch costume to ((clone id) + (1))\n    go to x: (-77) y: ((-14) - ((35) * ((clone id) - (2))))\n    forever\n        if <(_Shop) = [1]> then\n            show\n        else\n            hide\n        end\n        if <touching (mouse-pointer v)?> then\n            change size by (((110) - (size)) / (3))\n            set [brightness v] effect to (10)\n            if <<mouse down?> and <not <(costume [name v]) = [/]>>> then\n                if <((_Coins) + (1)) > (item ((clone id) - (1)) of [shop v])> then\n                    change [_coins v] by ((item ((clone id) - (1)) of [shop v]) * (-1))\n                    if <(clone id) = [2]> then\n                        set [_jump height v] to [25]\n                    end\n                    if <(clone id) = [3]> then\n                        set [_walk speed v] to [4]\n                    end\n                    switch costume to (/ v)\n                end\n            end\n        end\n        if <not <touching (mouse-pointer v)?>> then\n            change size by (((100) - (size)) / (3))\n            clear graphic effects\n        end\n    end\nend\n\nwhen flag clicked\n\nforever\n    wait until <<touching (mouse-pointer v)?> and <mouse down?>>\n    if <(_Shop) = [0]> then\n        set [_shop v] to [1]\n    else\n        set [_shop v] to [0]\n    end\n    wait until <not <<touching (mouse-pointer v)?> and <mouse down?>>>\nend\n\n@Portal\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nturn right (15) degrees\n\nwhen I receive [setup v]\nhide\nset [x v] to [2745]\nset [y v] to [0]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\n@Win\n\nwhen flag clicked\nshow\nset [ghost v] effect to (100)\n\nwhen I receive [win v]\ngo to [front v] layer\nclear graphic effects\nwait (3) seconds\nstop [all v]\n\n@Text\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nswitch costume to (level 1 1 v)\nClone at x: [950] y: [0]\nClone at x: [1300] y: [0]\nClone at x: [300] y: [600]\nClone at x: [480] y: [0]\nClone at x: [480] y: [0]\nClone at x: [0] y: [-360]\nClone at x: [0] y: [-360]\nClone at x: [-480] y: [0]\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at x: (x) y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nshow\n\nbroadcast (Reset v)\nbroadcast (Setup v)\n\n