Out in the Blue - A Cloud Scrolling Platformer
@Stage\n\nwhen flag clicked\nforever\n    play sound [Demons - Imagine Dragons \(128 kbps\) v] until done\n    play sound [Imagine Dragons - Believer \(Lyrics\) \(128 kbps\) v] until done\n    play sound [Imagine Dragons - Natural \(Lyrics\) \(128 kbps\) v] until done\nend\n\n@reduce lag :P\n\n@Thumbnail\n\nwhen flag clicked\nbroadcast (GAME ON v)\nset [ghost v] effect to (100)\n\ndefine THUMB STUFF WITH LESS LAG?\ngo to [front v] layer\n\nwhen I receive [scroll v]\nTHUMB STUFF WITH LESS LAG?\n\n@P - Cloud\n\ndefine WRITE (value) TO ENCODED\nset [letter # v] to [1]\nrepeat (length of (value))\n    set [encoded v] to (join (ENCODED) (item # of (letter (LETTER #) of (value)) in [stuff v]))\n    change [letter # v] by (1)\nend\nset [encoded v] to (join (ENCODED) [00])\n\nwhen I receive [begin v]\nRESET\nforever\n    TICK\nend\n\ndefine SET CLOUD # (player) TO (value)\nif <(player) = [1]> then\n    set [☁ |p1| v] to (value)\nelse\n    if <(player) = [2]> then\n        set [☁ |p2| v] to (value)\n    else\n        if <(player) = [3]> then\n            set [☁ |p3| v] to (value)\n        else\n            if <(player) = [4]> then\n                set [☁ |p4| v] to (value)\n            else\n                if <(player) = [5]> then\n                    set [☁ |p5| v] to (value)\n                else\n                    if <(player) = [6]> then\n                        set [☁ |p6| v] to (value)\n                    else\n                        if <(player) = [7]> then\n                            set [☁ |p7| v] to (value)\n                        else\n                            if <(player) = [8]> then\n                                set [☁ |p8| v] to (value)\n                            else\n                                set [☁ |p9| v] to (value)\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine SEND CLOUD DATA\nif <[1] > (MY PLAYER #)> then\n    stop [this script v]\nend\nadd (X) to [buffer v]\nadd (Y) to [buffer v]\nchange [cloud timer v] by (1)\nif <(CLOUD TIMER) < [3]> then\n    stop [this script v]\nend\nset [cloud timer v] to [0]\nset [encoded v] to []\nif <(|CHAT|) = []> then\n    WRITE (username) TO ENCODED\nelse\n    WRITE (|CHAT|) TO ENCODED\nend\nWRITE (round (timer)) TO ENCODED\nWRITE ([direction v] of [p - scrolling v]) TO ENCODED\nWRITE (END) TO ENCODED\nWRITE ([costume # v] of [p - scrolling v]) TO ENCODED\nrepeat (length of [buffer v])\n    WRITE (item (1) of [buffer v]) TO ENCODED\n    delete (1) of [buffer v]\nend\nSET CLOUD # (MY PLAYER #) TO (ENCODED)\n\ndefine TICK\nSEND CLOUD DATA\n\nwhen I receive [game on v]\nsay []\nset [max players v] to [10]\nset [my player # v] to [0]\nshow list [|chat| v]\ndelete all of [buffer v]\nbroadcast (SETUP - OPPONENTS v) and wait\nswitch backdrop to (joining v)\nbroadcast (JOIN GAME v) and wait\nif <(MY PLAYER #) > [0]> then\n    broadcast (BEGIN v)\n    hide\nelse\n    stop [all v]\nend\n\ndefine RESET\npoint in direction (90)\ngo to x: (0) y: (0)\nset [|chat| v] to []\nset [|chat on| v] to [OFF]\nset [#offline# v] to [0]\n\nwhen I receive [begin v]\nforever\n    if <(|CHAT ON|) = [ON]> then\n        set [controls v] to [OFF]\n    else\n        set [controls v] to [ON]\n    end\nend\n\nwhen I receive [end screen v]\nset [#offline# v] to [0]\n\n@P - Scrolling\n\ndefine RESET\nset [yv v] to [0]\nset [xv v] to [0]\nset [x v] to (P - SPAWNX)\nset [y v] to (P - SPAWNY)\nset [scroll x v] to (P - SPAWNX)\nset [scroll y v] to (P - SPAWNY)\nset [can jump? v] to [0]\nset [end v] to []\nset size to (110) %\nset [ghost v] effect to (0)\nCOSTUME (username)\nset rotation style [left-right v]\npoint in direction (90)\ngo to x: (0) y: (0)\nbroadcast (reset v)\nbroadcast (set up v)\nset [end v] to []\nshow\nbroadcast (Scroll v)\n\ndefine TICK\ngo to [back v] layer\nif <(CONTROLS) = [ON]> then\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n        change [xv v] by (2)\n        point in direction (90)\n    end\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n        change [xv v] by (-2)\n        point in direction (-90)\n    end\nend\nset [xv v] to ((Xv) * (0.8))\nCHANGE X BY (round (Xv))\nif <(Yv) > [-15]> then\n    change [yv v] by (-1)\nend\nLADDER\nif <(CAN FLY?) = [1]> then\n    if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(y position) < ((mouse y) + (-10))>>>> then\n        set [yv v] to [7]\n    end\nend\nCHANGE Y BY (Yv)\nchange [scroll x v] by (((X) - (SCROLL X)) / (4))\nchange [scroll y v] by (((Y) - (SCROLL Y)) / (4))\nTEST - WIN\nTEST - DIE\nMAX CAMS\n\ndefine CHANGE Y BY (sy)\nchange [y v] by (sy)\nPOSITION\nrepeat until <not <touching (level v)?>>\n    if <[0] < (sy)> then\n        set [can jump? v] to [0]\n        change [y v] by (-1)\n    else\n        set [can jump? v] to [1]\n        change [y v] by (1)\n    end\n    POSITION\n    set [yv v] to [0]\n    if <<(CAN JUMP?) = [1]> and <(CONTROLS) = [ON]>> then\n        if <(CAN FLY?) = [0]> then\n            if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(y position) < ((mouse y) + (-10))>>>> then\n                set [yv v] to [14]\n            end\n        end\n    end\nend\nchange [scroll y v] by (((Y) - (SCROLL Y)) / (5))\n\ndefine CHANGE X BY (sx)\nchange [x v] by (sx)\nPOSITION\nif <touching (level v)?> then\n    repeat (8)\n        if <touching (level v)?> then\n            change [y v] by (1)\n            POSITION\n        end\n    end\n    if <touching (level v)?> then\n        change [y v] by (-8)\n        repeat until <not <touching (level v)?>>\n            if <[0] < (sx)> then\n                change [x v] by (-1)\n            else\n                change [x v] by (1)\n            end\n            POSITION\n            set [xv v] to [0]\n        end\n    end\nend\n\ndefine POSITION\ngo to x: ((X) - (SCROLL X)) y: ((Y) - (SCROLL Y))\n\nwhen I receive [portal v]\nset [keep playing? v] to [0]\nrepeat until <(KEEP PLAYING?) = [1]>\n    broadcast (END SCREEN v)\nend\nwait (0.1) seconds\nset [keep playing? v] to [4]\n\nwhen I receive [death v]\nshow\nset [yv v] to [20]\nrepeat (50)\n    go to [front v] layer\n    change size by (2)\n    turn right (20) degrees\n    change [ghost v] effect by (2)\n    change [yv v] by (-1)\n    change [y v] by (Yv)\n    POSITION\nend\n\nwhen I receive [begin v]\nhide\nCOSTUME (username)\nset [level v] to [1]\nset rotation style [left-right v]\nforever\n    RESET\n    repeat until <[] < (END)>\n        TICK\n        broadcast (Scroll v)\n        say (item (|CHAT|) of [|chat| v])\n    end\n    set rotation style [all around v]\n    if <(END) = [WIN]> then\n        broadcast (PORTAL v) and wait\n    else\n        broadcast (DEATH v) and wait\n    end\nend\n\nwhen flag clicked\nhide\nset [p - spawnx v] to [0]\nset [p - spawny v] to [0]\n\ndefine TEST - DIE\nif <(Y) < [-250]> then\n    set [end v] to [DIE]\nend\nif <touching (lava v)?> then\n    set [end v] to [DIE]\nend\nif <touching (spikes v)?> then\n    set [end v] to [DIE]\nend\nif <touching (saw's v)?> then\n    set [end v] to [DIE]\nend\n\ndefine TEST - WIN\nif <<touching (finish v)?> and <(KEEP PLAYING?) = [5]>> then\n    set [end v] to [WIN]\nend\n\nwhen flag clicked\nset [keep playing? v] to [5]\n\ndefine COSTUME (username)\nif <(username) = [codingcindy_0712]> then\n    switch costume to (special 1 v)\nelse\n    if <(username) = [WG_GWC42]> then\n        switch costume to (special 2 v)\n    else\n        if <(username) = [C369J]> then\n            switch costume to (special 3 v)\n        else\n            switch costume to (normal v)\n        end\n    end\nend\n\ndefine MAX CAMS\nif <(SCROLL X) < [150]> then\n    set [scroll x v] to [150]\nend\nif <[3600] < (SCROLL X)> then\n    set [scroll x v] to [3600]\nend\nif <[-40] > (SCROLL Y)> then\n    set [scroll y v] to [-40]\nend\nif <[-70] > (X)> then\n    set [x v] to [-70]\nend\nif <(X) > [3820]> then\n    set [x v] to [3820]\nend\n\ndefine LADDER\nif <touching (ladder v)?> then\n    set [yv v] to [0]\n    if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(y position) < ((mouse y) + (-10))>>>> then\n        set [yv v] to [7]\n    end\n    if <<key (down arrow v) pressed?> or <<key (s v) pressed?> or <<mouse down?> and <((mouse y) + (10)) < (y position)>>>> then\n        set [yv v] to [-7]\n    end\nend\n\n@Opponents\n\ndefine BEGIN DECODE OF (encoded)\nset [encoded v] to (encoded)\nset [letter # v] to [1]\n\ndefine VALUE = READ FROM ENCODED\nset [value v] to []\nforever\n    set [idx v] to (join (letter (LETTER #) of (ENCODED)) (letter ((LETTER #) + (1)) of (ENCODED)))\n    change [letter # v] by (2)\n    if <(IDX) < [1]> then\n        stop [this script v]\n    end\n    set [value v] to (join (VALUE) (item (IDX) of [stuff v]))\nend\n\ndefine SETUP PLAYERS\nset [offline v] to [0]\ndelete all of [buffer v]\nset [color v] effect to (120)\nhide\nset [offline v] to [100]\nset [player # v] to [1]\nrepeat ((MAX PLAYERS) - (1))\n    create clone of (_myself_ v)\n    change [player # v] by (1)\nend\n\nwhen I receive [begin v]\nforever\n    if <(MY PLAYER #) = (PLAYER #)> then\n        set [offline v] to [100]\n        hide\n    else\n        TICK\n    end\nend\n\ndefine VALUE = CLOUD # (player)\nif <(player) = [1]> then\n    set [value v] to (☁ |P1|)\nelse\n    if <(player) = [2]> then\n        set [value v] to (☁ |P2|)\n    else\n        if <(player) = [3]> then\n            set [value v] to (☁ |P3|)\n        else\n            if <(player) = [4]> then\n                set [value v] to (☁ |P4|)\n            else\n                if <(player) = [5]> then\n                    set [value v] to (☁ |P5|)\n                else\n                    if <(player) = [6]> then\n                        set [value v] to (☁ |P6|)\n                    else\n                        if <(player) = [7]> then\n                            set [value v] to (☁ |P7|)\n                        else\n                            if <(player) = [8]> then\n                                set [value v] to (☁ |P8|)\n                            else\n                                set [value v] to (☁ |P9|)\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [setup - opponents v]\nSETUP PLAYERS\n\ndefine TICK\nVALUE = CLOUD # (PLAYER #)\nif <(join [A] (VALUE)) = (VALUE PRE.)> then\n    change [offline v] by (1)\n    if <[200] < (OFFLINE)> then\n        hide\n        set [offline v] to [100]\n    end\nelse\n    set [value pre. v] to (join [A] (VALUE))\n    show\n    set [offline v] to [0]\n    BEGIN DECODE OF (VALUE)\n    VALUE = READ FROM ENCODED\n    if <(length of (VALUE)) < [3]> then\n        say (item (VALUE) of [|chat| v])\n    else\n        say (VALUE)\n    end\n    VALUE = READ FROM ENCODED\n    VALUE = READ FROM ENCODED\n    point in direction (VALUE)\n    VALUE = READ FROM ENCODED\n    if <(VALUE) = [DIE]> then\n        set rotation style [all around v]\n    else\n        set rotation style [left-right v]\n    end\n    VALUE = READ FROM ENCODED\n    switch costume to (VALUE)\n    VALUE = READ FROM ENCODED\n    repeat until <(VALUE) = []>\n        add (VALUE) to [buffer v]\n        VALUE = READ FROM ENCODED\n    end\nend\nif <(length of [buffer v]) > [0]> then\n    set [xpos v] to (item (1) of [buffer v])\n    delete (1) of [buffer v]\n    set [ypos v] to (item (1) of [buffer v])\n    delete (1) of [buffer v]\nend\n\nwhen I receive [join game v]\nVALUE = CLOUD # (PLAYER #)\nset [value pre. v] to (join [A] (VALUE))\n\ndefine POSITION (x) (y)\nset size to (110) %\nset [color v] effect to (0)\ngo to x: (round (x)) y: (round (y))\nif <(OFFLINE) < [100]> then\n    if <<(round (x)) = (round (x position))> and <(round (y)) = (round (y position))>> then\n        show\n    else\n        hide\n    end\nelse\n    hide\nend\n\nwhen I receive [try to join v]\nVALUE = CLOUD # (PLAYER #)\nif <(join [A] (VALUE)) = (VALUE PRE.)> then\n    set [my player # v] to (PLAYER #)\nend\n\nwhen I receive [scroll v]\nPOSITION ((XPOS) - (SCROLL X)) ((YPOS) - (SCROLL Y))\n\ndefine TICK\nPOSITION ((XPOS) - (SCROLL X)) ((YPOS) - (SCROLL Y))\n\nwhen I receive [begin v]\nforever\n    if <not <(MY PLAYER #) = (PLAYER #)>> then\n        TICK\n    end\nend\n\n@Level\n\nwhen I receive [scroll v]\nPOSITION: ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [reset v]\nhide\ndelete this clone\n\nwhen I receive [set up v]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (1 v)\n    CLONE AT X: [0] Y: [0]\n    CLONE AT X: [430] Y: [0]\n    CLONE AT X: [850] Y: [-20]\n    CLONE AT X: [1200] Y: [50]\n    CLONE AT X: [1800] Y: [90]\n    CLONE AT X: [2400] Y: [220]\n    CLONE AT X: [2400] Y: [220]\n    CLONE AT X: [2830] Y: [220]\n    CLONE AT X: [3100] Y: [220]\n    CLONE AT X: [3450] Y: [220]\n    CLONE AT X: [3600] Y: [700]\n    CLONE AT X: [3100] Y: [700]\n    CLONE AT X: [3000] Y: [1050]\n    CLONE AT X: [2800] Y: [1050]\n    CLONE AT X: [3050] Y: [1050]\n    CLONE AT X: [3600] Y: [1300]\n    CLONE AT X: [3400] Y: [1700]\n    CLONE AT X: [3000] Y: [1700]\n    CLONE AT X: [2000] Y: [2000]\nend\nswitch costume to ( v)\n\ndefine CLONE AT X: (x) Y: (y)\nset [x v] to (x)\nset [y v] to (y)\ngo to [back v] layer\ncreate clone of (_myself_ v)\nnext costume\n\ndefine POSITION: (x) (y)\nclear graphic effects\ngo to x: (round (x)) y: (round (y))\nif <<(round (x)) = (round (x position))> and <(round (y)) = (round (y position))>> then\n    show\nelse\n    hide\nend\nif <(costume [number v]) = [16]> then\n    go to [back v] layer\nend\nif <(costume [number v]) = [19]> then\n    go to [back v] layer\nend\n\nwhen flag clicked\nswitch costume to ( v)\n\nCLONE AT X: [2485] Y: [220]\n\nwhen I start as a clone\ngo to [front v] layer\n\nCLONE AT X: [3600] Y: [700]\nCLONE AT X: [3100] Y: [700]\nCLONE AT X: [3000] Y: [1050]\nCLONE AT X: [2800] Y: [1050]\n\n@Ladder\n\nwhen flag clicked\nhide\n\nwhen I receive [reset v]\nhide\ndelete this clone\n\nwhen I receive [set up v]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (1 v)\n    CLONE AT X: [3600] Y: [300]\n    CLONE AT X: [3900] Y: [500]\n    CLONE AT X: [3000] Y: [800]\n    CLONE AT X: [3750] Y: [1408]\n    CLONE AT X: [2400] Y: [2054]\nend\nswitch costume to ( v)\n\ndefine CLONE AT X: (x) Y: (y)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\nnext costume\n\ndefine POSITION: (x) (y)\ngo to x: (round (x)) y: (round (y))\nif <<(round (x)) = (round (x position))> and <(round (y)) = (round (y position))>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [scroll v]\nPOSITION: ((x) - (SCROLL X)) ((y) - (SCROLL Y))\ngo to [back v] layer\n\n@Front Scenery\n\nwhen I receive [scroll v]\nPOSITION: ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [reset v]\nhide\ndelete this clone\n\nwhen I receive [set up v]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (1 v)\n    CLONE AT X: [0] Y: [0]\n    CLONE AT X: [430] Y: [0]\n    CLONE AT X: [850] Y: [-20]\n    CLONE AT X: [1200] Y: [50]\n    CLONE AT X: [1800] Y: [90]\n    CLONE AT X: [2400] Y: [220]\n    CLONE AT X: [2400] Y: [220]\n    CLONE AT X: [2830] Y: [220]\n    CLONE AT X: [3100] Y: [220]\n    CLONE AT X: [3600] Y: [700]\n    CLONE AT X: [3100] Y: [700]\n    CLONE AT X: [3000] Y: [1050]\n    CLONE AT X: [2800] Y: [1050]\n    CLONE AT X: [3600] Y: [1300]\nend\nswitch costume to ( v)\n\ndefine CLONE AT X: (x) Y: (y)\nset [x v] to (x)\nset [y v] to (y)\ngo to [back v] layer\ncreate clone of (_myself_ v)\nnext costume\n\ndefine POSITION: (x) (y)\nif <<(|CHAT ON|) = [OFF]> and <<(KEEP PLAYING?) = [4]> or <(KEEP PLAYING?) = [5]>>> then\n    go to [front v] layer\n    go [backward v] (4) layers\nelse\n    go to [back v] layer\n    go [forward v] (5) layers\nend\ngo to x: (round (x)) y: (round (y))\nif <<(round (x)) = (round (x position))> and <(round (y)) = (round (y position))>> then\n    show\nelse\n    hide\nend\n\nwhen flag clicked\nswitch costume to ( v)\n\nwhen I receive [portal v]\nhide\nwait until <(KEEP PLAYING?) = [1]>\nshow\n\n@Back Scenery\n\nwhen I receive [scroll v]\ngo to [back v] layer\nPOSITION: ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\nwhen I receive [reset v]\nhide\ndelete this clone\n\nwhen I receive [set up v]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (1 v)\n    CLONE AT X: [0] Y: [0]\n    CLONE AT X: [430] Y: [0]\n    CLONE AT X: [850] Y: [-20]\n    CLONE AT X: [1200] Y: [50]\n    CLONE AT X: [1800] Y: [90]\n    CLONE AT X: [2400] Y: [220]\n    CLONE AT X: [2700] Y: [770]\n    CLONE AT X: [3200] Y: [200]\n    CLONE AT X: [3400] Y: [777]\nend\nswitch costume to ( v)\n\ndefine CLONE AT X: (x) Y: (y)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\nnext costume\n\ndefine POSITION: (x) (y)\ngo to x: (round (x)) y: (round (y))\nif <<(round (x)) = (round (x position))> and <(round (y)) = (round (y position))>> then\n    show\nelse\n    hide\nend\ngo to [back v] layer\n\nwhen flag clicked\nswitch costume to ( v)\n\n@Spikes\n\nwhen I receive [set up v]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (1 v)\n    CLONE AT X: [3603] Y: [777]\n    CLONE AT X: [2800] Y: [1050]\n    CLONE AT X: [3320] Y: [1914]\nend\nswitch costume to ( v)\n\ndefine CLONE AT X: (x) Y: (y)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\nnext costume\n\nwhen I receive [reset v]\nhide\ndelete this clone\n\nwhen I receive [scroll v]\nPOSITION: ((x) - (SCROLL X)) ((y) - (SCROLL Y))\ngo to [back v] layer\ngo [forward v] (1) layers\n\ndefine POSITION: (x) (y)\ngo to x: (round (x)) y: (round (y))\nif <<(round (x)) = (round (x position))> and <(round (y)) = (round (y position))>> then\n    show\nelse\n    hide\nend\n\nwhen flag clicked\nswitch costume to ( v)\n\n@Lava\n\nwhen I receive [scroll v]\ngo to [back v] layer\nPOSITION: ((x) - (SCROLL X)) (((([sin v] of ((MOVE) * (100)) ) * (15)) + (y)) - (SCROLL Y))\n\nwhen I receive [reset v]\nhide\ndelete this clone\n\nwhen I receive [set up v]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (1 v)\nend\nswitch costume to ( v)\n\ndefine CLONE AT X: (x) Y: (y)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\nnext costume\n\ndefine POSITION: (x) (y)\ngo to x: (round (x)) y: (round (y))\nif <<(round (x)) = (round (x position))> and <(round (y)) = (round (y position))>> then\n    show\nelse\n    hide\nend\n\n@Saw's\n\ndefine POSITION: (x) (y)\ngo to x: (round (x)) y: (round (y))\nif <<(round (x)) = (round (x position))> and <(round (y)) = (round (y position))>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [set up v]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (1 v)\n    CLONE AT X: [2525] Y: [220] TYPE: [UD] RANGE: [90] SPEED: [90]\n    CLONE AT X: [2805] Y: [1052] TYPE: [LR] RANGE: [110] SPEED: [100]\n    CLONE AT X: [2190] Y: [2110] TYPE: [LR] RANGE: [200] SPEED: [70]\nend\nswitch costume to ( v)\n\nwhen I receive [reset v]\nhide\ndelete this clone\n\nwhen I receive [scroll v]\ngo to [back v] layer\nif <(TYPE) = [LR]> then\n    POSITION: (((([sin v] of ((MOVE) * (SPEED)) ) * (RANGE)) + (x)) - (SCROLL X)) ((y) - (SCROLL Y))\nelse\n    POSITION: ((x) - (SCROLL X)) (((([sin v] of ((MOVE) * (SPEED)) ) * (RANGE)) + (y)) - (SCROLL Y))\nend\nturn right (([sin v] of ((MOVE) * (100)) ) * (13)) degrees\n\ndefine CLONE AT X: (x) Y: (y) TYPE: (type) RANGE: (range) SPEED: (speed)\nset [type v] to (type)\nset [x v] to (x)\nset [y v] to (y)\nset [range v] to (range)\nset [speed v] to (speed)\ncreate clone of (_myself_ v)\n\nwhen flag clicked\nset [move v] to [0]\nforever\n    change [move v] by (0.06)\nend\n\nwhen flag clicked\nhide\n\n@Coins\n\nwhen I receive [set up v]\nset [x v] to [0]\nset [y v] to [0]\nset [*coins collected* v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (costume1 v)\n    set [# v] to [1]\n    if <(item (1) of [saved coins collected v]) = [0]> then\n        CLONE AT X: [2520] Y: [530]\n    end\n    change [# v] by (1)\n    if <(item (2) of [saved coins collected v]) = [0]> then\n        CLONE AT X: [2520] Y: [250]\n    end\n    change [# v] by (1)\n    if <(item (3) of [saved coins collected v]) = [0]> then\n        CLONE AT X: [2800] Y: [1860]\n    end\nend\nset [# v] to [0]\nset [x v] to [-300]\n\nwhen I receive [reset v]\nhide\ndelete this clone\n\ndefine POSITION: (x) (y)\ngo to x: (round (x)) y: (round (y))\nif <<(round (x)) = (round (x position))> and <(round (y)) = (round (y position))>> then\n    show\nelse\n    hide\nend\nnext costume\nclear graphic effects\nif <touching (p - scrolling v)?> then\n    change [*coins collected* v] by (1)\n    replace item (#) of [coins collected v] with [1]\n    delete this clone\nend\n\nwhen I receive [scroll v]\ngo to [front v] layer\nPOSITION: ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\ndefine CLONE AT X: (x) Y: (y)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\nnext costume\n\nwhen flag clicked\nhide\ndelete all of [saved coins collected v]\nrepeat (3)\n    add [0] to [saved coins collected v]\nend\n\nwhen I receive [set up v]\ndelete all of [coins collected v]\nadd (item (1) of [saved coins collected v]) to [coins collected v]\nadd (item (2) of [saved coins collected v]) to [coins collected v]\nadd (item (3) of [saved coins collected v]) to [coins collected v]\n\n@Finish\n\nwhen I receive [scroll v]\nPOSITION: ((x) - (SCROLL X)) ((y) - (SCROLL Y))\n\ndefine POSITION: (x) (y)\ngo to [back v] layer\ngo to x: (round (x)) y: (round (y))\nif <<(round (x)) = (round (x position))> and <(round (y)) = (round (y position))>> then\n    show\nelse\n    hide\nend\nif <touching (p - scrolling v)?> then\n    if <(*COINS COLLECTED*) = [3]> then\n        set [can fly? v] to [1]\n    end\nend\n\nwhen I receive [set up v]\nshow\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (1 v)\n    GO TO X: [1646] Y: [2140]\nend\nswitch costume to (blank v)\n\ndefine GO TO X: (x) Y: (y)\nset [x v] to (x)\nset [y v] to (y)\n\nwhen I receive [reset v]\nhide\ndelete this clone\n\nwhen I receive [portal v]\nset [p - spawnx v] to (x)\nset [p - spawny v] to (y)\nreplace item (1) of [saved coins collected v] with (item (1) of [coins collected v])\nreplace item (2) of [saved coins collected v] with (item (2) of [coins collected v])\nreplace item (3) of [saved coins collected v] with (item (3) of [coins collected v])\n\nwhen flag clicked\nhide\n\n@Chat\n\nwhen flag clicked\nswitch costume to ( v)\nhide\n\nwhen I receive [chat change v]\ndelete this clone\n\nwhen I receive [chat change v]\nif <(|CHAT ON|) = [ON]> then\n    clear graphic effects\n    show\n    CREATE CHAT OPTIONS\n    switch costume to (back v)\nelse\n    hide\n    if <[] < (|CHAT|)> then\n        broadcast (WAIT THEN END CHAT v)\n    else\n        switch costume to (chat button v)\n        show\n    end\n    delete this clone\nend\n\ndefine CREATE CHAT OPTIONS\nswitch costume to (1 v)\nrepeat (12)\n    create clone of (_myself_ v)\n    next costume\nend\n\nwhen I start as a clone\ngo to x: (0) y: (25)\nforever\n    go to [front v] layer\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (10)\n        if <mouse down?> then\n            set [brightness v] effect to (15)\n            wait (0.2) seconds\n            set [|chat| v] to (costume [name v])\n            set [|chat on| v] to [OFF]\n            broadcast (CHAT CHANGE v)\n        end\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen I receive [wait then end chat v]\nwait (5) seconds\nset [|chat| v] to []\nswitch costume to (chat button v)\nshow\n\nwhen I receive [begin v]\nswitch costume to (chat button v)\nshow\n\nwhen I receive [begin v]\nforever\n    go to [front v] layer\n    if <(costume [number v]) = [2]> then\n        if <touching (mouse-pointer v)?> then\n            set [brightness v] effect to (15)\n            if <mouse down?> then\n                set [brightness v] effect to (20)\n                wait (0.2) seconds\n                set [|chat on| v] to [ON]\n                broadcast (CHAT CHANGE v)\n            end\n        else\n            set [brightness v] effect to (0)\n        end\n    end\n    if <(|CHAT ON|) = [ON]> then\n        if <<mouse down?> and <not <touching (mouse-pointer v)?>>> then\n            set [|chat on| v] to [OFF]\n            broadcast (CHAT CHANGE v)\n        end\n    end\nend\n\n@Joining\n\nwhen I receive [join game v]\nswitch costume to (costume2 v)\ncreate clone of (_myself_ v)\nswitch costume to (costume1 v)\npen up\nerase all\nLOADING LINE\ngo to x: (-100) y: (-100)\nset pen size to (25)\nset pen color to (#1e54ca)\nwait (1) seconds\nrepeat until <[98] < (x position)>\n    pen down\n    change x by (pick random (1) to (6))\n    wait (pick random (0.0) to (0.1)) seconds\nend\nbroadcast (TRY TO JOIN v)\nerase all\n\nwhen flag clicked\nerase all\nset [ghost v] effect to (100)\nshow\n\ndefine LOADING LINE\nset pen size to (30)\npen up\ngo to x: (-100) y: (-100)\nset pen color to (#0f3292)\npen down\ngo to x: (100) y: (-100)\npen up\n\nwhen I start as a clone\npen up\nset size to (250) %\ngo to x: (0) y: (20)\nshow\nclear graphic effects\nforever\n    next costume\n    if <(costume [number v]) = [1]> then\n        switch costume to (costume2 v)\n    end\n    wait (0.5) seconds\nend\n\nwhen I receive [try to join v]\ndelete this clone\n\n@Checkpoints :O\n\nwhen I receive [set up v]\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (costume1 v)\n    CLONE AT X: [3155] Y: [220]\n    CLONE AT X: [3350] Y: [1910]\nend\nset [x v] to [-800]\n\nwhen I receive [reset v]\nhide\ndelete this clone\n\ndefine POSITION: (x) (y)\ngo to x: (round (x)) y: (round (y))\nif <<(round (x)) = (round (x position))> and <(round (y)) = (round (y position))>> then\n    show\nelse\n    hide\nend\nif <<(P - SPAWNX) = (x)> and <(P - SPAWNY) = (y)>> then\n    if <touching (p - scrolling v)?> then\n        set [brightness v] effect to (15)\n    else\n        set [brightness v] effect to (10)\n    end\nelse\n    set [brightness v] effect to (-15)\nend\nif <touching (p - scrolling v)?> then\n    set [p - spawnx v] to (x)\n    set [p - spawny v] to (y)\n    replace item (1) of [saved coins collected v] with (item (1) of [coins collected v])\n    replace item (2) of [saved coins collected v] with (item (2) of [coins collected v])\n    replace item (3) of [saved coins collected v] with (item (3) of [coins collected v])\nend\n\nwhen I receive [scroll v]\nPOSITION: ((x) - (SCROLL X)) ((y) - (SCROLL Y))\ngo to [back v] layer\n\ndefine CLONE AT X: (x) Y: (y)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\nnext costume\n\nwhen flag clicked\nhide\n\n@Coin Teller\n\nwhen flag clicked\nhide\n\nwhen I receive [begin v]\nshow\nforever\n    SET COINS TO ((item (1) of [coins collected v]) + ((item (2) of [coins collected v]) + (item (3) of [coins collected v])))\n    SWITCH COSTUME TO ((*COINS COLLECTED*) + (1))\nend\n\ndefine SET COINS TO (collected)\nset [*coins collected* v] to (collected)\n\ndefine SWITCH COSTUME TO (collected)\nswitch costume to (collected)\n\n@End by @StratfordJames\n\nwhen flag clicked\nhide\n\nwhen I receive [portal v]\nif <(KEEP PLAYING?) = [5]> then\n    forever\n        go to [front v] layer\n        show\n        if <(*COINS COLLECTED*) = [3]> then\n            switch costume to (win screen + v)\n            set [can fly? v] to [1]\n        else\n            switch costume to (win screen  v)\n        end\n        if <mouse down?> then\n            set [keep playing? v] to [1]\n            broadcast (KEEP PLAYING v)\n            stop [this script v]\n        end\n    end\nend\n\nwhen I receive [keep playing v]\nhide\n\nwhen flag clicked\nset [can fly? v] to [0]\n\n