✩LIFE || Scrolling Platformer✩


@Stage\n\nwhen flag clicked\nbroadcast (Green Flag v)\n\nwhen flag clicked\nset [music___ v] to [1]\nforever\n    if <(Music) = [On]> then\n        set volume to (100) %\n    else\n        set volume to (0) %\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Music___) = [1]> then\n        play sound [1 v] until done\n    end\n    if <(Music___) = [2]> then\n        play sound [2 v] until done\n    end\n    if <(Music___) = [3]> then\n        play sound [3 v] until done\n    end\n    if <(Music___) = [4]> then\n        play sound [4 v] until done\n    end\n    if <(Music___) = [5]> then\n        play sound [5 v] until done\n    end\n    if <(Music___) = [6]> then\n        play sound [6 v] until done\n    end\n    if <(Music___) = [7]> then\n        play sound [7 v] until done\n    end\n    if <(Music___) = [8]> then\n        play sound [8 v] until done\n    end\n    if <(Music___) = [9]> then\n        set [music___ v] to [1]\n    end\nend\n\nwhen I receive [aaa change music v]\nstop all sounds\nchange [music___ v] by (1)\n\n@B L AN K\n\n@Anti-Lag\n\nwhen flag clicked\nshow\nwait (1.5) seconds\nhide\n\nwhen flag clicked\nrepeat (10)\n    go to [front v] layer\nend\n\n@Thumbnail\n\nwhen flag clicked\nshow\nset [ghost v] effect to (100)\ngo to x: (0) y: (0)\nset size to (100) %\nforever\n    go to [front v] layer\nend\n\n@PLAYER\n\nwhen flag clicked\nset size to (100) %\nset [res x v] to [-250]\nset [res y v] to [11]\nset [ghost v] effect to (10)\nbroadcast (set up v) and wait\nDie\nwait (1) seconds\nforever\n    game tick\nend\n\ndefine change player x by (val)\nchange [playerx v] by (val)\nposition player\nif <<touching (hitboxes v)?> or <<touching (moving platforms v)?> or <touching (door v)?>>> then\n    repeat (8)\n        change [playery v] by (1)\n        position player\n        if <not <<touching (hitboxes v)?> or <<touching (moving platforms v)?> or <touching (door v)?>>>> then\n            stop [this script v]\n        end\n    end\n    change [playery v] by (-8)\n    repeat until <not <<touching (hitboxes v)?> or <<touching (moving platforms v)?> or <touching (door v)?>>>>\n        if <(val) < [0]> then\n            change [playerx v] by (1)\n            position player\n        else\n            change [playerx v] by (-1)\n            position player\n        end\n    end\n    set [sx v] to [0]\nend\n\ndefine change player y by (val)\nchange [playery v] by (val)\nposition player\nif <touching (door v)?> then\n    set [touching door? v] to [1]\nelse\n    set [touching door? v] to [0]\nend\nif <<touching (hitboxes v)?> or <<touching (moving platforms v)?> or <touching (door v)?>>> then\n    repeat until <not <<touching (hitboxes v)?> or <<touching (moving platforms v)?> or <touching (door v)?>>>>\n        if <(val) > [0]> then\n            change [playery v] by (-1)\n            position player\n            set [in air? v] to [1]\n        else\n            change [playery v] by (1)\n            position player\n            set [in air? v] to [0]\n        end\n    end\n    set [sy v] to [0]\nelse\n    if <touching (water v)?> then\n        if <not <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n            change [sy v] by (-0.2)\n            set [in air? v] to [1]\n        end\n    else\n        if <not <touching (ladder v)?>> then\n            change [sy v] by (-1.2)\n            set [in air? v] to [1]\n        end\n    end\nend\n\ndefine position player\ngo to x: ((playerX) - (SCROLLX)) y: ((playerY) - (SCROLLY))\n\ndefine game tick\nBLANK\nswitch costume to (hitbox detect v)\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n    if <(Speed Boost) = [No]> then\n        change [sx v] by (-1)\n    else\n        change [sx v] by (-1.6)\n    end\nend\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(x position) < (mouse x)>>> then\n    if <(Speed Boost) = [No]> then\n        change [sx v] by (1)\n    else\n        change [sx v] by (1.7)\n    end\nend\nchange player x by (round (sx))\nposition player\nset [sx v] to ((sx) * (0.8))\nif <touching (bouncy 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 [sy v] to [21]\n    else\n        set [sy v] to [13]\n    end\n    broadcast (boing v)\nelse\n    if <touching (ladder v)?> then\n        if <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> or <<<key (down arrow v) pressed?> or <key (s v) pressed?>> or <<mouse down?> and <(y position) > (mouse y)>>>> then\n            if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> then\n                set [sy v] to [5]\n            end\n            if <<<key (down arrow v) pressed?> or <key (s v) pressed?>> or <<mouse down?> and <(y position) > (mouse y)>>> then\n                set [sy v] to [-5]\n            end\n        else\n            set [sy v] to [0]\n        end\n    else\n        if <<touching (water v)?> and <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n            set [sy v] to [5]\n        else\n            if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> then\n                if <(in air?) = [0]> then\n                    if <(Jump Boost) = [Yes]> then\n                        set [sy v] to [18]\n                    else\n                        set [sy v] to [13]\n                    end\n                    set [in air? v] to [0]\n                end\n            end\n        end\n    end\nend\nif <(playerX) < [-350]> then\n    set [playerx v] to [-350]\nend\nif <(playerX) > [7073]> then\n    set [playerx v] to [7073]\nend\nif <(sy) < [-30]> then\n    set [sy v] to [-30]\nend\nif <(sy) > [30]> then\n    set [sy v] to [30]\nend\nchange player y by (round (sy))\nposition player\nchange [scrollx v] by (round (((playerX) - (SCROLLX)) / (5)))\nchange [scrolly v] by (round (((playerY) - (SCROLLY)) / (5)))\nif <(SCROLLX) < [-130]> then\n    set [scrollx v] to [-130]\nend\nif <(SCROLLY) < [-150]> then\n    set [scrolly v] to [-150]\nend\nbroadcast (POSITION v)\nposition player\nCostume\nif <(playerY) < [-350]> then\n    start sound [Clang v]\n    broadcast (relight v)\n    Die\nend\nif <<touching (spikes v)?> and <(SPIKE RESISTANT?) = [No]>> then\n    start sound [Clang v]\n    broadcast (relight v)\n    Die\nend\n\nwhen flag clicked\nforever\n    wait until <touching (water v)?>\n    start sound [Small_Splash_Audio v]\n    wait until <not <touching (water v)?>>\n    wait (0.1) seconds\nend\n\nwhen I receive [touched enemy v]\nstart sound [Clang v]\nDie\nbroadcast (relight v)\n\nwhen I receive [kill enemy v]\nset [sy v] to [13]\nstart sound [High Whoosh v]\n\nwhen I receive [touching mv v]\nswitch costume to (hitbox detect v)\nif <(sy) > [0]> then\n    change player y by [10]\nelse\n    change player y by [-10]\nend\nCostume\n\ndefine Costume\nif <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> and <not <<<key (a v) pressed?> or <key (left arrow v) pressed?>> or <<key (right arrow v) pressed?> or <key (d v) pressed?>>>>> then\n    switch costume to (up v)\nelse\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n        switch costume to (left v)\n    else\n        if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(x position) < (mouse x)>>> then\n            switch costume to (right v)\n        else\n            switch costume to (middle v)\n        end\n    end\nend\nif <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <<key (right arrow v) pressed?> or <key (d v) pressed?>>> then\n    switch costume to (right + up v)\nend\nif <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <<key (left arrow v) pressed?> or <key (a v) pressed?>>> then\n    switch costume to (left + up v)\nend\nif <<<key (down arrow v) pressed?> or <key (s v) pressed?>> and <<key (right arrow v) pressed?> or <key (d v) pressed?>>> then\n    switch costume to (right + down v)\nend\nif <<<key (down arrow v) pressed?> or <key (s v) pressed?>> and <<key (left arrow v) pressed?> or <key (a v) pressed?>>> then\n    switch costume to (left + down v)\nend\nif <<<key (down arrow v) pressed?> or <key (s v) pressed?>> and <not <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<key (right arrow v) pressed?> or <key (d v) pressed?>>>>> then\n    switch costume to (down v)\nend\n\nwhen I receive [reached! v]\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nstop [other scripts in sprite v]\n\nwhen flag clicked\nset [key grabbed? v] to [false]\nforever\n    wait until <touching (key v)?>\n    set [key grabbed? v] to [true]\n    broadcast (hide key v)\n    stop [this script v]\nend\n\nwhen flag clicked\nforever\n    if <touching (enemies v)?> then\n        if <not <(sy) < [-2]>> then\n            start sound [Clang v]\n            broadcast (relight v)\n            Die\n        else\n            broadcast (kill enemy v)\n        end\n        wait until <not <touching (enemies v)?>>\n    end\nend\n\nwhen I receive [speak v]\nsay (@USERNAME@) for (4) seconds\n\nwhen [t v] key pressed\nif <not <<mouse down?> and <touching (mouse-pointer v)?>>> then\n    broadcast (chat v) and wait\nend\n\nwhen flag clicked\nforever\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        if <not <key (t v) pressed?>> then\n            broadcast (chat\(mobile\) v) and wait\n        end\n    end\n    wait until <not <<mouse down?> and <touching (mouse-pointer v)?>>>\nend\n\nwhen flag clicked\nforever\n    if <<(last_playerx) = (playerX)> and <(last_playery) = (playerY)>> then\n    if <[] > [5400]> then\n        set [@player slot@ v] to [0]\n        stop [this script v]\n    end\nend\n\nwhen I receive [chatting v]\nsay (answer) for (6) seconds\n\ndefine BLANK\n\ndefine Die\nswitch costume to (middle v)\nset [in air? v] to [1]\nset [playerx v] to (RES X)\nset [playery v] to (RES Y)\nset [scrollx v] to ((playerX) + (100))\nset [scrolly v] to (playerY)\nset [sx v] to [0]\nset [sy v] to [0]\nposition player\nbroadcast (POSITION v)\nbroadcast (set up enemies v) and wait\nbroadcast (Loose Coins v)\n\nwhen I receive [die v]\nswitch costume to (middle v)\nset [in air? v] to [1]\nset [playerx v] to (RES X)\nset [playery v] to (RES Y)\nset [scrollx v] to ((playerX) + (100))\nset [scrolly v] to (playerY)\nset [sx v] to [0]\nset [sy v] to [0]\nposition player\nbroadcast (POSITION v)\nbroadcast (set up enemies v) and wait\n\nwhen flag clicked\nforever\n    if <(Sound Effects) = [On]> then\n        set volume to (100) %\n    else\n        set volume to (0) %\n    end\nend\n\nwhen flag clicked\nset [brightness v] effect to (100)\nwait (1.6) seconds\nrepeat (20)\n    change [brightness v] effect by (-5)\nend\n\nwhen I receive [loose coins v]\nif <(Coins) > [9]> then\n    repeat (10)\n        change [coins v] by (-1)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Shrunk) = [Yes]> then\n        set size to (60) %\n    else\n        set size to (100) %\n    end\nend\n\n@Hitboxes\n\nwhen I receive [position v]\nposition (round ((x) - (SCROLLX))) (round ((y) - (SCROLLY)))\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(round (x)) = (round (x position))> and <(round (y)) = (round (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)\nnext costume\n\nwhen I receive [set up v]\nshow\ngo to [front v] layer\nset [ghost v] effect to (100)\nswitch costume to (1 v)\nclone\n\ndefine clone\nclone at [0] [-150]\nclone at [-215] [380]\nclone at [1280] [20]\nclone at [1980] [20]\nclone at [2800] [40]\nclone at [3500] [600]\nclone at [4000] [930]\nclone at [4350] [800]\nclone at [5900] [1889]\nclone at [6100] [1271]\nclone at [5956] [2343]\nclone at [6156] [2650]\nclone at [7055] [1271]\nclone at [7055] [764]\nset [x v] to [-9999999999999999]\n\n@Background\n\nwhen I receive [position v]\nposition (round ((x) - (SCROLLX))) (round ((y) - (SCROLLY)))\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(round (x)) = (round (x position))> and <(round (y)) = (round (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)\nnext costume\n\nwhen I receive [set up v]\nrepeat (2)\n    go to [back v] layer\nend\nswitch costume to (1 v)\nclone\n\ndefine clone\nclone at [0] [-150]\nclone at [-215] [380]\nclone at [1280] [20]\nclone at [1980] [20]\nclone at [2800] [40]\nclone at [3500] [600]\nclone at [4000] [930]\nclone at [4350] [800]\nclone at [5000] [1889]\nclone at [6100] [1271]\nclone at [5956] [2343]\nclone at [6156] [2650]\nclone at [7055] [1271]\nclone at [7055] [764]\nset [x v] to [-9999999999999999]\n\n@Spikes\n\nwhen I receive [position v]\nposition (round ((x) - (SCROLLX))) (round ((y) - (SCROLLY)))\nif <(costume [number v]) = [1]> then\n    turn left (10) degrees\nelse\n    point in direction (90)\nend\n\ndefine position (x) (y)\nset size to (400) %\ngo to x: (x) y: (y)\nset size to (100) %\nif <<(round (x)) = (round (x position))> and <(round (y)) = (round (y position))>> then\n    show\nelse\n    hide\nend\n\ndefine clone at x: (x) y: (y) Costume (cos)\nswitch costume to (cos)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\n\nwhen I receive [set up v]\nswitch costume to (saw v)\nrepeat (3)\n    go to [back v] layer\nend\nclone at x: [-120] y: [-110] Costume [1]\nclone at x: [-0] y: [-110] Costume [1]\nclone at x: [1986] y: [20] Costume [1]\nclone at x: [2130] y: [-15] Costume [1]\nclone at x: [2284] y: [-11] Costume [1]\nclone at x: [2615] y: [60] Costume [1]\nclone at x: [2800] y: [380] Costume [1]\nclone at x: [2964] y: [384] Costume [1]\nclone at x: [3070] y: [1138] Costume [1]\nclone at x: [3200] y: [1016] Costume [1]\nclone at x: [3330] y: [1138] Costume [1]\nclone at x: [3480] y: [300] Costume [1]\nclone at x: [3580] y: [300] Costume [1]\nclone at x: [3690] y: [300] Costume [1]\nset [x v] to [-9999999999999999]\n\nwhen I receive [die v]\n\n@Ladder\n\nwhen I receive [position v]\nposition (round ((x) - (SCROLLX))) (round ((y) - (SCROLLY)))\n\ndefine position (x) (y)\nset size to (400) %\ngo to x: (x) y: (y)\nset size to (100) %\nif <<(round (x)) = (round (x position))> and <(round (y)) = (round (y position))>> then\n    show\nelse\n    hide\nend\n\ndefine clone at (x) (y) (cos)\nswitch costume to (cos)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\n\nwhen I receive [set up v]\nrepeat (2)\n    go to [back v] layer\n    go to [back v] layer\nend\nswitch costume to (1 v)\nclone at [50] [60] [4]\nclone at [-310] [-226] [2]\nclone at [1540] [190] [4]\nclone at [2435] [1320] [4]\nclone at [3000] [900] [3]\nclone at [3400] [800] [4]\nclone at [3400] [1100] [4]\nclone at [3400] [1400] [4]\nclone at [3400] [1700] [4]\nclone at [3400] [2000] [4]\nset [x v] to [-9999999999999999]\n\n@Bouncy\n\nwhen I receive [position v]\nposition (round ((x) - (SCROLLX))) (round ((y) - (SCROLLY)))\n\ndefine position (x) (y)\nset size to (400) %\ngo to x: (x) y: (y)\nset size to (100) %\nif <<(round (x)) = (round (x position))> and <(round (y)) = (round (y position))>> then\n    show\nelse\n    hide\nend\n\ndefine clone at (x) (y)\nswitch costume to ( v)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\n\nwhen I receive [set up v]\nswitch costume to ( v)\nclone at [1020] [-55]\nclone at [2900] [400]\nclone at [3300] [2107]\nset [x v] to [-9999999999999999]\n\nwhen I receive [boing v]\nif <(Sound Effects) = [On]> then\n    start sound [boing v]\nelse\nend\nclear graphic effects\nrepeat (10)\n    change [ghost v] effect by (5)\nend\nrepeat (10)\n    change [ghost v] effect by (-5)\nend\n\n@Checkpoints\n\nwhen I receive [position v]\ngo to [back v] layer\nset size to (400) %\ngo to x: ((x) - (SCROLLX)) y: ((y) - (SCROLLY))\nset size to (100) %\n\nwhen I receive [set up v]\nclone at [698] [-70] [1]\nclone at [2200] [40] [1]\nclone at [3050] [2140] [1]\nset [x v] to [-99999999999]\n\ndefine clone at (x) (y) (type)\nswitch costume to (type)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nforever\n    if <touching (player v)?> then\n        set [res x v] to (x)\n        set [res y v] to (y)\n        if <(Sound Effects) = [On]> then\n            start sound [Water Drop v]\n            broadcast (Coins go up x2 v)\n        end\n        repeat (5)\n            change [brightness v] effect by (20)\n            change [ghost v] effect by (10)\n        end\n        switch costume to (1 v)\n        repeat (5)\n            change [brightness v] effect by (-20)\n        end\n        clear graphic effects\n        set [ghost v] effect to (0)\n        stop [this script v]\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Sound Effects) = [On]> then\n        set volume to (80) %\n    else\n        set volume to (0) %\n    end\nend\n\nwhen I receive [coins go up x2 v]\nbroadcast (Coins go up v) and wait\nbroadcast (Coins go up v)\n\n@Enemies\n\nwhen I receive [position v]\nposition (round (((x) - (SCROLLX)) + (([sin v] of ((timer) * (100)) ) * (100)))) (round ((y) - (SCROLLY)))\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(round (x)) = (round (x position))> and <(round (y)) = (round (y position))>> then\n    show\nelse\n    hide\nend\n\ndefine clone at (x) (y)\nclear graphic effects\nswitch costume to (enemy v)\nset [x v] to (x)\nset [y v] to (y)\nposition ((x) - (SCROLLX)) ((y) - (SCROLLY))\ncreate clone of (_myself_ v)\n\nwhen I receive [set up enemies v]\nbroadcast (delete enemy clones v) and wait\nclone\n\nwhen I receive [delete enemy clones v]\ndelete this clone\n\nwhen I receive [kill enemy v]\nif <touching (player v)?> then\n    broadcast (Coins go up v)\n    repeat (5)\n        change [ghost v] effect by (20)\n        change [y v] by (-5)\n    end\n    delete this clone\nend\n\ndefine clone\nshow\nswitch costume to (enemy v)\nclone at [850] [-107]\nclone at [2470] [73]\nset [x v] to [-9999999999999999]\n\ngo to [front v] layer\n\nwhen flag clicked\nforever\n    if <(Sound Effects) = [On]> then\n        set volume to (80) %\n    else\n        set volume to (0) %\n    end\nend\n\nwhen I receive [coins go up v]\nrepeat (10)\n    change [coins v] by (1)\nend\n\n@Menu\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset size to (100) %\ngo to [front v] layer\ngo [backward v] (3) layers\nset [ghost v] effect to (27)\nhide\n\nwhen I receive [green flag v]\nshow\nforever\n    if <(mouse y) > [166]> then\n        repeat (11)\n            change y by (-3)\n        end\n        repeat (6)\n            change y by (-2)\n        end\n        repeat (6)\n            change y by (-1)\n        end\n        wait until <not <(mouse y) > [140]>>\n        repeat (11)\n            change y by (3)\n        end\n        repeat (6)\n            change y by (2)\n        end\n        repeat (6)\n            change y by (1)\n        end\n    end\nend\n\n@Coins\n\nwhen I receive [set up v]\nclone at x: [-44] y: [500] [4]\nclone at x: [-203] y: [500] [4]\nclone at x: [-330] y: [510] [2]\nclone at x: [-300] y: [635] [1]\nclone at x: [-250] y: [635] [1]\nclone at x: [-200] y: [635] [1]\nclone at x: [-150] y: [635] [1]\nclone at x: [-100] y: [635] [1]\nclone at x: [-50] y: [635] [1]\nclone at x: [0] y: [635] [1]\nclone at x: [50] y: [635] [1]\nclone at x: [-310] y: [-300] [2]\nclone at x: [-115] y: [-25] [1]\nclone at x: [0] y: [-25] [1]\nclone at x: [0] y: [250] [1]\nclone at x: [-50] y: [250] [1]\nclone at x: [-100] y: [250] [1]\nclone at x: [-150] y: [250] [1]\nclone at x: [-200] y: [250] [1]\nclone at x: [-250] y: [250] [1]\nclone at x: [100] y: [-160] [1]\nclone at x: [150] y: [-160] [1]\nclone at x: [200] y: [-160] [1]\nclone at x: [250] y: [-160] [1]\nclone at x: [300] y: [-160] [1]\nclone at x: [350] y: [-160] [1]\nclone at x: [400] y: [-160] [1]\nclone at x: [450] y: [-160] [1]\nclone at x: [500] y: [-160] [1]\nclone at x: [550] y: [-160] [1]\nclone at x: [600] y: [-160] [1]\nclone at x: [650] y: [-100] [1]\nclone at x: [700] y: [-100] [1]\nclone at x: [750] y: [-100] [1]\nclone at x: [800] y: [-100] [1]\nclone at x: [850] y: [-100] [1]\nclone at x: [900] y: [-100] [1]\nclone at x: [950] y: [-100] [1]\nclone at x: [1025] y: [0] [1]\nclone at x: [1025] y: [50] [1]\nclone at x: [1025] y: [100] [1]\nclone at x: [1025] y: [150] [1]\nclone at x: [-330] y: [310] [2]\nclone at x: [1100] y: [120] [1]\nclone at x: [1205] y: [90] [1]\nclone at x: [1300] y: [60] [1]\nclone at x: [1393] y: [78] [1]\nclone at x: [1480] y: [70] [1]\nclone at x: [1600] y: [390] [1]\nclone at x: [1730] y: [250] [1]\nclone at x: [1830] y: [175] [1]\nclone at x: [1950] y: [90] [1]\nclone at x: [2048] y: [10] [1]\nclone at x: [2078] y: [10] [1]\nclone at x: [2200] y: [10] [1]\nclone at x: [2300] y: [80] [1]\nclone at x: [2350] y: [80] [1]\nclone at x: [2400] y: [80] [1]\nclone at x: [2450] y: [80] [1]\nclone at x: [2500] y: [80] [1]\nclone at x: [2550] y: [80] [1]\nclone at x: [2650] y: [150] [1]\nclone at x: [2650] y: [200] [1]\nclone at x: [2650] y: [250] [1]\nclone at x: [2650] y: [300] [1]\nclone at x: [2650] y: [350] [1]\nclone at x: [2650] y: [400] [1]\nclone at x: [2730] y: [410] [1]\nclone at x: [2905] y: [450] [1]\nclone at x: [2905] y: [500] [1]\nclone at x: [2905] y: [550] [1]\nclone at x: [2905] y: [600] [1]\nclone at x: [3000] y: [650] [1]\nclone at x: [3000] y: [700] [1]\nclone at x: [3000] y: [750] [1]\nclone at x: [3050] y: [1040] [1]\nclone at x: [3100] y: [1040] [1]\nclone at x: [3150] y: [1040] [1]\nclone at x: [3250] y: [1040] [1]\nclone at x: [3300] y: [1040] [1]\nclone at x: [3350] y: [1040] [1]\nclone at x: [3400] y: [660] [2]\nclone at x: [2330] y: [1530] [3]\nclone at x: [3050] y: [2115] [1]\nclone at x: [3100] y: [2115] [1]\nclone at x: [3150] y: [2115] [1]\nclone at x: [3200] y: [2115] [1]\nclone at x: [3250] y: [2115] [1]\nclone at x: [3350] y: [2115] [1]\nclone at x: [3400] y: [2195] [2]\nclone at x: [3300] y: [2315] [3]\nclone at x: [3455] y: [500] [1]\nclone at x: [3505] y: [500] [1]\nclone at x: [3555] y: [500] [1]\nclone at x: [3605] y: [500] [1]\nclone at x: [3655] y: [500] [1]\nclone at x: [3705] y: [500] [1]\nclone at x: [3755] y: [580] [1]\nclone at x: [3852.2] y: [650] [1]\nclone at x: [3852.2] y: [700] [1]\nclone at x: [3852.2] y: [750] [1]\nclone at x: [3852.2] y: [800] [1]\nclone at x: [3852.2] y: [850] [1]\nclone at x: [3852.2] y: [940] [3]\nclone at x: [3943] y: [842] [2]\nclone at x: [3455] y: [200] [1]\nclone at x: [3505] y: [200] [1]\nclone at x: [3555] y: [200] [1]\nclone at x: [3605] y: [200] [1]\nclone at x: [3655] y: [200] [1]\nclone at x: [3705] y: [200] [1]\nclone at x: [3455] y: [150] [1]\nclone at x: [3505] y: [150] [1]\nclone at x: [3555] y: [150] [1]\nclone at x: [3605] y: [150] [1]\nclone at x: [3655] y: [150] [1]\nclone at x: [3705] y: [150] [1]\nclone at x: [3455] y: [100] [1]\nclone at x: [3505] y: [100] [1]\nclone at x: [3555] y: [100] [1]\nclone at x: [3605] y: [100] [1]\nclone at x: [3655] y: [100] [1]\nclone at x: [3705] y: [100] [1]\nclone at x: [3455] y: [50] [1]\nclone at x: [3505] y: [50] [1]\nclone at x: [3555] y: [50] [1]\nclone at x: [3605] y: [50] [1]\nclone at x: [3655] y: [50] [1]\nclone at x: [3705] y: [50] [1]\nclone at x: [3455] y: [11] [1]\nclone at x: [3505] y: [11] [1]\nclone at x: [3555] y: [11] [1]\nclone at x: [3605] y: [11] [1]\nclone at x: [3655] y: [11] [1]\nclone at x: [3705] y: [11] [1]\nset [x v] to [-9999999999999999999]\n\ndefine clone at x: (x) y: (y) (cos)\nswitch costume to (cos)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\n\nwhen I receive [position v]\ngo to [front v] layer\ngo [backward v] (60) layers\nset size to (400) %\ngo to x: ((x) - (SCROLLX)) y: ((y) - (SCROLLY))\nset size to (65) %\n\nwhen I start as a clone\nwait (pick random (1) to (3)) seconds\nforever\n    repeat (12)\n        change [y v] by (0.5)\n        wait (0.01) seconds\n    end\n    repeat (12)\n        change [y v] by (-0.5)\n        wait (0.01) seconds\n    end\nend\n\nwhen I start as a clone\nforever\n    if <<touching (player v)?> and <(costume [number v]) = [1]>> then\n        change [coins v] by (5)\n        set volume to (30) %\n        start sound [Ring Tone4 v]\n        repeat (5)\n            change [ghost v] effect by (20)\n        end\n        delete this clone\n    end\n    if <<touching (player v)?> and <(costume [number v]) = [2]>> then\n        change [coins v] by (50)\n        set volume to (30) %\n        start sound [Ring Tone4 v]\n        repeat (5)\n            change [ghost v] effect by (20)\n        end\n        delete this clone\n    end\n    if <<touching (player v)?> and <(costume [number v]) = [3]>> then\n        change [coins v] by (70)\n        set volume to (30) %\n        start sound [Ring Tone4 v]\n        repeat (5)\n            change [ghost v] effect by (20)\n        end\n        delete this clone\n    end\n    if <<touching (player v)?> and <(costume [number v]) = [4]>> then\n        change [coins v] by (500)\n        set volume to (30) %\n        start sound [Ring Tone4 v]\n        repeat (5)\n            change [ghost v] effect by (20)\n        end\n        delete this clone\n    end\nend\n\nwhen I start as a clone\nset size to (100) %\nshow\nforever\n    repeat (40)\n        change size by (0.6)\n    end\n    repeat (40)\n        change size by (-0.6)\n    end\nend\n\n@Coin Display\n\nwhen flag clicked\nset size to (100) %\nshow\ngo to x: (-222) y: (157)\nset size to (100) %\nwait (1.5) seconds\nforever\n    go to [front v] layer\nend\n\nwhen I receive [show end screen with higscore v]\nforever\n    hide\nend\n\nwhen flag clicked\nforever\n    repeat (40)\n        change size by (0.6)\n    end\n    repeat (40)\n        change size by (-0.6)\n    end\nend\n\n@Moving Platforms\n\nwhen I receive [position v]\nif <(costume [number v]) = [1]> then\n    position (round (((x) - (SCROLLX)) + (([cos v] of ((days since 2000) * (4000000)) ) * (200)))) (round ((y) - (SCROLLY)))\n    if <touching (player v)?> then\n        broadcast (touching mv v)\n    end\nend\nif <(costume [number v]) = [2]> then\n    position (round ((x) - (SCROLLX))) (round (((y) - (SCROLLY)) + (([cos v] of ((days since 2000) * (5000000)) ) * (100))))\n    if <touching (player v)?> then\n        broadcast (touching mv v)\n    end\nend\nif <(costume [number v]) = [3]> then\n    position (round (((x) - (SCROLLX)) + (([cos v] of ((days since 2000) * (4000000)) ) * (200)))) (round (((y) - (SCROLLY)) + (([cos v] of ((days since 2000) * (4000000)) ) * (150))))\n    if <touching (player v)?> then\n        broadcast (touching mv v)\n    end\nend\n\ndefine position (x) (y)\nset size to (400) %\ngo to x: (x) y: (y)\nset size to (100) %\nif <<(round (x)) = (round (x position))> and <(round (y)) = (round (y position))>> then\n    show\nelse\n    hide\nend\n\ndefine clone at (x) (y) (cos)\nswitch costume to (cos)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\n\nwhen I receive [set up v]\nset [sfx_waveplayed v] to [0]\ngo to [back v] layer\nswitch costume to (1 v)\nclone at [500] [-100] [1]\nclone at [2701] [180] [2]\nclone at [3050] [650] [2]\nclone at [3900] [700] [2]\nset [x v] to [-9999999999999999]\n\n@Water\n\nwhen I receive [position v]\nposition (round ((x) - (SCROLLX))) (round (((y) - (SCROLLY)) + (([sin v] of ((timer) * (50)) ) * (30))))\n\ndefine position (x) (y)\nset size to (400) %\ngo to x: (x) y: (y)\nset size to (100) %\nif <<(round (x)) = (round (x position))> and <(round (y)) = (round (y position))>> then\n    show\nelse\n    hide\nend\n\ndefine clone at (x) (y) (cos)\nswitch costume to (cos)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\n\nwhen I receive [set up v]\nset [sfx_waveplayed v] to [0]\nrepeat (4)\n    go to [back v] layer\nend\nswitch costume to (1 v)\nclone at [-300] [-330] [2]\nclone at [-300] [-230] [1]\nclone at [3600] [-600] [2]\nclone at [3600] [-400] [2]\nclone at [3600] [-200] [2]\nclone at [3600] [0] [2]\nclone at [3600] [100] [2]\nclone at [3600] [300] [2]\nclone at [3600] [500] [2]\n\nwhen I start as a clone\nforever\n    if <(costume [number v]) = [1]> then\n        if <([abs v] of (distance to [player v]) ) < [300]> then\n            if <not <(SFX_WAVEPLAYED) = [1]>> then\n                broadcast (try to play sound v) and wait\n            end\n        end\n    end\nend\n\nwhen I receive [try to play sound v]\nif <not <(SFX_WAVEPLAYED) = [1]>> then\n    set [sfx_waveplayed v] to [1]\n    play sound [ocean wave v] until done\n    set [sfx_waveplayed v] to [0]\nend\n\nif <(Sound Effects) = [On]> then\n\nwhen flag clicked\nforever\n    if <(Sound Effects) = [On]> then\n        set volume to (80) %\n    else\n        set volume to (0) %\n    end\nend\n\n@C L O U D\n\nwhen flag clicked\nhide\nforever\n    create clone of (_myself_ v)\n    wait (pick random (1) to (3)) seconds\nend\n\nwhen I start as a clone\nswitch costume to (pick random (1) to (2))\ngo to [back v] layer\nset [speed v] to (pick random (1) to (3))\nshow\nset size to (pick random (50) to (150)) %\nset [ghost v] effect to (pick random (50) to (80))\nif <(pick random (1) to (2)) = [1]> then\n    go to x: (-240) y: (pick random (100) to (180))\n    repeat until <(x position) > [240]>\n        change x by (speed)\n    end\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\nelse\n    go to x: (240) y: (pick random (100) to (180))\n    repeat until <(x position) < [-240]>\n        change x by ((speed) - ((speed) * (2)))\n    end\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\nend\ndelete this clone\n\nwhen flag clicked\nforever\n    hide\nend\n\n@Finish\n\ndefine set end flag at (x) (y)\nswitch costume to (2 v)\nset [x v] to (x)\nset [y v] to (y)\ncreate clone of (_myself_ v)\nswitch costume to (1 v)\ncreate clone of (_myself_ v)\n\nwhen I receive [position v]\nposition ((x) - (SCROLLX)) ((y) - (SCROLLY))\n\nwhen I receive [set up v]\nset [reached end? v] to [false]\nset end flag at [4040] [700]\nset [x v] to [-999999999]\n\ndefine position (x) (y)\ngo to x: (round (x)) y: (round (y))\nif <<(round (x)) = (x position)> and <(round (y)) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I start as a clone\nset [ghost v] effect to (0)\nforever\n    if <touching (player v)?> then\n        repeat (10)\n            change [ghost v] effect by (25)\n        end\n        set [reached end? v] to [true]\n        stop [this script v]\n    end\nend\n\nwhen I start as a clone\nforever\n    if <(costume [number v]) = [2]> then\n        wait until <(REACHED END?) = [true]>\n        if <[] < (HIGHSCORE\(value only\))> then\n            broadcast (new highscore v)\n            if <(Sound Effects) = [On]> then\n                start sound [Win v]\n            end\n            broadcast (reached! v)\n            repeat (8)\n                change [y v] by (-5)\n                position ((x) - (SCROLLX)) ((y) - (SCROLLY))\n            end\n            wait (2) seconds\n            if <[] = (HIGHSCORE\(value only\))> then\n                broadcast (show end screen with higscore v)\n            else\n                broadcast (show end screen v)\n            end\n            stop [this script v]\n        end\n    end\nend\n\nwhen flag clicked\nwait until <<key (any v) pressed?> or <mouse down?>>\nreset timer\n\ndefine reset highscore to (val) <lock>\nif <lock> then\n    broadcast (new highscore v)\nend\n\nwhen I start as a clone\nforever\n    turn right (2) degrees\nend\n\n@End Screen\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\nset [ghost v] effect to (100)\n\nwhen I receive [show end screen v]\nset [@player slot@ v] to [0]\nswitch costume to ( v)\nrepeat (10)\n    go to [front v] layer\n    change [ghost v] effect by (-10)\nend\n\nwhen I receive [show end screen with higscore v]\nset [@player slot@ v] to [0]\nswitch costume to (new highscore v)\nrepeat (10)\n    go to [front v] layer\n    change [ghost v] effect by (-10)\nend\n\n@Cloud Data\n\ndefine delete and rewrite code data list\ndelete all of [run:data v]\nset [readdata# v] to [1]\nset [datachars v] to [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-*/~`!@#$%^&*\(\)_=\[\]\{}|;':",./<>?]\nrepeat (99)\n    add [] to [run:data v]\nend\nrepeat (length of (datachars))\n    add (letter (readdata#) of (datachars)) to [run:data v]\n    change [readdata# v] by (1)\nend\nadd [ ] to [run:data v]\n\ndefine encode string (val) and add to encoded value (new encode section?) (boolean)\nswitch costume to (lowercase v)\nif <(boolean) = [true]> then\n    set [encoded value v] to []\nend\nset [readdata# v] to [1]\nrepeat (length of (val))\n    set [word v] to (letter (readdata#) of (val))\n    switch costume to (join (word) [\)])\n    set [word v] to (item # of (word) in [run:data v])\n    if <(costume [name v]) = [lowercase]> then\n        if <not <(word) = [0]>> then\n            set [encoded value v] to (join (encoded value) (word))\n        else\n            set [encoded value v] to (join (encoded value) (item # of [*] in [run:data v]))\n        end\n    else\n        if <not <(word) = [0]>> then\n            set [encoded value v] to (join (encoded value) ((word) + (26)))\n        else\n            set [encoded value v] to (join (encoded value) (item # of [*] in [run:data v]))\n        end\n    end\n    switch costume to (lowercase v)\n    change [readdata# v] by (1)\nend\nset [encoded value v] to (join (encoded value) [000])\n\ndefine decode string (code) and add to value (new decode section?) (boolean)\nset [decoded result v] to []\nif <(boolean) = [true]> then\n    set [encoded value v] to (code)\n    set [readdata# v] to [1]\nend\nforever\n    set [decode idx v] to (join (letter (readdata#) of (encoded value)) (join (letter ((readdata#) + (1)) of (encoded value)) (letter ((readdata#) + (2)) of (encoded value))))\n    change [readdata# v] by (3)\n    if <(decode IDX) < [1]> then\n        stop [this script v]\n    end\n    set [decoded result v] to (join (decoded result) (item (decode IDX) of [run:data v]))\nend\n\nwhen flag clicked\nset [@username@ v] to (username)\nset [ghost v] effect to (10)\ngo to [front v] layer\ngo [backward v] (1) layers\nhide\nset [@player slot@ v] to [0]\nset [@connected@? v] to <(@PLAYER SLOT@) > [0]>\nclone: [7]\nbroadcast (tick v)\nbroadcast (@GET_SLOT v) and wait\n\ndefine clone: (opponents count)\nset [offline frames v] to [0]\nset [clone# v] to [1]\nrepeat ((opponents count) - (1))\n    create clone of (_myself_ v)\n    change [clone# v] by (1)\nend\n\ndefine send (data) to (cloud#)\nif <(cloud#) = [1]> then\n    set [☁ p1 v] to (data)\nelse\n    if <(cloud#) = [2]> then\n        set [☁ p2 v] to (data)\n    else\n        if <(cloud#) = [3]> then\n            set [☁ p3 v] to (data)\n        else\n            if <(cloud#) = [4]> then\n                set [☁ p4 v] to (data)\n            else\n                if <(cloud#) = [5]> then\n                    set [☁ p5 v] to (data)\n                else\n                    if <(cloud#) = [6]> then\n                        set [☁ p6 v] to (data)\n                    else\n                        if <(cloud#) = [7]> then\n                            set [☁ p7 v] to (data)\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine get val (cloud#)\nif <(cloud#) = [1]> then\n    set [decoded result v] to (☁ P1)\nelse\n    if <(cloud#) = [2]> then\n        set [decoded result v] to (☁ P2)\n    else\n        if <(cloud#) = [3]> then\n            set [decoded result v] to (☁ P3)\n        else\n            if <(cloud#) = [4]> then\n                set [decoded result v] to (☁ P4)\n            else\n                if <(cloud#) = [5]> then\n                    set [decoded result v] to (☁ P5)\n                else\n                    if <(cloud#) = [6]> then\n                        set [decoded result v] to (☁ P6)\n                    else\n                        if <(cloud#) = [7]> then\n                            set [decoded result v] to (☁ P7)\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [@get_slot v]\nbroadcast (connecting v)\nget val (clone#)\nset [slot_last_val v] to (join [A] (decoded result))\nwait (4) seconds\nget val (clone#)\nif <(join [A] (decoded result)) = (slot_last_val)> then\n    set [@player slot@ v] to (clone#)\nend\nif <(@PLAYER SLOT@) > [0]> then\n    broadcast (connected v)\nelse\n    broadcast (failed v)\nend\nset [@connected@? v] to [true]\n\nwhen I receive [tick v]\nforever\n    if <(@PLAYER SLOT@) = (clone#)> then\n        hide\n        encode string ([playerx v] of [player v]) and add to encoded value (new encode section?) [true]\n        encode string ([playery v] of [player v]) and add to encoded value (new encode section?) []\n        encode string ([costume name v] of [player v]) and add to encoded value (new encode section?) []\n        encode string (@USERNAME@) and add to encoded value (new encode section?) []\n        encode string (round ((days since 2000) * (1000000))) and add to encoded value (new encode section?) []\n        send (encoded value) to (@PLAYER SLOT@)\n    else\n        disconnection time out: [70]\n        decode string (☁ C_HIGHSCORE) and add to value (new decode section?) [true]\n        set [highscore\(decoded\) v] to (decoded result)\n        set [highscore\(value only\) v] to (decoded result)\n        decode string [] and add to value (new decode section?) []\n        set [highscore\(decoded\) v] to (join (HIGHSCORE\(decoded\)) (join [  by  ] (decoded result)))\n        get val (clone#)\n        decode string (decoded result) and add to value (new decode section?) [true]\n        change [self.x v] by (((decoded result) - (self.x)) / (2.5))\n        decode string [] and add to value (new decode section?) []\n        change [self.y v] by (((decoded result) - (self.y)) / (2.5))\n        decode string [] and add to value (new decode section?) []\n        switch costume to (decoded result)\n        position ((self.x) - (SCROLLX)) ((self.y) - (SCROLLY))\n    end\nend\n\nwhen I receive [relight v]\nset [brightness v] effect to (100)\nrepeat (10)\n    change [brightness v] effect by (-10)\nend\n\nwhen flag clicked\nhide variable [☁ c_highscore v]\nhide variable [highscore\(value only\) v]\nhide variable [☁ p1 v]\nhide variable [☁ p2 v]\nhide variable [☁ p3 v]\nhide variable [☁ p4 v]\nhide variable [☁ p5 v]\nhide variable [☁ p6 v]\nhide variable [☁ p7 v]\n\nwhen I receive [new highscore v]\nrepeat (10)\n    encode string (@TIME@) and add to encoded value (new encode section?) [true]\n    encode string (username) and add to encoded value (new encode section?) []\n    set [☁ c_highscore v] to (encoded value)\nend\n\ndefine position (x) (y)\ngo to x: (x) y: (y)\nif <<(round (x position)) = (round (x))> and <(round (y position)) = (round (y))>> then\n    point in direction (90)\n    decode string [] and add to value (new decode section?) []\n    think (decoded result)\nelse\n    switch costume to (arrow v)\n    point towards (b l a n k v)\n    move (20) steps\n    if <touching (mouse-pointer v)?> then\n        decode string [] and add to value (new decode section?) []\n        think (decoded result)\n    else\n        think []\n    end\nend\n\ndefine disconnection time out: (frames)\nget val (clone#)\nif <(join [A] (decoded result)) = (disconnection_value)> then\n    change [offline frames v] by (1)\n    if <(offline frames) > (frames)> then\n        hide\n    end\nelse\n    set [offline frames v] to [0]\n    set [disconnection_value v] to (join [A] (decoded result))\n    if <(@CONNECTED@?) = [true]> then\n        show\n    end\nend\n\n@Coins count\n\nwhen flag clicked\nset size to (20) %\nhide\nwait (1.5) seconds\nset [digits v] to [0]\nset [coins v] to [0]\nrepeat (20)\n    change [digits v] by (1)\n    create clone of (_myself_ v)\nend\nforever\n    set [time v] to (Coins)\nend\n\nwhen I start as a clone\ngo to [front v] layer\nset [brightness v] effect to (100)\nshow\nset size to (47) %\nforever\n    go to x: ((((Digits) * (22)) + (106)) - (320)) y: (157)\n    if <(length of (Coins)) < (Digits)> then\n        hide\n    else\n        show\n        if <(letter (Digits) of (Coins)) = [.]> then\n            switch costume to (blank v)\n        else\n            switch costume to (letter (Digits) of (Coins))\n        end\n    end\nend\n\n@Reset\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset size to (100) %\nhide\n\nwhen I receive [green flag v]\nshow\ngo to [front v] layer\nforever\n    set [ghost v] effect to (27)\n    if <(mouse y) > [166]> then\n        repeat (11)\n            change y by (-3)\n        end\n        repeat (6)\n            change y by (-2)\n        end\n        repeat (6)\n            change y by (-1)\n        end\n        wait until <not <(mouse y) > [140]>>\n        repeat (11)\n            change y by (3)\n        end\n        repeat (6)\n            change y by (2)\n        end\n        repeat (6)\n            change y by (1)\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (mouse-pointer v)?> then\n        switch costume to (2 v)\n    else\n        switch costume to (1 v)\n    end\nend\n\nwhen this sprite clicked\nbroadcast (die v)\n\n@Music\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset size to (100) %\nhide\n\nwhen I receive [green flag v]\nshow\ngo to [front v] layer\nforever\n    set [ghost v] effect to (27)\n    if <(mouse y) > [166]> then\n        repeat (11)\n            change y by (-3)\n        end\n        repeat (6)\n            change y by (-2)\n        end\n        repeat (6)\n            change y by (-1)\n        end\n        wait until <not <(mouse y) > [140]>>\n        repeat (11)\n            change y by (3)\n        end\n        repeat (6)\n            change y by (2)\n        end\n        repeat (6)\n            change y by (1)\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (-20)\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen this sprite clicked\nnext costume\n\nwhen flag clicked\nforever\n    if <(costume [number v]) = [1]> then\n        set [music v] to [On]\n    else\n        set [music v] to [Off]\n    end\nend\n\nwhen I receive [aaa change music v]\nstop all sounds\nplay sound [ v] until done\n\n@Sound Effects\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset size to (100) %\nhide\n\nwhen I receive [green flag v]\nshow\ngo to [front v] layer\nforever\n    set [ghost v] effect to (27)\n    if <(mouse y) > [166]> then\n        repeat (11)\n            change y by (-3)\n        end\n        repeat (6)\n            change y by (-2)\n        end\n        repeat (6)\n            change y by (-1)\n        end\n        wait until <not <(mouse y) > [140]>>\n        repeat (11)\n            change y by (3)\n        end\n        repeat (6)\n            change y by (2)\n        end\n        repeat (6)\n            change y by (1)\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (-20)\n    else\n        set [brightness v] effect to (0)\n    end\nend\n\nwhen this sprite clicked\nnext costume\n\nwhen flag clicked\nforever\n    if <(costume [number v]) = [1]> then\n        set [sound effects v] to [On]\n    else\n        set [sound effects v] to [Off]\n    end\nend\n\n@Shop\n\nwhen flag clicked\nhide\ngo to [front v] layer\ngo [backward v] (20) layers\n\nwhen this sprite clicked\nbroadcast (Hide Shop v)\nrepeat (10)\n    change y by (-15)\nend\nrepeat (11)\n    change y by (-13)\nend\nrepeat (10)\n    change y by (-10)\nend\nrepeat (10)\n    change y by (-5)\nend\nrepeat (10)\n    change y by (-4)\nend\nrepeat (6)\n    change y by (-2)\nend\nrepeat (4)\n    change y by (-1)\nend\nhide\n\nwhen I receive [shop v]\nshow\ngo to x: (0) y: (-600)\nrepeat (11)\n    change y by (15)\nend\nrepeat (10)\n    change y by (13)\nend\nrepeat (10)\n    change y by (10)\nend\nrepeat (10)\n    change y by (5)\nend\nrepeat (10)\n    change y by (4)\nend\nrepeat (6)\n    change y by (2)\nend\nrepeat (4)\n    change y by (1)\nend\n\n@Shop Item 1\n\nwhen flag clicked\nhide\nset [speed boost v] to [No]\nforever\n    go to [front v] layer\nend\n\nwhen this sprite clicked\nif <(Coins) > [99]> then\n    set [speed boost v] to [Yes]\n    change [coins v] by (-100)\n    if <(Sound Effects) = [On]> then\n        start sound [Bought v]\n    end\nelse\n    set [speed boost v] to [No]\n    if <(Sound Effects) = [On]> then\n        start sound [Can't Afford v]\n    end\nend\n\nwhen I receive [hide shop v]\nrepeat (10)\n    change y by (-15)\nend\nrepeat (11)\n    change y by (-13)\nend\nrepeat (10)\n    change y by (-10)\nend\nrepeat (10)\n    change y by (-5)\nend\nrepeat (10)\n    change y by (-4)\nend\nrepeat (6)\n    change y by (-2)\nend\nrepeat (4)\n    change y by (-1)\nend\nhide\n\nwhen flag clicked\ngo to x: (-30) y: (-43)\nforever\n    if <touching (mouse-pointer v)?> then\n        if <(Coins) > [99]> then\n            switch costume to (touching can afford v)\n        else\n            switch costume to (touching can't afford v)\n        end\n    else\n        switch costume to (not touching v)\n    end\nend\n\nwhen flag clicked\nset size to (100) %\nforever\n    if <(username) = [ZAF253]> then\n        if <key (space v) pressed?> then\n            change [coins v] by (50)\n        end\n    end\nend\n\nwhen I receive [shop v]\nshow\ngo to x: (-10) y: (-600)\nrepeat (11)\n    change y by (15)\nend\nrepeat (10)\n    change y by (13)\nend\nrepeat (10)\n    change y by (10)\nend\nrepeat (10)\n    change y by (5)\nend\nrepeat (10)\n    change y by (4)\nend\nrepeat (6)\n    change y by (2)\nend\nrepeat (4)\n    change y by (1)\nend\n\n@Change Music\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset size to (100) %\nhide\n\nwhen I receive [green flag v]\nshow\ngo to [front v] layer\nforever\n    set [ghost v] effect to (27)\n    if <(mouse y) > [166]> then\n        repeat (11)\n            change y by (-3)\n        end\n        repeat (6)\n            change y by (-2)\n        end\n        repeat (6)\n            change y by (-1)\n        end\n        wait until <not <(mouse y) > [140]>>\n        repeat (11)\n            change y by (3)\n        end\n        repeat (6)\n            change y by (2)\n        end\n        repeat (6)\n            change y by (1)\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (mouse-pointer v)?> then\n        switch costume to (2 v)\n    else\n        switch costume to (1 v)\n    end\nend\n\nwhen this sprite clicked\nbroadcast (aaa Change Music v)\n\n@Shop Button\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset size to (100) %\nhide\n\nwhen I receive [green flag v]\nshow\ngo to [front v] layer\nforever\n    set [ghost v] effect to (27)\n    if <(mouse y) > [166]> then\n        repeat (11)\n            change y by (-3)\n        end\n        repeat (6)\n            change y by (-2)\n        end\n        repeat (6)\n            change y by (-1)\n        end\n        wait until <not <(mouse y) > [140]>>\n        repeat (11)\n            change y by (3)\n        end\n        repeat (6)\n            change y by (2)\n        end\n        repeat (6)\n            change y by (1)\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (mouse-pointer v)?> then\n        switch costume to (2 v)\n    else\n        switch costume to (1 v)\n    end\nend\n\nwhen this sprite clicked\nbroadcast (Shop v)\n\n@Shop Item 2\n\nwhen flag clicked\nhide\nset [jump boost v] to [No]\nforever\n    go to [front v] layer\nend\n\nwhen this sprite clicked\nif <(Coins) > [199]> then\n    set [jump boost v] to [Yes]\n    change [coins v] by (-200)\n    if <(Sound Effects) = [On]> then\n        start sound [Bought v]\n    end\nelse\n    set [jump boost v] to [No]\n    if <(Sound Effects) = [On]> then\n        start sound [Can't Afford v]\n    end\nend\n\nwhen I receive [hide shop v]\nrepeat (10)\n    change y by (-15)\nend\nrepeat (11)\n    change y by (-13)\nend\nrepeat (10)\n    change y by (-10)\nend\nrepeat (10)\n    change y by (-5)\nend\nrepeat (10)\n    change y by (-4)\nend\nrepeat (6)\n    change y by (-2)\nend\nrepeat (4)\n    change y by (-1)\nend\nhide\n\nwhen flag clicked\ngo to x: (-10) y: (-43)\nforever\n    if <touching (mouse-pointer v)?> then\n        if <(Coins) > [199]> then\n            switch costume to (touching can afford v)\n        else\n            switch costume to (touching can't afford v)\n        end\n    else\n        switch costume to (not touching v)\n    end\nend\n\nwhen I receive [shop v]\nshow\ngo to x: (-10) y: (-600)\nrepeat (11)\n    change y by (15)\nend\nrepeat (10)\n    change y by (13)\nend\nrepeat (10)\n    change y by (10)\nend\nrepeat (10)\n    change y by (5)\nend\nrepeat (10)\n    change y by (4)\nend\nrepeat (6)\n    change y by (2)\nend\nrepeat (4)\n    change y by (1)\nend\n\n@Shop Item 3\n\nwhen flag clicked\nhide\nhide variable [shrunk v]\nset [shrunk v] to [No]\nforever\n    go to [front v] layer\nend\n\nwhen this sprite clicked\nif <(Coins) > [299]> then\n    set [shrunk v] to [Yes]\n    change [coins v] by (-300)\n    if <(Sound Effects) = [On]> then\n        start sound [Bought v]\n    end\nelse\n    set [shrunk v] to [No]\n    if <(Sound Effects) = [On]> then\n        start sound [Can't Afford v]\n    end\nend\n\nwhen I receive [hide shop v]\nrepeat (10)\n    change y by (-15)\nend\nrepeat (11)\n    change y by (-13)\nend\nrepeat (10)\n    change y by (-10)\nend\nrepeat (10)\n    change y by (-5)\nend\nrepeat (10)\n    change y by (-4)\nend\nrepeat (6)\n    change y by (-2)\nend\nrepeat (4)\n    change y by (-1)\nend\nhide\n\nwhen flag clicked\ngo to x: (-10) y: (-43)\nforever\n    if <touching (mouse-pointer v)?> then\n        if <(Coins) > [299]> then\n            switch costume to (touching can afford v)\n        else\n            switch costume to (touching can't afford v)\n        end\n    else\n        switch costume to (not touching v)\n    end\nend\n\nwhen I receive [shop v]\nshow\ngo to x: (-10) y: (-600)\nrepeat (11)\n    change y by (15)\nend\nrepeat (10)\n    change y by (13)\nend\nrepeat (10)\n    change y by (10)\nend\nrepeat (10)\n    change y by (5)\nend\nrepeat (10)\n    change y by (4)\nend\nrepeat (6)\n    change y by (2)\nend\nrepeat (4)\n    change y by (1)\nend\n\n@Shop Item 4\n\nwhen flag clicked\nhide\nhide variable [spike resistant? v]\nset [spike resistant? v] to [No]\nforever\n    go to [front v] layer\nend\n\nwhen this sprite clicked\nif <(Coins) > [999]> then\n    set [spike resistant? v] to [Yes]\n    change [coins v] by (-1000)\n    if <(Sound Effects) = [On]> then\n        start sound [Bought v]\n    end\nelse\n    set [spike resistant? v] to [No]\n    if <(Sound Effects) = [On]> then\n        start sound [Can't Afford v]\n    end\nend\n\nwhen I receive [hide shop v]\nrepeat (10)\n    change y by (-15)\nend\nrepeat (11)\n    change y by (-13)\nend\nrepeat (10)\n    change y by (-10)\nend\nrepeat (10)\n    change y by (-5)\nend\nrepeat (10)\n    change y by (-4)\nend\nrepeat (6)\n    change y by (-2)\nend\nrepeat (4)\n    change y by (-1)\nend\nhide\n\nwhen flag clicked\ngo to x: (-10) y: (-43)\nforever\n    if <touching (mouse-pointer v)?> then\n        if <(Coins) > [999]> then\n            switch costume to (touching can afford v)\n        else\n            switch costume to (touching can't afford v)\n        end\n    else\n        switch costume to (not touching v)\n    end\nend\n\nwhen I receive [shop v]\nshow\ngo to x: (-10) y: (-600)\nrepeat (11)\n    change y by (15)\nend\nrepeat (10)\n    change y by (13)\nend\nrepeat (10)\n    change y by (10)\nend\nrepeat (10)\n    change y by (5)\nend\nrepeat (10)\n    change y by (4)\nend\nrepeat (6)\n    change y by (2)\nend\nrepeat (4)\n    change y by (1)\nend\n\ngo to x: (-10) y: (-43)\n\n