Mines A Multiplayer Scrolling Platformer

Instructions: ~~~~~~~~~~~~~~~~~~Mines~~~~~~~~~~~~~~~~~~\nHere is  Mines A Scrolling multiplayer platformer\n\nINSTRUCTIONS:\n\nPC:\nArrow keys to move \nT to chat \nN to toggle names\n\nMobile:\nTap to Move\nClick on the player to chat \nClick on the right top corner to toggle names

@Stage\n\nwhen flag clicked\nforever\n    play sound [waiting music v] until done\nend\n\nwhen I receive [you win v]\nstop [other scripts in sprite v]\nstart sound [Pixelland.mp3 v]\n\n@player\n\ndefine Chat\nif <(is the chat open) = [1]> then\n    if <key (1 v) pressed?> then\n        set [chat v] to [1]\n        say (item (Chat) of [chat v])\n        wait (2) seconds\n        say []\n        set [chat v] to [0]\n    else\n        if <key (2 v) pressed?> then\n            set [chat v] to [2]\n            say (item (Chat) of [chat v])\n            wait (2) seconds\n            say []\n            set [chat v] to [0]\n        else\n            if <key (3 v) pressed?> then\n                set [chat v] to [3]\n                say (item (Chat) of [chat v])\n                wait (2) seconds\n                say []\n                set [chat v] to [0]\n            else\n                if <key (4 v) pressed?> then\n                    set [chat v] to [4]\n                    say (item (Chat) of [chat v])\n                    wait (2) seconds\n                    say []\n                    set [chat v] to [0]\n                else\n                    if <key (5 v) pressed?> then\n                        set [chat v] to [5]\n                        say (item (Chat) of [chat v])\n                        wait (2) seconds\n                        say []\n                        set [chat v] to [0]\n                    else\n                        if <key (6 v) pressed?> then\n                            set [chat v] to [6]\n                            say (item (Chat) of [chat v])\n                            wait (2) seconds\n                            say []\n                            set [chat v] to [0]\n                        else\n                            if <key (7 v) pressed?> then\n                                set [chat v] to [7]\n                                say (item (Chat) of [chat v])\n                                wait (2) seconds\n                                say []\n                                set [chat v] to [0]\n                            else\n                                if <key (8 v) pressed?> then\n                                    set [chat v] to [8]\n                                    say (item (Chat) of [chat v])\n                                    wait (2) seconds\n                                    say []\n                                    set [chat v] to [0]\n                                else\n                                    if <key (9 v) pressed?> then\n                                        set [chat v] to [9]\n                                        say (item (Chat) of [chat v])\n                                        wait (2) seconds\n                                        say []\n                                        set [chat v] to [0]\n                                    else\n                                        set [chat v] to [0]\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Position\ngo to x: ((x) - (SCROLL X)) y: ((y) - (SCROLL Y))\n\nwhen flag clicked\nset [scroll y v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nset [scroll x v] to [0]\nshow list [chat v]\nbroadcast (GREEN FLAG v) and wait\nbroadcast (PLAY GAME v) and wait\n\ndefine CHANGE PLAYER Y BY (sy)\nchange [y v] by (sy)\nchange [inair v] by (1)\nPosition\nrepeat until <not <touching (platform v)?>>\n    if <(sy) > [0]> then\n        change [y v] by (-1)\n    else\n        change [y v] by (1)\n        set [inair v] to [0]\n    end\n    Position\n    set [sy v] to [0]\nend\n\ndefine GAME ON\nset [x v] to (Spawn_X)\nset [y v] to (Spawn_Y)\nset [scroll x v] to (Spawn_X)\nset [scroll y v] to (Spawn_Y)\nset [sy v] to [0]\nset [sx v] to [0]\nset [inair v] to [0]\nset [exit v] to []\nset size to (100) %\nset [ghost v] effect to (0)\nshow\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\n\ndefine Game-Win\nrepeat (50)\n    point towards (exit v)\n    turn right (65) degrees\n    move ((distance to [exit v]) / (2)) steps\n    change size by (-1)\n    change [ghost v] effect by (2)\nend\nhide\nchange [level v] by (1)\nwait (1) seconds\n\ndefine TICK\nif <<<(mouse x) < (x position)> and <mouse down?>> or <<key (left arrow v) pressed?> or <key (a v) pressed?>>> then\n    change [sx v] by (-2)\nend\nif <<<(x position) < (mouse x)> and <mouse down?>> or <<key (right arrow v) pressed?> or <key (d v) pressed?>>> then\n    change [sx v] by (2)\nend\nset [sx v] to ((SX) * (0.8))\nif <[0.9] < ([abs v] of (SX) )> then\n    CHANGE PLAYER X By (round (SX))\nend\nif <<<(y position) < (mouse y)> and <mouse down?>> or <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n    if <(inair) < [4]> then\n        set [sy v] to [16]\n    end\nend\nif <(sy) > [-20]> then\n    change [sy v] by (-2)\nend\nCHANGE PLAYER Y BY (sy)\nTEST-DIE\nchange [scroll x v] by (round (((x) - (SCROLL X)) / (8)))\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\nend\nif <[2649] < (SCROLL X)> then\n    set [scroll x v] to [2649]\nend\nchange [scroll y v] by (round (((y) - (SCROLL Y)) / (8)))\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\n\nwhen I receive [begin v]\nset [is the chat open v] to [0]\nshow list [chat v]\nforever\n    Chat\n    if <<key (t v) pressed?> or <<touching (mouse-pointer v)?> and <mouse down?>>> then\n        if <(is the chat open) = [1]> then\n            show list [chat v]\n            set [is the chat open v] to [0]\n        else\n            set [is the chat open v] to [1]\n            hide list [chat v]\n        end\n        wait until <<not <<touching (mouse-pointer v)?> and <mouse down?>>> and <not <key (t v) pressed?>>>\n    end\nend\n\ndefine GAME - DIE\nset [player_rotation v] to [dead]\nset rotation style [all around v]\nshow\nset [ghost v] effect to (30)\nstart sound [Crunch v]\nrepeat (15)\n    change y by (10)\n    turn right (15) degrees\nend\nset [exit v] to []\nset rotation style [left-right v]\nclear graphic effects\npoint in direction (90)\nhide\nset [player_rotation v] to [moving]\n\ndefine TEST-DIE\nif <touching (dangers v)?> then\n    set [exit v] to [die]\nend\n\ndefine CHANGE PLAYER X By (sx)\nchange [x v] by (sx)\nPosition\nif <touching (platform v)?> then\n    repeat (18)\n        change [y v] by (1)\n        Position\n        if <not <touching (platform v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-18)\n    if <<<(y position) < (mouse y)> and <mouse down?>> or <<key (up arrow v) pressed?> or <key (w v) pressed?>>> then\n        if <(sx) > [0]> then\n            set [sx v] to [-16]\n        else\n            set [sx v] to [16]\n        end\n        set [inair v] to [0]\n    else\n        set [sx v] to [0]\n    end\n    repeat until <not <touching (platform 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\nwhen flag clicked\nset [max players v] to [8]\nset [my player # v] to [0]\nbroadcast (setups v) and wait\nbroadcast (joining v)\nbroadcast (join game v) and wait\nif <(My Player #) > [0]> then\n    start sound [Connect v]\n    broadcast (joined v)\nelse\n    start sound [Disconnect v]\n    broadcast (full v)\nend\nbroadcast (begin v)\n\ndefine write (val) to encoded\nset [letter # v] to [1]\nrepeat (length of (val))\n    set [encoded v] to (join (encoded) (item # of (letter (letter #) of (val)) in [code v]))\n    change [letter # v] by (1)\nend\nset [encoded v] to (join (encoded) [00])\n\nwhen I receive [begin v]\nset [level v] to [1]\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        if <(My Player #) > [0]> then\n            send cloud data\n        end\n    end\n    if <(EXIT) = [win]> then\n        Game-Win\n    else\n        GAME - DIE\n    end\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                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine send cloud data\nset [encoded v] to []\nwrite (username) to encoded\nwrite (round ((timer) * (10))) to encoded\nwrite (x) to encoded\nwrite (y) to encoded\nwrite (Chat) to encoded\nset cloud # (My Player #) to (encoded)\n\nwhen I receive [begin v]\nwait (5) seconds\nswitch backdrop to (blank v)\n\nwhen flag clicked\nswitch costume to (pick random (1) to (6))\nforever\n    if <(Player_Rotation) = [moving]> then\n        if <key (right arrow v) pressed?> then\n            point in direction (90)\n        end\n        if <key (left arrow v) pressed?> then\n            point in direction (-90)\n        end\n    end\nend\n\nwhen I receive [you win v]\ngo to [back v] layer\n\nwhen I receive [exit win screen v]\ngo to [front v] layer\n\nwhen flag clicked\nset [player_rotation v] to [moving]\n\nwhen I receive [you win v]\nstop [other scripts in sprite v]\n\n@opponents\n\ndefine Decode chat (chat)\nif <(chat) = [0]> then\n\ndefine begin decode of (encode)\nset [encodied v] to (encode)\nset [letter # v] to [1]\n\ndefine value=read from encode\nset [value v] to []\nforever\n    set [idx v] to (join (letter (letter #) of (encodied)) (letter ((letter #) + (1)) of (encodied)))\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 [code v]))\nend\n\ndefine setup players\nset [color v] effect to (90)\nset [offline v] to [100]\nhide\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        hide\n        set [offline v] to [100]\n    else\n        tick\n    end\n    go to [back v] layer\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                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [setups v]\nsetup players\n\ndefine tick\nvalue=Cloud # (player #)\nif <(join [A] (value)) = (last value)> then\n    change [offline v] by (1)\n    if <(offline) = [100]> then\n        hide\n    end\nelse\n    set [last value v] to (join [A] (value))\n    if <(offline) > [99]> then\n        show\n    end\n    set [offline v] to [0]\nend\nbegin decode of (value)\nvalue=read from encode\nif <(names) = [1]> then\n    say (join (player #) (join [:] (value)))\nelse\n    say []\nend\nvalue=read from encode\nvalue=read from encode\nset x to ((value) - (SCROLL X))\nvalue=read from encode\nset y to ((value) - (SCROLL Y))\nvalue=read from encode\nbroadcast (Decode chat v)\n\nwhen I receive [join game v]\nvalue=Cloud # (player #)\nset [last value v] to (join [A] (value))\nwait (3) seconds\nvalue=Cloud # (player #)\nif <(join [A] (value)) = (last value)> then\n    set [my player # v] to (player #)\nend\n\nwhen I receive [decode chat v]\nDecode chat (value)\n\nwhen I receive [begin v]\nset [names v] to [1]\nforever\n    if <key (n v) pressed?> then\n        if <(names) = [1]> then\n            wait until <not <key (n v) pressed?>>\n            set [names v] to [0]\n        else\n            wait until <not <key (n v) pressed?>>\n            set [names v] to [1]\n        end\n    end\nend\n\nwhen I start as a clone\nswitch costume to (pick random (1) to (6))\n\nwhen I receive [you win v]\nstop [other scripts in sprite v]\n\n@PLATFORM\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPOSTION ((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 (1 v)\nCLONE AT X [10] Y [0]\nCLONE AT X [1100] Y [0]\nCLONE AT X [1400] Y [0]\nCLONE AT X [2000] Y [0]\nCLONE AT X [2600] Y [0]\nCLONE AT X [2649] Y [500]\nCLONE AT X [1800] Y [900]\nCLONE AT X [1100] Y [1500]\nCLONE AT X [300] Y [1800]\nCLONE AT X [300] Y [1800]\n\ndefine POSTION (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)\nset [x v] to (x)\nset [y v] to (y)\nnext costume\n\nwhen I receive [tick v]\nif <(costume [number v]) = [11]> then\n    if <(Collected) = [41]> then\n        if <(Collected_Gems) = [3]> then\n            set [x v] to [-99999]\n            hide\n        end\n    end\nend\n\nwhen I receive [you win v]\nstop [other scripts in sprite v]\n\n@DANGERs\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPOSTION ((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 (1 v)\nCLONE AT X [10] Y [0]\nCLONE AT X [1100] Y [0]\nCLONE AT X [1400] Y [0]\nCLONE AT X [2000] Y [0]\nCLONE AT X [2600] Y [0]\nCLONE AT X [2649] Y [500]\nCLONE AT X [1800] Y [900]\nCLONE AT X [1100] Y [1500]\n\ndefine POSTION (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)\nset [x v] to (x)\nset [y v] to (y)\nnext costume\n\nwhen I receive [setup v]\ngo to [back v] layer\n\nwhen I receive [you win v]\nstop [other scripts in sprite v]\n\n@connecting\n\nwhen flag clicked\ngo to x: (140) y: (110)\nhide\n\nwhen I receive [begin v]\nwait (3) seconds\nhide\n\nwhen I receive [joining v]\nswitch costume to (joining v)\nshow\n\nwhen I receive [joined v]\nswitch costume to (joined v)\nshow\n\nwhen I receive [full v]\nswitch costume to (full v)\nshow\n\nwhen I receive [you win v]\nstop [other scripts in sprite v]\n\n@player helmet\n\nwhen flag clicked\ngo to [back v] layer\nhide\nforever\n    go to (player v)\nend\n\nwhen I receive [begin v]\nshow\nforever\n    point in direction ([direction v] of [player v])\n    if <(Player_Rotation) = [dead]> then\n        set rotation style [all around v]\n    else\n        set rotation style [left-right v]\n    end\nend\n\nwhen I receive [you win v]\nstop [other scripts in sprite v]\n\n@loading\n\nwhen flag clicked\ngo to [front v] layer\ngo to x: (119) y: (-70)\nhide\n\nwhen I receive [joining v]\nshow\nforever\n    next costume\n    wait (0.09) seconds\nend\n\nwhen I receive [begin v]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [you win v]\nstop [other scripts in sprite v]\n\n@check points\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPOSTION ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <(costume [number v]) = [1]> then\n    if <touching (player v)?> then\n        start sound [Ding - Sound Effect \[HD\] v]\n        switch costume to (activated v)\n        set [spawn_x v] to ((x) - (10))\n        set [spawn_y v] to (y)\n        set [checkpoint v] to (#)\n    end\nend\nif <not <(CheckPoint) = (#)>> then\n    switch costume to (de-activated v)\nend\n\nwhen I receive [setup v]\nset [checkpoint v] to [0]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    set [# v] to [0]\n    switch costume to (de-activated v)\n    CLONE AT X [1000] Y [200]\n    CLONE AT X [2649] Y [120]\n    CLONE AT X [2062] Y [810]\n    CLONE AT X [1085] Y [1630]\nend\nset [x v] to [-999999]\n\ndefine POSTION (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 [# v] by (1)\ncreate clone of (_myself_ v)\n\nwhen flag clicked\nset [spawn_x v] to [0]\nset [spawn_y v] to [0]\n\nwhen I receive [setup v]\ngo to [back v] layer\n\nwhen I receive [you win v]\nstop [other scripts in sprite v]\n\n@collectables\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPOSTION ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <touching (player v)?> then\n    if <(costume [number v]) = [1]> then\n        start sound [Coin v]\n        change [collected v] by (1)\n        delete this clone\n    else\n        if <(costume [number v]) = [2]> then\n            start sound [Collect v]\n            change [collected_gems v] by (1)\n            delete this clone\n        else\n            if <(won) = [0]> then\n                broadcast (you win v)\n            end\n        end\n    end\nend\n\ndefine POSTION (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\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 [begin v]\nset [gems v] to [3]\nset [coins v] to [41]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (coin v)\n    CLONE AT X [370] Y [50]\n    CLONE AT X [750] Y [50]\n    CLONE AT X [1050] Y [300]\n    CLONE AT X [1200] Y [100]\n    CLONE AT X [1400] Y [200]\n    CLONE AT X [1600] Y [250]\n    CLONE AT X [1800] Y [250]\n    CLONE AT X [2000] Y [250]\n    CLONE AT X [2200] Y [250]\n    CLONE AT X [2450] Y [175]\n    CLONE AT X [2650] Y [300]\n    CLONE AT X [2550] Y [450]\n    CLONE AT X [2649] Y [700]\n    CLONE AT X [2500] Y [800]\n    CLONE AT X [2150] Y [800]\n    CLONE AT X [1900] Y [900]\n    CLONE AT X [1700] Y [1000]\n    CLONE AT X [1500] Y [1300]\n    CLONE AT X [1400] Y [1400]\n    CLONE AT X [1200] Y [1700]\n    CLONE AT X [900] Y [1600]\n    CLONE AT X [40] Y [650]\n    CLONE AT X [30] Y [650]\n    CLONE AT X [20] Y [650]\n    CLONE AT X [10] Y [650]\n    CLONE AT X [0] Y [650]\n    CLONE AT X [40] Y [680]\n    CLONE AT X [30] Y [680]\n    CLONE AT X [20] Y [680]\n    CLONE AT X [10] Y [680]\n    CLONE AT X [0] Y [680]\n    CLONE AT X [40] Y [710]\n    CLONE AT X [30] Y [710]\n    CLONE AT X [20] Y [710]\n    CLONE AT X [10] Y [710]\n    CLONE AT X [0] Y [710]\n    CLONE AT X [40] Y [740]\n    CLONE AT X [30] Y [740]\n    CLONE AT X [20] Y [740]\n    CLONE AT X [10] Y [740]\n    CLONE AT X [0] Y [740]\n    switch costume to (gem v)\n    CLONE AT X [0] Y [300]\n    CLONE AT X [1148] Y [0]\n    CLONE AT X [250] Y [2040]\n    switch costume to (diamond v)\n    CLONE AT X [270] Y [1851]\nend\nset [x v] to [-999999]\n\nwhen flag clicked\nset [collected v] to [0]\ndelete this clone\n\nwhen I receive [setup v]\ngo to [back v] layer\n\nwhen I receive [you win v]\nstop [other scripts in sprite v]\n\n@coin amount\n\nwhen flag clicked\ngo to x: (160) y: (150)\nset size to (70) %\nhide\nswitch costume to (coin v)\n\nwhen I start as a clone\nset size to (70) %\ngo to x: (190) y: (150)\nforever\n    switch costume to ((Collected) + (2))\nend\n\nwhen I receive [begin v]\nshow\ncreate clone of (_myself_ v)\n\nwhen I receive [you win v]\nstop [other scripts in sprite v]\n\n@You win\n\nwhen flag clicked\nhide\ngo to x: (0) y: (0)\ngo to [front v] layer\n\nwhen I receive [you win v]\nswitch costume to (sizer v)\nset size to (1000) %\nswitch costume to (win v)\nshow\nrepeat until <(size) < [101]>\n    change size by (((100) - (size)) / (7))\n    set x to (((((pick random (0) to (1)) * (2)) - (1)) * ((size) - (100))) * (0.75))\n    set y to (((((pick random (0) to (1)) * (2)) - (1)) * ((size) - (100))) * (0.75))\nend\ngo to x: (0) y: (0)\nset size to (100) %\n\nwhen I receive [you win v]\nstop all sounds\n\nbroadcast (you win v)\n\nwhen flag clicked\nset [won v] to [0]\n\n@decor back\n\nwhen I receive [play game v]\nshow\n\nwhen I start as a clone\nset [ghost v] effect to (0)\nforever\n    go to x: ((((costume [number v]) - (1)) * (480)) + ((SCROLL X) / (-5))) y: (0)\nend\n\ndefine heyo\nset [ghost v] effect to (100)\nrepeat (10)\n    create clone of (_myself_ v)\n    next costume\nend\n\nwhen flag clicked\nhide\nswitch costume to (1 v)\nheyo\nforever\n    go to [back v] layer\nend\n\nwhen I start as a clone\nclear graphic effects\nshow\nforever\n    go to [back v] layer\nend\n\nwhen flag clicked\nhide\n\nwhen flag clicked\nhide\nforever\n    go to [back v] layer\nend\n\nwhen I receive [you win v]\nstop [other scripts in sprite v]\n\n@Gem amount\n\nwhen flag clicked\nset [collected_gems v] to [0]\ngo to x: (160) y: (120)\nset size to (70) %\nhide\nswitch costume to (coin v)\n\nwhen I start as a clone\nset size to (70) %\ngo to x: (190) y: (120)\nforever\n    switch costume to ((Collected_Gems) + (2))\nend\n\nwhen I receive [begin v]\nshow\ncreate clone of (_myself_ v)\n\nwhen I receive [you win v]\nstop [other scripts in sprite v]\n\n@Thumbnail\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\nforever\n    go to [front v] layer\nend\n\n@BLANK\n\n