(DEMO) Midnight 2 || A Scrolling Mobile Friendly Platformer

Instructions: ONLY A DEMO\nPress space key to skip intro\nDO NOT ADVERTISE\nMidnight: https://scratch.mit.edu/projects/459138121

@Stage\n\nwhen flag clicked\nforever\n    next backdrop\n    wait (0.03) seconds\nend\n\nwhen I receive [done v]\nwait (1) seconds\nforever\n    play sound [Virtual Riot - Energy Drink v] until done\nend\n\nwhen [space v] key pressed\nwait (1) seconds\nforever\n    play sound [Virtual Riot - Energy Drink v] until done\nend\n\n@Player\n\nwhen flag clicked\ndelete all of [chat v]\nadd [Hi!] to [chat v]\nadd [Come with me!] to [chat v]\nadd [Ok!] to [chat v]\nadd [Nice!] to [chat v]\nadd [Look at me!] to [chat v]\nadd [Hard!] to [chat v]\nadd [lol] to [chat v]\nadd [Bye!] to [chat v]\nadd [No thank you.] to [chat v]\n\nwhen flag clicked\nshow list [chat v]\nset [is the chat open v] to [0]\nforever\n    if <<key (t v) pressed?> or <<touching (mouse-pointer v)?> and <mouse down?>>> then\n        if <(is the chat open) = [1]> then\n            set [is the chat open v] to [0]\n        else\n            set [is the chat open v] to [1]\n        end\n        wait until <<not <<touching (mouse-pointer v)?> and <mouse down?>>> and <not <key (t v) pressed?>>>\n    end\n    Chat\nend\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\nwhen flag clicked\nset [my player # v] to [0]\nset [max players v] to [10]\nbroadcast (setup opponents v) and wait\nbroadcast (join game v) and wait\nset [connect v] to [Connecting]\nif <(MY PLAYER #) > [0]> then\n    set [connect v] to [Connected]\nelse\n    set [connect v] to [Full]\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]\nforever\n    if <(MY PLAYER #) > [0]> then\n        send cloud data\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                            else\n                                if <(player) = [9]> then\n                                    set [☁ p9 v] to (value)\n                                else\n                                    if <(player) = [10]> then\n                                        set [☁ p10 v] to (value)\n                                    end\n                                end\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 (costume [number v]) to encoded\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 flag clicked\nbroadcast (Green flag v) and wait\nbroadcast (Play Game v) and wait\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\n\nwhen I receive [play game v]\nset [level v] to [1]\nforever\n    broadcast (Reset v) and wait\n    broadcast (Setup v) and wait\n    Reset\n    repeat until <(EXIT) > []>\n        Tick\n        broadcast (Tick v)\n    end\n    if <(EXIT) = [win]> then\n        Game - Win\n    else\n        if <(EXIT) = [die]> then\n            Reset\n        else\n            set [exit v] to []\n        end\n    end\nend\n\ndefine Tick\nif <touching (ladder v)?> then\n    change [sx v] by ((2) * (<<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<((mouse x) - (20)) > (x position)> and <mouse down?>>> - <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<((mouse x) + (20)) < (x position)> and <mouse down?>>>))\n    set [sx v] to ((sx) * (0.65))\nelse\n    change [sx v] by ((1.8) * (<<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<((mouse x) - (20)) > (x position)> and <mouse down?>>> - <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<((mouse x) + (20)) < (x position)> and <mouse down?>>>))\n    set [sx v] to ((sx) * (0.816))\nend\nif <([abs v] of (sx) ) > [0.9]> then\n    Change Player x by (round (sx))\nend\nif <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<((mouse y) + (20)) > (y position)> and <mouse down?>>> then\n    if <(in air) < [3]> then\n        if <(sy) > [-2]> then\n            set [sy v] to [13]\n        end\n    end\nend\nif <touching (bouncy v)?> then\n    set [sy v] to [21]\nend\nif <touching (ladder v)?> then\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<((mouse y) + (20)) > (y position)> and <mouse down?>>> then\n        change [y v] by (6)\n    end\n    if <<<key (down arrow v) pressed?> or <key (s v) pressed?>> or <<((mouse y) - (20)) > (y position)> and <mouse down?>>> then\n        change [y v] by (-6)\n    end\n    set [sy v] to [0]\nelse\n    if <(sy) > [-20]> then\n        change [sy v] by (-1.3)\n    end\nend\nChange player y by (sy)\n Test - Die\nset [scroll x v] to (x)\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\nend\nPosition\nchange [scroll y v] by (round (((y) - (SCROLL Y)) / (10)))\nif <(SCROLL Y) < [0]> then\n    set [scroll y v] to [0]\nend\nPosition\nif <(y) < [-180]> then\n    set [exit v] to [die]\nend\nif <<<<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<((mouse x) - (20)) > (x position)> and <mouse down?>>> or <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<((mouse x) + (20)) < (x position)> and <mouse down?>>>> or <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<((mouse y) - (20)) > (y position)> and <mouse down?>>> or <<<key (down arrow v) pressed?> or <key (s v) pressed?>> or <<((mouse y) + (20)) > (y position)> and <mouse down?>>>>> then\n    set [timeout v] to [750]\nelse\n    change [timeout v] by (-0.192873862838264876561783653281764285165493762867143656)\nend\nif <(Timeout) < [0.192873862838264876561783653281764285165493762867143656]> then\n    broadcast (timeout v)\n    hide\nend\n\ndefine Change Player x by (sx)\nchange [x v] by (sx)\nPosition\nif <touching (platforms v)?> then\n    repeat (8)\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 (-8)\n    if <touching (platforms v)?> then\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<((mouse y) - (5)) > (y position)> and <mouse down?>>> then\n            if <(sx) > [0]> then\n                set [sx v] to [-16]\n            else\n                set [sx v] to [16]\n            end\n            set [sy v] to [12]\n        end\n        Position\n    end\n    repeat until <not <touching (platforms v)?>>\n        change [x v] by ((([abs v] of (sx) ) / (sx)) * (-1))\n        Position\n    end\nend\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    change [y v] by ((([abs v] of (sy) ) / (sy)) * (-1))\n    if <(sy) < [0]> then\n        set [in air v] to [0]\n    end\n    Position\n    set [sy v] to [0]\nend\nif <touching (jump_through v)?> then\n    if <(sy) < [0]> then\n        change [y v] by ((sy) * (-1))\n        set [sy v] to [0]\n        set [in air v] to [0]\n        Position\n    end\nend\n\ndefine Position\ngo to x: ((x) - (SCROLL X)) y: ((y) - (SCROLL Y))\n\ndefine  Test - Die\nif <touching (danger v)?> then\n    set [exit v] to [die]\n    Reset\nend\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\nset [ghost v] effect to (0)\n\nwhen flag clicked\nforever\n    if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<((mouse y) + (20)) > (y position)> and <mouse down?>>> and <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<((mouse x) + (15)) > (x position)> and <mouse down?>>>> then\n        switch costume to (right up v)\n    else\n        if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<((mouse y) + (20)) > (y position)> and <mouse down?>>> and <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<((mouse x) - (15)) < (x position)> and <mouse down?>>>> then\n            switch costume to (left up v)\n        else\n            if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<((mouse y) + (20)) > (y position)> and <mouse down?>>> then\n                switch costume to (up v)\n            else\n                if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<((mouse x) - (20)) > (x position)> and <mouse down?>>> then\n                    switch costume to (right v)\n                else\n                    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<((mouse x) + (20)) < (x position)> and <mouse down?>>> then\n                        switch costume to (left v)\n                    else\n                        switch costume to (middle v)\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [timeout v]\nhide\n\ndefine Reset\nif <(CHECKPOINT) = [0]> then\n    set [x v] to [-100]\n    set [y v] to [-60]\n    set [scroll y v] to (y)\n    set [scroll x v] to (x)\nelse\n    if <(CHECKPOINT) = [1]> then\n        set [x v] to [315]\n        set [y v] to [100]\n        set [scroll y v] to (y)\n        set [scroll x v] to (x)\n    else\n        if <(CHECKPOINT) = [2]> then\n            set [x v] to [2300]\n            set [y v] to [500]\n            set [scroll y v] to (y)\n            set [scroll x v] to (x)\n        end\n    end\nend\nset [sx v] to [0]\nset [sy v] to [0]\nset [in air v] to [10]\nset [timeout v] to [1000]\nset [exit v] to []\nset size to (100) %\nshow\nset rotation style [left-right v]\n\nwhen flag clicked\nforever\n    set size to (110) %\nend\n\nwhen I start as a clone\nforever\n    set size to (110) %\nend\n\n@intro template\n\nwhen flag clicked\nset [b v] to [0]\nhide\nstart sound [MDK - Press Start v]\nrepeat (3)\n    clone [0] [1000] [1]\n    clone [0] [1000] [2]\n    clone [0] [1000] [3]\n    clone [0] [1000] [4]\n    change [b v] by (-10)\nend\nwait (1) seconds\nclone [-5] [1000] [5]\nclone [-5] [1000] [6]\nclone [-5] [1000] [7]\nclone [-5] [1000] [8]\nclone [-5] [1000] [9]\nclone [5] [-1000] [10]\nclone [5] [-1000] [11]\nclone [5] [-1000] [12]\nclone [5] [-1000] [13]\nclone [5] [-1000] [14]\nwait (1) seconds\nclone [-1000] [-1000] [15]\nwait (0.1) seconds\nclone [-1000] [1000] [16]\nwait (0.1) seconds\nclone [1000] [-1000] [17]\nwait (0.1) seconds\nclone [1000] [1000] [18]\nwait (0.1) seconds\nclone [-1000] [-1000] [19]\nwait (0.1) seconds\nclone [-1000] [1000] [20]\nwait (0.1) seconds\nclone [1000] [-1000] [21]\nwait (0.1) seconds\nclone [1000] [1000] [22]\nclone [0] [1000] [23]\nwait (0.2) seconds\nclone [0] [1000] [24]\nwait (0.2) seconds\nclone [0] [1000] [25]\nwait (0.2) seconds\nclone [0] [1000] [26]\nwait (0.2) seconds\nclone [0] [1000] [27]\nclone [-1000] [-1000] [28]\nclone [-1000] [-1000] [29]\nclone [-1000] [-1000] [30]\nclone [-1000] [-1000] [31]\nclone [-1000] [-1000] [32]\nclone [-1000] [-1000] [33]\nclone [-1000] [-1000] [34]\nclone [-1000] [-1000] [35]\nclone [-1000] [-1000] [36]\nclone [-1000] [-1000] [37]\nclone [-1000] [-1000] [38]\nclone [-1000] [-1000] [39]\nclone [-1000] [-1000] [40]\nclone [-1000] [-1000] [41]\nclone [-1000] [-1000] [42]\nclone [-1000] [-1000] [43]\nclone [-1000] [-1000] [44]\nwait (1) seconds\nclone [-1000] [-1000] [15]\nwait (0.1) seconds\nclone [-1000] [-1000] [16]\nwait (0.1) seconds\nclone [-1000] [-1000] [17]\nwait (0.1) seconds\nclone [-1000] [-1000] [18]\nwait (0.1) seconds\nclone [-1000] [-1000] [19]\nwait (0.1) seconds\nclone [-1000] [-1000] [20]\nwait (0.1) seconds\nclone [-1000] [-1000] [21]\nwait (0.1) seconds\nclone [-1000] [-1000] [22]\nbroadcast (done v)\n\ndefine clone (x) (y) (costume)\nset [my variable v] to (x)\nset [y v] to (y)\nset [costume v] to (costume)\ncreate clone of (_myself_ v)\nwait (0.05) seconds\n\nwhen I start as a clone\nshow\ngo to x: (my variable) y: (y)\nswitch costume to (costume)\nif <<(costume [number v]) > [0]> and <(costume [number v]) < [5]>> then\n    set [brightness v] effect to (b)\n    repeat until <(round (y position)) = [0]>\n        change y by (((0) - (y position)) / (5))\n    end\nend\n\nwhen I start as a clone\nshow\ngo to x: (my variable) y: (y)\nswitch costume to (costume)\nif <<(costume [number v]) > [4]> and <(costume [number v]) < [15]>> then\n    repeat until <(round (y position)) = [0]>\n        change y by (((0) - (y position)) / (5))\n    end\nend\n\nwhen I start as a clone\nshow\ngo to x: (my variable) y: (y)\nswitch costume to (costume)\nif <<(costume [number v]) > [14]> and <(costume [number v]) < [22]>> then\n    point in direction (-90)\n    set size to (0) %\n    repeat until <<(round (direction)) = [90]> and <<(round (x position)) = [0]> and <<(round (y position)) = [0]> and <(round (size)) = [100]>>>>\n        change y by (((0) - (y position)) / (5))\n        change x by (((0) - (x position)) / (5))\n        turn right (((90) - (direction)) / (5)) degrees\n        change size by (((100) - (size)) / (5))\n    end\nend\n\nwhen I start as a clone\nshow\ngo to x: (my variable) y: (y)\nswitch costume to (costume)\nif <<(costume [number v]) > [22]> and <(costume [number v]) < [24]>> then\n    repeat until <(round (y position)) = [0]>\n        change y by (((0) - (y position)) / (5))\n    end\nend\n\nwhen I start as a clone\nshow\ngo to x: (my variable) y: (y)\nswitch costume to (costume)\nif <<(costume [number v]) > [23]> and <(costume [number v]) < [28]>> then\n    repeat until <(round (y position)) = [0]>\n        change y by (((0) - (y position)) / (5))\n    end\nend\n\nwhen I start as a clone\nshow\ngo to x: (my variable) y: (y)\nswitch costume to (costume)\nif <<(costume [number v]) > [27]> and <(costume [number v]) < [45]>> then\n    point in direction (-90)\n    set size to (0) %\n    repeat until <<(round (direction)) = [90]> and <<(round (x position)) = [0]> and <<(round (y position)) = [0]> and <(round (size)) = [100]>>>>\n        change y by (((0) - (y position)) / (5))\n        change x by (((0) - (x position)) / (5))\n        turn right (((90) - (direction)) / (5)) degrees\n        change size by (((100) - (size)) / (5))\n    end\nend\n\nwhen I receive [done v]\nwait (0.55) seconds\nrepeat (10)\n    change volume by (-10)\nend\nstop all sounds\nset volume to (100) %\ndelete this clone\n\nwhen flag clicked\nforever\n    go to [front v] layer\nend\n\nwhen I start as a clone\nforever\n    go to [front v] layer\nend\n\nwhen [space v] key pressed\nstop [other scripts in sprite v]\nstop all sounds\nhide\n\nwhen [space v] key pressed\nforever\n    delete this clone\nend\n\nwhen flag clicked\nforever\n    go to [front v] layer\nend\n\n@Platforms\n\nwhen I receive [green flag v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nswitch costume to (1 v)\nClone at [480] [0]\nClone at [480] [0]\nClone at [360] [180]\nClone at [450] [2]\nClone at [360] [150]\nClone at [0] [60]\nClone at [0] [-100]\nClone at [100] [-120]\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\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\ndefine Clone at (x) (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\nwhen flag clicked\ngo to [front v] layer\n\nwhen I start as a clone\nforever\n    go to [front v] layer\nend\n\n@Danger\n\nwhen I receive [green flag v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nswitch costume to (1 v)\nClone at [480] [0]\nClone at [480] [0]\nClone at [360] [180]\nClone at [450] [2]\nClone at [360] [150]\nClone at [0] [60]\nClone at [0] [-100]\nClone at [550] [5]\nClone at [100] [-120]\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\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\ndefine Clone at (x) (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\n@Checkpoint\n\nwhen [m v] key pressed\nset [mouse v] to (join ((mouse x) + (SCROLL X)) (join [,] (join [ ] ((mouse y) + (SCROLL Y)))))\nshow variable [mouse v]\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\nif <(costume [name v]) = [closed]> then\n    if <touching (player v)?> then\n        switch costume to (open v)\n        set [brightness v] effect to (30)\n        change [checkpoint v] by (1)\n    end\nend\ngo to [front v] layer\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\ndefine Clone at (x) (y)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\n\nwhen flag clicked\nhide\nset [checkpoint v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nswitch costume to (closed v)\nset [x v] to [-99999]\nClone at [315] [79]\nClone at [2300] [453]\n\nwhen flag clicked\nforever\n    set size to (125) %\nend\n\nwhen I start as a clone\nforever\n    set size to (125) %\nend\n\n@Tree\n\nwhen I receive [tick v]\nposition ((x) - (SCROLL X)) ((y) - (SCROLL Y))\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 [green flag v]\nhide\nset [x v] to [0]\nset [y v] to [0]\nswitch costume to (1 v)\nClone at [-91] [-58]\nClone at [1400] [80]\nClone at [1758] [120]\nset [x v] to [-99999]\n\ndefine Clone at (x) (y)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\n\nClone at [-91] [-58]\n\nwhen flag clicked\ngo [backward v] (5) layers\n\nforever\n    say (join (mouse x) (mouse y))\nend\n\nwhen flag clicked\n\n@Timeout\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [timeout v]\nshow\nstop [all v]\n\nwhen flag clicked\nforever\n    go to [front v] layer\n    if <([sin v] of ((direction) * ((X v) / (x position))) ) = (MAX PLAYERS)> then\n        hide\n    else\n        go to [back v] layer\n    end\nend\n\n@Stars\n\nwhen flag clicked\ngo to x: (-60) y: (72)\nshow\nforever\n    create clone of (_myself_ v)\n    wait (pick random (1) to (3)) seconds\nend\n\nwhen flag clicked\nwait (3) seconds\nrepeat (25)\n    change [ghost v] effect by (4)\nend\nhide\n\nwhen I start as a clone\ngo to (random position v)\nset [ghost v] effect to (0)\nshow\nwait (3) seconds\nrepeat (25)\n    change [ghost v] effect by (4)\nend\ndelete this clone\n\n@TB\n\nwhen flag clicked\nswitch costume to (costume1 v)\ngo to x: (0) y: (0)\nset [ghost v] effect to (100)\n\nwhen flag clicked\nforever\n    go to [front v] layer\nend\n\n