Grass(A Mobile Friendly Platformer)

Instructions: Let's get 200 loves!\n****************************************************\nArrow keys or tap to move.\nAvoid spikes.\nJump on the trampoline.\nCollect all coins and the hidden key to goal.\nGood luck!\nLove, fave, follow for more platformers like this!\nThanks to TheFatRat for the music.\n****************************************************\n#platformer #game #mobile #grass #starwater \n#fun

@Stage\n\nwhen flag clicked\nclear graphic effects\nswitch backdrop to (backdrop2 v)\nforever\n    play sound [TheFatRat - Unity \(Instrumental\) v] until done\nend\n\nwhen I receive [bbbeginnn v]\nforever\n    set [brightness v] effect to (asdf)\nend\n\nwhen I receive [win v]\nswitch backdrop to (backdrop2 v)\nclear graphic effects\nstop [other scripts in sprite v]\nforever\n    play sound [TheFatRat - Unity \(Instrumental\) v] until done\nend\n\n@Player\n\nwhen flag clicked\nhide\n\ndefine Game On\nwait until <(Stage: x) = [0]>\nset [scrolling done? v] to [no]\nif <(Level) = [2]> then\n    set [x v] to [-50]\nelse\n    if <(Level) = [5]> then\n        set [x v] to [48]\n    else\n        set [x v] to [0]\n    end\nend\nset [y v] to [80]\nset [v y v] to [0]\nset [in air v] to [0]\nset [exit v] to []\npoint in direction (90)\nset size to (90) %\nset [ghost v] effect to (0)\nshow\n\ndefine Gravity (y speed)\nchange [y v] by (y speed)\nchange [in air v] by (1)\nPosition\nrepeat until <not <touching (platforms v)?>>\n    if <(y speed) > [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 [v y v] to [0]\nend\n\ndefine Position\ngo to x: ((x) - (ScrollX)) y: ((y) - (ScrollY))\n\ndefine Change x (x speed)\nchange [x v] by (x speed)\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    repeat until <not <touching (platforms v)?>>\n        if <(x speed) > [0]> then\n            change [x v] by (-1)\n        else\n            change [x v] by (1)\n        end\n        Position\n    end\nend\n\ndefine Game - Die\nstart sound [Crunch v]\nwait (1) seconds\nset [exit v] to []\nhide\n\ndefine Touching - Die\n\n    set [exit v] to [die]\nend\n\ndefine Game - Win\nrepeat (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)\nend\nhide\nbroadcast (Win v)\nchange [level v] by (1)\nwait (0.5) seconds\n\ndefine Check - Scrolling\nif <(ScrollY) = [0]> then\n    set [scrolling done? v] to [yes]\n    set [colletctable? v] to [yes]\nend\n\nwhen I receive [win v]\nif <(Level) = [1]> then\n\ndefine Repeat\nbroadcast (Go To Palyer v)\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n    Change x [8]\nend\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(x position) > (mouse x)>>> then\n    Change x [-8]\nend\nif <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n    if <(In Air) < [4]> then\n        if <not <touching (bouncy stuff v)?>> then\n            set [v y v] to [16]\n        end\n    end\nend\nif <touching (water v)?> then\n    if <<key (down arrow v) pressed?> or <<key (s v) pressed?> or <<mouse down?> and <(y position) > (mouse y)>>>> then\n        set [v y v] to [-2]\n    else\n        set [v y v] to [10]\n    end\nend\nif <touching (bouncy stuff v)?> then\n    if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n        set [v y v] to [20]\n    else\n        set [v y v] to [30]\n    end\nend\nchange [v y v] by (-2)\nGravity (V y)\nTouching - Die\nchange [scrollx v] by (round (((x) - (ScrollX)) / (3)))\nif <(ScrollX) < [-90]> then\n    set [scrollx v] to [-90]\nend\nCheck - Scrolling\nif <(Scrolling done?) = [yes]> then\n    change [scrolly v] by (round (((y) - (ScrollY)) / (10)))\nelse\n    set [scrolly v] to (y)\nend\nif <(ScrollY) < [0]> then\n    set [scrolly v] to [0]\nend\nPosition\nif <(y) < [-180]> then\n    set [exit v] to [die]\nend\nif <touching (spike v)?> then\n    set [exit v] to [die]\nend\nif <(Level) = [5]> then\n    if <<(ScrollY) < [10]> and <<(ScrollX) > [38]> and <(ScrollX) < [52]>>> then\nend\n\nwhen I receive [win v]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [bbbeginnn v]\nhide\nset [level v] to [1]\nforever\n    broadcast (Reset v) and wait\n    broadcast (Setup v) and wait\n    Game On\n    broadcast (timer v)\n    repeat until <(Exit) > []>\n        Repeat\n        broadcast (Repeat v) and wait\n    end\n    if <(Exit) = [win]> then\n        Game - Win\n    else\n        Game - Die\n    end\nend\n\nwhen I receive [bbbeginnn v]\nforever\n    set [asdf v] to ((x) * (-0.01))\nend\n\nwhen I receive [bbbeginnn v]\nGame - Die\nhide\n\nwhen [r v] key pressed\nGame - Die\nhide\n\nwhen flag clicked\nset [my variable v] to [0]\n\nif <(my variable) = [0]> then\n    set [exit v] to []\n    wait (0.1) seconds\n    set [my variable v] to [1]\nend\n\n@Platforms\n\nwhen I receive [bbbeginnn v]\nhide\ngo to [front v] layer\nbroadcast (Setup v)\n\nwhen flag clicked\nhide\n\nwhen I receive [win v]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [repeat v]\nPosition ((x) - (ScrollX)) ((y) - (ScrollY))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(Level) = [1]> then\n    switch costume to (1a v)\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\nend\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\nwhen I receive [space v]\nbroadcast (bbbeginnn v)\n\n@Portal\n\nwhen I receive [open portal v]\nswitch costume to (open v)\n\nwhen I receive [win v]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [bbbeginnn v]\nshow\ngo to [back v] layer\n\nwhen flag clicked\nhide\n\nwhen I receive [repeat v]\nPosition ((x) - (ScrollX)) ((y) - (ScrollY))\nif <<(costume [number v]) = [2]> and <touching (player v)?>> then\n    set [exit v] to [win]\nend\n\nwhen I receive [setup v]\nhide\nset [collected v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nif <(Level) = [1]> then\n    Clone at x: [3608] y: [35]\n    switch costume to (closed v)\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <not <(Level) = [5]>> then\n    if <<(x) = (x position)> and <(y) = (y position)>> then\n        show\n    else\n        hide\n    end\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)\n\n@Sprite1\n\nwhen flag clicked\npoint in direction (84)\ngo to x: (0) y: (0)\ngo to [back v] layer\nshow\nforever\n    repeat (40)\n        turn right (0.3) degrees\n    end\n    repeat (40)\n        turn right (-0.3) degrees\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (sprite2 v)?> then\n        switch costume to (costume2 v)\n        wait (0.1) seconds\n    else\n        switch costume to (costume1 v)\n    end\nend\n\nwhen I receive [space v]\nhide\n\nwhen I receive [bbbeginnn v]\nstop [other scripts in sprite v]\n\nwhen I receive [win v]\nforever\n    if <touching (sprite2 v)?> then\n        switch costume to (costume2 v)\n        wait (0.1) seconds\n    else\n        switch costume to (costume1 v)\n    end\nend\n\nwhen I receive [win v]\npoint in direction (84)\ngo to x: (0) y: (0)\ngo to [back v] layer\nshow\nforever\n    repeat (40)\n        turn right (0.3) degrees\n    end\n    repeat (40)\n        turn right (-0.3) degrees\n    end\nend\n\n@Sprite2\n\nwhen flag clicked\nforever\n    if <<mouse down?> or <key (space v) pressed?>> then\n        hide\n        broadcast (space v)\n        stop [other scripts in sprite v]\n        stop [this script v]\n    end\nend\n\nwhen flag clicked\ngo to x: (-10) y: (0)\nset size to (80) %\nswitch costume to (costume1 v)\ngo to [back v] layer\npoint in direction (84)\nshow\nset [xv v] to [0]\nset [yv v] to [0]\nforever\n    set [xv v] to ((Xv) * (0.9))\n    change x by (Xv)\n    if <touching color (#1d8000)?> then\n        change y by (1)\n        if <touching color (#1d8000)?> then\n            change y by (1)\n            if <touching color (#1d8000)?> then\n                change y by (1)\n                if <touching color (#1d8000)?> then\n                    change y by (1)\n                    if <touching color (#1d8000)?> then\n                        change y by (1)\n                        if <touching color (#1d8000)?> then\n                            change x by ((Xv) * (-1))\n                            change y by (-5)\n                            if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n                                if <(Xv) > [0]> then\n                                    set [xv v] to [-5]\n                                else\n                                    set [xv v] to [5]\n                                end\n                                set [yv v] to [15]\n                            else\n                                set [xv v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [yv v] by (-1)\n    change y by (Yv)\n    if <touching color (#1d8000)?> then\n        change y by ((Yv) * (-1))\n        set [yv v] to [0]\n    end\n    change y by (-1)\n    if <touching color (#1d8000)?> then\n        if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n            set [yv v] to [15]\n        end\n    end\n    change y by (1)\n    if <(x position) > [238]> then\n        broadcast (messege2 v)\n        reset\n    end\n    if <key (r v) pressed?> then\n        reset\n    end\n    if <<(y position) < [-177]> or <touching color (#ff0000)?>> then\n        reset\n    end\n    if <touching color (#003aff)?> then\n        set [yv v] to [20]\n    end\n    if <touching color (#006622)?> then\n        set [xv v] to [15]\n        set [yv v] to [5]\n    end\nend\n\ndefine reset\ngo to x: (-200) y: (0)\n\nwhen I start as a clone\nrepeat (100)\n    change [ghost v] effect by (15)\n    change size by (-10)\nend\ndelete this clone\n\nwhen flag clicked\nforever\n    repeat (40)\n        turn right (0.3) degrees\n    end\n    repeat (40)\n        turn right (-0.3) degrees\n    end\nend\n\nwhen I receive [space v]\nhide\n\nwhen I receive [win v]\nforever\n    if <<mouse down?> or <key (space v) pressed?>> then\n        hide\n        broadcast (space v)\n        stop [other scripts in sprite v]\n        stop [this script v]\n    end\nend\n\nwhen I receive [win v]\ngo to x: (-10) y: (0)\nset size to (80) %\nswitch costume to (costume1 v)\ngo to [front v] layer\ngo [backward v] (1) layers\npoint in direction (84)\nshow\nset [xv v] to [0]\nset [yv v] to [0]\nforever\n    set [xv v] to ((Xv) * (0.9))\n    change x by (Xv)\n    if <touching color (#1d8000)?> then\n        change y by (1)\n        if <touching color (#1d8000)?> then\n            change y by (1)\n            if <touching color (#1d8000)?> then\n                change y by (1)\n                if <touching color (#1d8000)?> then\n                    change y by (1)\n                    if <touching color (#1d8000)?> then\n                        change y by (1)\n                        if <touching color (#1d8000)?> then\n                            change x by ((Xv) * (-1))\n                            change y by (-5)\n                            if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n                                if <(Xv) > [0]> then\n                                    set [xv v] to [-5]\n                                else\n                                    set [xv v] to [5]\n                                end\n                                set [yv v] to [15]\n                            else\n                                set [xv v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [yv v] by (-1)\n    change y by (Yv)\n    if <touching color (#1d8000)?> then\n        change y by ((Yv) * (-1))\n        set [yv v] to [0]\n    end\n    change y by (-1)\n    if <touching color (#1d8000)?> then\n        if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n            set [yv v] to [15]\n        end\n    end\n    change y by (1)\n    if <(x position) > [238]> then\n        broadcast (messege2 v)\n        reset\n    end\n    if <key (r v) pressed?> then\n        reset\n    end\n    if <<(y position) < [-177]> or <touching color (#ff0000)?>> then\n        reset\n    end\n    if <touching color (#003aff)?> then\n        set [yv v] to [20]\n    end\n    if <touching color (#006622)?> then\n        set [xv v] to [15]\n        set [yv v] to [5]\n    end\nend\n\nwhen I receive [win v]\nforever\n    repeat (40)\n        turn right (0.3) degrees\n    end\n    repeat (40)\n        turn right (-0.3) degrees\n    end\nend\n\n@Sprite3\n\nwhen flag clicked\npoint in direction (96)\ngo to x: (0) y: (0)\nshow\nforever\n    repeat (40)\n        turn right (-0.3) degrees\n    end\n    repeat (40)\n        turn right (0.3) degrees\n    end\nend\n\nwhen I receive [space v]\nhide\n\nwhen I receive [win v]\npoint in direction (96)\ngo to x: (0) y: (0)\nshow\nforever\n    repeat (40)\n        turn right (-0.3) degrees\n    end\n    repeat (40)\n        turn right (0.3) degrees\n    end\nend\n\n@Water\n\nwhen I receive [bbbeginnn v]\nhide\nset [ghost v] effect to (30)\n\nwhen flag clicked\nhide\n\nwhen I receive [win v]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [repeat v]\nPosition ((x) - (ScrollX)) ((y) - (ScrollY))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(Level) = [1]> then\n    switch costume to (1a v)\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\nelse\nend\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\nwhen I start as a clone\nforever\n    set [brightness v] effect to (asdf)\nend\n\n@Spike\n\nwhen I receive [bbbeginnn v]\nhide\n\nwhen flag clicked\nhide\n\nwhen I receive [win v]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [repeat v]\nPosition ((x) - (ScrollX)) ((y) - (ScrollY))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(Level) = [1]> then\n    switch costume to (1a v)\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\nelse\nend\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\n@Bouncy Stuff\n\nwhen I receive [bbbeginnn v]\nhide\n\nwhen flag clicked\nhide\n\nwhen I receive [win v]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [repeat v]\nPosition ((x) - (ScrollX)) ((y) - (ScrollY))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(Level) = [1]> then\n    switch costume to (1a v)\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\nend\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\n@Fake\n\nwhen I receive [bbbeginnn v]\nclear graphic effects\nhide\n\nwhen flag clicked\nhide\n\nwhen I receive [win v]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [repeat v]\nPosition ((x) - (ScrollX)) ((y) - (ScrollY))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(Level) = [1]> then\n    switch costume to (1a v)\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\nend\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)\ngo to [back v] layer\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nwhen I start as a clone\nforever\n    if <touching (player v)?> then\n        set [ghost v] effect to (30)\n    else\n        clear graphic effects\n    end\nend\n\n@Sprite4\n\nwhen flag clicked\ngo to x: (0) y: (130)\nshow\nforever\n    go to [back v] layer\nend\n\nwhen I receive [setup v]\ngo to x: (0) y: (130)\n\n@Sprite5\n\nwhen flag clicked\nclear graphic effects\nhide\nforever\n    create clone of (_myself_ v)\n    wait (3) seconds\nend\n\nwhen I start as a clone\ngo to [back v] layer\nset [brightness v] effect to (pick random (0) to (-20))\nshow\ngo to x: (240) y: (pick random (50) to (180))\nglide (pick random (10) to (15)) secs to x: (-240) y: (y position)\ndelete this clone\n\n@Coin\n\nset [counter v] to [1]\nrepeat (9)\n    Clone at x: [75] y: ((8) * (Counter))\n    change [counter v] by (4)\nend\n\nwhen flag clicked\nforever\n    set [orbs v] to (join ((Collected) * (2.5)) [%])\nend\n\nwhen I receive [win v]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [bbbeginnn v]\nshow\nset [counter v] to [1]\n\nwhen flag clicked\nhide\n\nwhen I receive [repeat v]\nPosition ((x) - (ScrollX)) ((y) - (ScrollY))\nif <(Colletctable?) = [yes]> then\n    if <touching (player v)?> then\n        start sound [Collect v]\n        change [collected v] by (1)\n        if <<(Collected) = (Collected Max)> and <(key) = [yes]>> then\n            broadcast (Open Portal v)\n        end\n        delete this clone\n    end\nend\n\nwhen I receive [setup v]\nhide\nset [collected v] to [0]\nset [collected max v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nif <(Level) = [1]> then\n    Clone at x: [126] y: [0]\n    Clone at x: [593] y: [150]\n    Clone at x: [772] y: [40]\n    Clone at x: [1315] y: [-35]\n    Clone at x: [1555] y: [49]\n    Clone at x: [1777] y: [120]\n    Clone at x: [1990] y: [49]\n    Clone at x: [2210] y: [-50]\n    Clone at x: [2385] y: [50]\n    Clone at x: [2560] y: [150]\n    Clone at x: [2767] y: [150]\n    Clone at x: [3030] y: [200]\n    Clone at x: [2930] y: [-80]\n    Clone at x: [3206] y: [155]\n    Clone at x: [3425] y: [155]\nend\nset [x v] to [-9999999]\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)\ngo to [back v] layer\nswitch costume to (dot v)\nset [x v] to (x)\nset [y v] to (y)\nchange [collected max v] by (1)\ncreate clone of (_myself_ v)\n\n@Fake2\n\nwhen I receive [bbbeginnn v]\nclear graphic effects\nhide\n\nwhen flag clicked\nhide\n\nwhen I receive [win v]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [repeat v]\nPosition ((x) - (ScrollX)) ((y) - (ScrollY))\n\nwhen I receive [setup v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nif <(Level) = [1]> then\n    switch costume to (1a v)\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\nend\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)\ngo to [front v] layer\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nwhen I start as a clone\nforever\n    if <touching (player v)?> then\n        set [ghost v] effect to (50)\n    else\n        clear graphic effects\n    end\nend\n\n@key\n\nset [counter v] to [1]\nrepeat (9)\n    Clone at x: [75] y: ((8) * (Counter))\n    change [counter v] by (4)\nend\n\nwhen flag clicked\nforever\n    set [orbs v] to (join ((Collected) * (2.5)) [%])\nend\n\nwhen I receive [win v]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [bbbeginnn v]\nshow\n\nwhen flag clicked\nhide\n\nwhen I receive [repeat v]\nPosition ((x) - (ScrollX)) ((y) - (ScrollY))\nif <(key) = [0]> then\n    if <touching (player v)?> then\n        start sound [Coin v]\n        set [key v] to [yes]\n        delete this clone\n    end\nend\n\nwhen I receive [setup v]\nhide\nset [key v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nif <(Level) = [1]> then\n    Clone at x: [3000] y: [24]\nend\nset [x v] to [-9999999]\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)\ngo to [back v] layer\nswitch costume to (key v)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\n\n@Sprite6\n\nwhen I receive [end v]\nset [ghost v] effect to (100)\ngo to x: (0) y: (0)\nshow\nrepeat (50)\n    change [ghost v] effect by (-2)\nend\n\nwhen flag clicked\nhide\n\n