Blammer Arcade (Platformer)

Instructions: Control Blammer the Unicorn in this Mario-like arcade platformer. You have 10 lives to earn points by defeating enemies, racking up combos and surviving as long as possible!\n\nControls:\nWASD / Arrow Keys - Movement, Jumping and Ducking\nSpace / Click - Pop Bubble / Use Power Up\nClick the button on the bottom-left corner to mute all sounds\n\nEarning Points:\n- Jump on Squishies and Missiles. You can build a combo if you jump on consecutive enemies without touching the ground, gaining extra points/lives.\n-Spinders will shoot lasers at you but will die if you jump into them, which will also raise your combo.\n- By jumping into missiles from above or below, you can change their trajectories and kill more enemies with them!\n- You also earn bonus 1000 points after travelling a large distance.\n\nPower Ups:\nThe colourful boxes with lightning bolts contain power ups:\n- Mega: Turns you into an invincible giant, allowing you to rack up massive combos\n- Ghost: Holding space or clicking allows you to glide in mid air and become invincible for a short period\n- Coin: Gain 100 free unicoins\n- 1UP: Gain a free life\nYour current power up is shown on the bottom-right corner\n\nUnicoins:\nYou earn 100 unicoins after travelling certain distances, power ups and jumping on golden squishies. Upon losing all of your lives, you can press space to spend 500 unicoins to keep playing to improve your score.\n\nIf lag is bad, try here: https://phosphorus.github.io/#114080029

@Stage\n\nwhen I receive [main v]\nstop [other scripts in stage v]\nset [camx v] to [0]\nchange [mainmusic v] by (1)\nset [song v] to (((mainmusic) mod (2)) + (1))\nforever\n    play sound (song) until done\nend\n\nwhen flag clicked\nbroadcast (volumechange v)\nbroadcast (main v)\n\nwhen flag clicked\nforever\n    set volume to (volume) %\nend\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\nset [mainmusic v] to [0]\nset [gamemusic v] to [2]\n\nwhen I receive [start v]\nstop [other scripts in stage v]\nchange [gamemusic v] by (1)\nset [song v] to (((gamemusic) mod (3)) + (2))\nforever\n    play sound (song) until done\nend\n\n@bg\n\ndefine Reset\nerase all\nset [x1 v] to [0]\nset [x2 v] to [956]\nhide\nforever\n    if <(dead) < [3]> then\n        loop\n        change [camx v] by (Scroll Speed)\n    end\nend\n\ndefine loop\nerase all\nswitch costume to (bg v)\ngo to [front v] layer\ngo to x: (((X1) - (CamX)) * (0.5)) y: (0)\nstamp\nif <(((X1) - (CamX)) * (0.5)) < [-478]> then\n    change [x1 v] by (1912)\n    go to x: (((X1) - (CamX)) * (0.5)) y: (0)\n    stamp\nend\nswitch costume to (bg2 v)\ngo to [front v] layer\ngo to x: (((X2) - (CamX)) * (0.5)) y: (0)\nstamp\nif <(((X2) - (CamX)) * (0.5)) < [-478]> then\n    change [x2 v] by (1912)\n    go to x: (((X2) - (CamX)) * (0.5)) y: (0)\n    stamp\nend\n\nwhen I receive [main v]\nwait (0) seconds\nReset\n\nwhen I receive [start v]\nstop [other scripts in sprite v]\nwait (0) seconds\nReset\ndelete this clone\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\n@Land\n\nwhen I start as a clone\nif <(type) = [1]> then\n    go [backward v] (10) layers\nelse\nend\nforever\n    if <(dead) < [3]> then\n        Block\n    end\nend\n\nwhen I receive [start v]\nwait (0) seconds\nReset\ndelete this clone\n\ndefine Reset\nhide\nset [x v] to [-299]\nset [y v] to [-130]\nset [missilelag v] to [0]\n\ndefine None\nset [type v] to (type)\nif <(type) = [1]> then\n    change [x v] by (125)\n    if <(Y) > [-150]> then\n        change [y v] by (-20)\n    end\n    create clone of (_myself_ v)\nelse\n    if <(type) = [2]> then\n        change [x v] by (125)\n        if <(Y) < [50]> then\n            change [y v] by (20)\n        end\n        create clone of (_myself_ v)\n    else\n        if <(type) = [3]> then\n            change [x v] by (125)\n            change [y v] by (0)\n            create clone of (_myself_ v)\n        else\n            if <(type) = [4]> then\n                change [x v] by (125)\n                change [y v] by (0)\n                create clone of (_myself_ v)\n            else\n                if <(type) = [5]> then\n                    change [x v] by (125)\n                    change [y v] by (0)\n                    create clone of (_myself_ v)\n                else\n                    if <(type) = [6]> then\n                        change [x v] by (275)\n                        change [y v] by (0)\n                        create clone of (_myself_ v)\n                    else\n                        if <(type) = [7]> then\n                            change [x v] by (125)\n                            change [y v] by (0)\n                            set [spinder x v] to (X)\n                            set [spinder y v] to (Y)\n                            create clone of (spinder v)\n                            create clone of (_myself_ v)\n                        else\n                            if <(type) = [8]> then\n                                change [x v] by (125)\n                                change [y v] by (0)\n                                set [squishy x v] to (X)\n                                set [squishy y v] to (Y)\n                                create clone of (squishy v)\n                                create clone of (_myself_ v)\n                            else\n                                if <(type) = [9]> then\n                                    change [x v] by (125)\n                                    change [y v] by (0)\n                                    create clone of (_myself_ v)\n                                    set [squishy x v] to ((X) - (50))\n                                    set [squishy y v] to (Y)\n                                    create clone of (squishy v)\n                                    repeat (1)\n                                    end\n                                    set [squishy x v] to ((X) + (50))\n                                    set [squishy y v] to (Y)\n                                    create clone of (squishy v)\n                                else\n                                    if <(type) = [10]> then\n                                        change [x v] by (125)\n                                        change [y v] by (0)\n                                        create clone of (_myself_ v)\n                                        set [squishy x v] to ((X) - (50))\n                                        set [squishy y v] to (Y)\n                                        create clone of (squishy v)\n                                        repeat (1)\n                                        end\n                                        set [squishy x v] to (X)\n                                        set [squishy y v] to (Y)\n                                        create clone of (squishy v)\n                                        repeat (1)\n                                        end\n                                        set [squishy x v] to ((X) + (50))\n                                        set [squishy y v] to (Y)\n                                        create clone of (squishy v)\n                                    else\n                                        if <(type) = [11]> then\n                                            change [x v] by (125)\n                                            change [y v] by (0)\n                                            set [squishy x v] to (X)\n                                            set [squishy y v] to (Y)\n                                            create clone of (gsquishy v)\n                                            create clone of (_myself_ v)\n                                        else\n                                            if <(type) = [12]> then\n                                                change [x v] by (125)\n                                                change [y v] by (0)\n                                                set [powerx v] to (X)\n                                                set [powery v] to (Y)\n                                                create clone of (power up v)\n                                                create clone of (_myself_ v)\n                                            else\n                                            end\n                                        end\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [main v]\nset [start v] to [0]\nReset\nwait (0) seconds\nforever\n    if <(dead) < [3]> then\n        if <((X) - (CamX)) < [340]> then\n            if <<(start) = [1]> and <(X) > [800]>> then\n                Generate (item (pick random (1) to (length of [landtype v])) of [landtype v])\n            else\n                Generate (3)\n            end\n        end\n    end\nend\n\ndefine Block\ngo to x: ((X) - (CamX)) y: (Y)\nif <((X) - (CamX)) < [-260]> then\n    delete this clone\nend\nif <(type) = [5]> then\n    switch costume to (landcannon v)\n    change [missilelag v] by (1)\n    if <(missilelag) > ((200) / (Scroll Speed))> then\n        if <[75] < ([abs v] of ((X) - ([x v] of [player v])) )> then\n            set [missilex v] to (X)\n            set [missiley v] to (Y)\n            start sound [nsmbwiiBanzaiBill v]\n            create clone of (missile v)\n        end\n        set [missilelag v] to [0]\n    end\nelse\n    if <(type) = [4]> then\n        switch costume to (spike v)\n        if <touching (player v)?> then\n            if <(invincible) = [0]> then\n                set [dead v] to [1]\n            end\n        end\n        switch costume to (landspike v)\n    else\n        switch costume to (land v)\n    end\nend\nif <((X) - (CamX)) < [260]> then\n    show\nend\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\n@border\n\nwhen flag clicked\nshow\nforever\n    go to [front v] layer\nend\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\n@Player\n\ndefine Reset\nset size to (15) %\nset [score+ v] to [0]\nset [invincible v] to [0]\nset [power up v] to [none]\npoint in direction (90)\nset [x v] to (CamX)\nset [y v] to [180]\nset [animation v] to [i]\nset [animation# v] to [1]\nset [blink v] to [0]\nset [xvel v] to [0]\nset [yvel v] to [-4]\nset [jump v] to [0]\nset [duck v] to [0]\nset [land v] to [0]\nset [bubble v] to [0]\nset [dead v] to [1]\nwait until <<not <key (space v) pressed?>> and <not <mouse down?>>>\nrepeat until <<<(bubble) > ((300) / (Scroll Speed))> or <key (space v) pressed?>> or <mouse down?>>\n    set [bounce v] to [0]\n    change [x v] by (Scroll Speed)\n    Position\n    switch costume to (bubble v)\n    if <(bubble) > (((300) / (Scroll Speed)) * (0.5))> then\n        if <((bubble) mod (2)) = [0]> then\n            switch costume to (i1 v)\n        end\n    end\n    change [bubble v] by (1)\n    if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n        change [xvel v] by (-0.5)\n    end\n    if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n        change [xvel v] by (0.5)\n    end\n    Move\nend\nstart sound [nsmbwiiPopBubble v]\nset [dead v] to [0]\n\ndefine Blink\nchange [blink v] by (1)\nif <(Blink) = [100]> then\n    if <(Animation) = [i]> then\n        set [animation# v] to [2]\n    end\nend\nif <(Blink) = [101]> then\n    if <(Animation) = [i]> then\n        set [animation# v] to [3]\n    end\n    set [blink v] to [0]\nend\nif <(Blink) = [0]> then\n    if <(Animation) = [i]> then\n        set [animation# v] to [2]\n    end\nend\nif <(Blink) = [1]> then\n    if <(Animation) = [i]> then\n        set [animation# v] to [1]\n    end\nend\n\ndefine eclip\nswitch costume to (hit v)\nif <touching (border v)?> then\n    repeat until <not <touching (border v)?>>\n        if <(x position) > [0]> then\n            change [x v] by (-1)\n            if <(Xvel) > [0]> then\n                set [xvel v] to [0]\n            end\n        else\n            change [x v] by (1)\n            if <(Xvel) < [0]> then\n                set [xvel v] to [0]\n            end\n        end\n        Position\n    end\n    if <(x position) > [0]> then\n        change [x v] by (1)\n        if <(Xvel) > [0]> then\n            set [xvel v] to [0]\n        end\n    else\n        change [x v] by (-1)\n        if <(Xvel) < [0]> then\n            set [xvel v] to [0]\n        end\n    end\n    Position\nend\n\ndefine Animation\nif <(duck) = [1]> then\n    set [xvel v] to ((Xvel) * (0.6))\n    if <(Animation) = [j]> then\n        if <(Animation#) < [2]> then\n            change [animation# v] by (1)\n        else\n            if <<not <key (s v) pressed?>> and <not <key (down arrow v) pressed?>>> then\n                if <(Animation#) < [3]> then\n                    change [animation# v] by (1)\n                else\n                    set [duck v] to [0]\n                    set [animation v] to [i]\n                    set [animation# v] to [1]\n                end\n            end\n        end\n    else\n        start sound [nsmbwiiDuck v]\n        set [animation v] to [j]\n        set [animation# v] to [1]\n    end\nend\nif <(jump) = [1]> then\n    if <(Animation) = [j]> then\n        if <(Animation#) < [3]> then\n            change [animation# v] by (1)\n        else\n            set [animation v] to [i]\n            set [animation# v] to [1]\n            set [jump v] to [0]\n            set [yvel v] to ((10) + (([abs v] of (Xvel) ) * (0.25)))\n            start sound [nsmbwiiJump v]\n            Move\n            Position\n        end\n    else\n        set [animation v] to [j]\n        set [animation# v] to [1]\n    end\nend\nswitch costume to (join (Animation) (Animation#))\n\ndefine clip\nPosition\nswitch costume to (d v)\nif <touching (land v)?> then\n    change [y v] by ([abs v] of (Yvel) )\n    set [yvel v] to [0]\n    Position\n    switch costume to (s v)\n    if <touching (land v)?> then\n        switch costume to (s2 v)\n        if <touching (border v)?> then\n            set [dead v] to [2]\n            stop [this script v]\n        end\n        set [xvel v] to ((0) - (Xvel))\n        change [x v] by (Xvel)\n        set [xvel v] to ((0.5) * (Xvel))\n        Position\n    end\n    switch costume to (d v)\n    repeat until <not <touching (land v)?>>\n        change [y v] by (1)\n        Position\n    end\n    change [y v] by (-1)\n    Position\nend\nswitch costume to (s v)\nif <touching (land v)?> then\n    set [xvel v] to ((0) - (Xvel))\n    change [x v] by (Xvel)\n    set [xvel v] to ((0.5) * (Xvel))\n    Position\n    switch costume to (s v)\n    repeat until <not <touching (land v)?>>\n        change [x v] by (((Xvel) / (2)) + ((direction) / (-45)))\n        Position\n    end\nend\n\ndefine Move\nchange [x v] by (Xvel)\nchange [y v] by (Yvel)\nset [xvel v] to ((Xvel) * ((1) - (((1) / ([cade v] of [faster v])) * (0.05))))\nset [yvel v] to ((Yvel) * ((1) - (((1) / ([cade v] of [faster v])) * (0.05))))\n\ndefine Position\ngo to x: ((X) - (CamX)) y: (Y)\n\nwhen I receive [main v]\nset [invincible v] to [0]\nset size to (15) %\nshow\npoint in direction (90)\nset [scroll speed v] to [2]\nset [lives v] to [10]\nset [score v] to [0]\ngo to x: (0) y: (-102)\nswitch costume to (i1 v)\nwait (0) seconds\nwait until <(start) = [1]>\nReset\nforever\n    if <(dead) < [3]> then\n        Move\n        Position\n        Gravity\n        clip\n        eclip\n        Animation\n        Blink\n        if <(Y) < [-165]> then\n            set [dead v] to [1]\n        end\n        if <(bounce) = [1]> then\n            set [animation v] to [i]\n            set [animation# v] to [1]\n            set [bounce v] to [0]\n            if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n                start sound [nsmbwiiStomp2 v]\n                set [yvel v] to ((10) + (([abs v] of (Xvel) ) * (0.25)))\n            else\n                start sound [nsmbwiiStomp1 v]\n                set [yvel v] to ((5) + (([abs v] of (Xvel) ) * (0.25)))\n            end\n            Move\n            Position\n        end\n        if <(dead) = [1]> then\n            switch costume to (dead v)\n            set [yvel v] to [10]\n            set [xvel v] to [0]\n            set [score+ v] to [0]\n            start sound [nsmbwiiDeath v]\n            repeat (10)\n                Position\n            end\n            switch costume to (dead2 v)\n            repeat until <(Y) < [-200]>\n                change [yvel v] by (-1)\n                Move\n                Position\n            end\n            if <(lives) = [0]> then\n                set [dead v] to [3]\n            else\n                change [lives v] by (-1)\n                Reset\n            end\n        end\n        if <(dead) = [2]> then\n            switch costume to (crush1 v)\n            start sound [nsmbwiiDeath v]\n            repeat (6)\n                wait (0) seconds\n                next costume\n            end\n            if <(lives) = [0]> then\n                set [dead v] to [3]\n            else\n                change [lives v] by (-1)\n                Reset\n            end\n        end\n    end\n    if <(dead) = [4]> then\n        Reset\n    end\nend\n\nwhen I receive [start v]\nforever\n    if <<key (space v) pressed?> or <mouse down?>> then\n        if <(dead) = [0]> then\n            if <(power up) = [mega]> then\n                set [invincible v] to [1]\n                set size to (15) %\n                start sound [nsmbwiiPowerup v]\n                repeat (10)\n                    change size by (4.25)\n                    set [power up v] to [mega]\n                end\n                set [gage v] to [100]\n                repeat until <<(dead) > [0]> or <(gage) < [1]>>\n                    change [gage v] by ((-1) / (3))\n                    set [power up v] to [mega]\n                end\n                start sound [nsmbwiiPowerDown v]\n                repeat (10)\n                    change size by (-4.25)\n                    set [power up v] to [none]\n                end\n            else\n                if <(power up) = [ghost]> then\n                    if <not <touching (land v)?>> then\n                        set [invincible v] to [1]\n                        set [ghost v] effect to (50)\n                        set [ghosty v] to (Y)\n                        if <(gage) < [1]> then\n                            set [gage v] to [100]\n                        end\n                        repeat until <<<<<not <key (space v) pressed?>> and <not <mouse down?>>> or <(gage) < [1]>> or <(dead) > [0]>> or <not <(power up) = [ghost]>>>\n                            change [gage v] by (-2.5)\n                            set [y v] to (ghosty)\n                            set [yvel v] to [0]\n                        end\n                        set size to (15) %\n                        set [ghost v] effect to (0)\n                        set [invincible v] to [0]\n                        if <(gage) < [1]> then\n                            wait until <touching (land v)?>\n                        end\n                    end\n                else\n                    if <(power up) = [coin]> then\n                        create clone of (+coins v)\n                        set [power up v] to [none]\n                    else\n                        if <(power up) = [1up]> then\n                            start sound [nsmbwii1up1 v]\n                            change [lives v] by (1)\n                            set [power up v] to [none]\n                        else\n                        end\n                    end\n                end\n            end\n        end\n    end\n    set size to (15) %\n    set [ghost v] effect to (0)\n    set [invincible v] to [0]\nend\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\ndefine Gravity\nswitch costume to (d v)\nif <touching (land v)?> then\n    if <(invincible) = [0]> then\n        set [score+ v] to [0]\n    end\n    set [xvel v] to ((Xvel) * (0.85))\n    set [yvel v] to [0]\n    if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n        set [jump v] to [1]\n    else\n        if <<key (s v) pressed?> or <key (down arrow v) pressed?>> then\n            if <(jump) = [0]> then\n                set [duck v] to [1]\n            end\n        end\n    end\n    if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n        point in direction (-90)\n        if <(Xvel) < [0]> then\n            change [xvel v] by (-1)\n        else\n            change [xvel v] by (-0.5)\n        end\n    end\n    if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n        point in direction (90)\n        if <(Xvel) > [0]> then\n            change [xvel v] by (1)\n        else\n            change [xvel v] by (0.5)\n        end\n    end\n    if <(land) = [1]> then\n    else\n        if <(land) = [0]> then\n            set [animation v] to [j]\n            set [animation# v] to [1]\n            set [land v] to [2]\n            start sound [nsmbwiiLandGrass v]\n        else\n            if <(Animation#) < [3]> then\n                change [animation# v] by (1)\n            else\n                set [animation v] to [i]\n                set [animation# v] to [1]\n                set [land v] to [1]\n            end\n        end\n    end\n    if <(power up) = [ghost]> then\n        set [gage v] to [100]\n    else\n    end\nelse\n    set [land v] to [0]\n    change [yvel v] by (-1)\n    if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n        change [xvel v] by (-0.5)\n    end\n    if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n        change [xvel v] by (0.5)\n    end\nend\n\n@missile\n\ndefine Position\ngo to x: ((X) - (CamX)) y: (Y)\n\ndefine Move\nset [xvel v] to (([sin v] of (direction) ) * (5))\nset [yvel v] to (([cos v] of (direction) ) * (5))\nchange [x v] by (Xvel)\nchange [y v] by (Yvel)\nturn right (dirvel) degrees\nset [dirvel v] to ((dirvel) * (0.9))\n\nwhen I start as a clone\nshow\nset rotation style [all around v]\nset [x v] to (missileX)\nset [y v] to ((missileY) + (38))\nif <([x v] of [player v]) > (X)> then\n    point in direction (90)\nelse\n    point in direction (-90)\nend\nset [dirvel v] to [0]\nset [animation v] to [0]\nswitch costume to (missile1 v)\nchange [x v] by ((direction) / (3))\nMove\nPosition\nforever\n    if <(dead) < [3]> then\n        if <([abs v] of (Y) ) > [180]> then\n            delete this clone\n        end\n        if <([abs v] of ((X) - (CamX)) ) > [240]> then\n            delete this clone\n        end\n        switch costume to (hit v)\n        if <<touching (land v)?> or <touching (spinder v)?>> then\n            switch costume to (explosion v)\n            set rotation style [all around v]\n            set [animation v] to [1]\n            start sound [nsmbwiiBobomb v]\n            repeat (13)\n                turn right (20) degrees\n                Position\n                set size to (item (animation) of [explosion size v]) %\n                change [animation v] by (1)\n            end\n            delete this clone\n        end\n        if <<touching (player v)?> and <(dead) = [0]>> then\n            if <(invincible) = [0]> then\n                set [dead v] to [1]\n            end\n            switch costume to (explosion v)\n            set rotation style [all around v]\n            set [animation v] to [1]\n            start sound [nsmbwiiBobomb v]\n            repeat (13)\n                turn right (20) degrees\n                Position\n                set size to (item (animation) of [explosion size v]) %\n                change [animation v] by (1)\n            end\n            delete this clone\n        end\n        if <(direction) < [0]> then\n            switch costume to (above v)\n            if <<<touching (player v)?> and <(dead) = [0]>> and <not <([yvel v] of [player v]) < [0]>>> then\n                change [dirvel v] by ([abs v] of (([yvel v] of [player v]) * (0.125)) )\n            else\n                switch costume to (below v)\n                if <<touching (player v)?> and <(dead) = [0]>> then\n                    if <([yvel v] of [player v]) < [0]> then\n                        set [bounce v] to [1]\n                        change [dirvel v] by ((0) - ([abs v] of (([yvel v] of [player v]) * (0.375)) ))\n                        change [score+ v] by (1)\n                        set [score+x v] to (X)\n                        set [score+y v] to (Y)\n                        create clone of (score+ v)\n                    end\n                end\n            end\n        else\n            switch costume to (below v)\n            if <<<touching (player v)?> and <(dead) = [0]>> and <not <([yvel v] of [player v]) < [0]>>> then\n                change [dirvel v] by ((0) - ([abs v] of (([yvel v] of [player v]) * (0.125)) ))\n            else\n                switch costume to (above v)\n                if <<touching (player v)?> and <(dead) = [0]>> then\n                    if <([yvel v] of [player v]) < [0]> then\n                        set [bounce v] to [1]\n                        change [dirvel v] by ([abs v] of (([yvel v] of [player v]) * (0.375)) )\n                        change [score+ v] by (1)\n                        set [score+x v] to (X)\n                        set [score+y v] to (Y)\n                        create clone of (score+ v)\n                    end\n                end\n            end\n        end\n        Move\n        Position\n        change [animation v] by (0.2)\n        if <(animation) > [2]> then\n            set [animation v] to [0.2]\n        end\n        switch costume to (join [missile] ([ceiling v] of (animation) ))\n        if <touching (spinderlaser v)?> then\n            switch costume to (explosion v)\n            set rotation style [all around v]\n            set [animation v] to [1]\n            start sound [nsmbwiiBobomb v]\n            repeat (13)\n                turn right (20) degrees\n                Position\n                set size to (item (animation) of [explosion size v]) %\n                change [animation v] by (1)\n            end\n            delete this clone\n        end\n    end\nend\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\n@spinder\n\ndefine Position\ngo to x: ((X) - (CamX)) y: (Y)\n\nwhen I start as a clone\nset [x v] to (spinder x)\nset [y v] to ((spinder y) + (125))\nshow\nset [dir v] to [0]\npoint in direction (0)\nswitch costume to (spinder1 v)\nPosition\nrepeat until <(distance to [player v]) < [150]>\n    if <(dead) < [3]> then\n        Position\n        if <((X) - (CamX)) < [-240]> then\n            delete this clone\n        end\n        if <<<touching (player v)?> and <(dead) = [0]>> or <touching (missile v)?>> then\n            change [score+ v] by (1)\n            set [score+x v] to (X)\n            set [score+y v] to (Y)\n            create clone of (score+ v)\n            switch costume to (spinder explosion v)\n            set rotation style [all around v]\n            set [animation v] to [1]\n            start sound [nsmbwiiBobomb v]\n            repeat (13)\n                turn right (20) degrees\n                Position\n                set size to (item (animation) of [explosion size v]) %\n                change [animation v] by (1)\n            end\n            go [backward v] (100) layers\n            turn right (100) degrees\n            repeat until <([abs v] of ((X) - (CamX)) ) > [250]>\n                switch costume to (spinder dead v)\n                set size to (25) %\n                Position\n            end\n            delete this clone\n        end\n    end\nend\nstart sound [nsmbwiiMechaKoopaLand v]\nrepeat (2)\n    Position\n    next costume\n    wait (0) seconds\nend\nforever\n    repeat ((100) / (Scroll Speed))\n        Position\n        point towards (player v)\n        turn right (180) degrees\n        change [dir v] by (((direction) - (dir)) / (5))\n        point in direction (dir)\n        if <((X) - (CamX)) < [-240]> then\n            delete this clone\n        end\n        if <<<touching (player v)?> and <(dead) = [0]>> or <touching (missile v)?>> then\n            change [score+ v] by (1)\n            set [score+x v] to (X)\n            set [score+y v] to (Y)\n            create clone of (score+ v)\n            switch costume to (spinder explosion v)\n            set rotation style [all around v]\n            set [animation v] to [1]\n            start sound [nsmbwiiBobomb v]\n            repeat (13)\n                turn right (20) degrees\n                Position\n                set size to (item (animation) of [explosion size v]) %\n                change [animation v] by (1)\n            end\n            go [backward v] (100) layers\n            turn right (100) degrees\n            repeat until <([abs v] of ((X) - (CamX)) ) > [250]>\n                switch costume to (spinder dead v)\n                set size to (25) %\n                Position\n            end\n            delete this clone\n        end\n    end\n    repeat (3)\n        Position\n        set [spinderlaser x v] to (X)\n        set [spinderlaser y v] to (Y)\n        set [spinderlaser dir v] to (direction)\n        start sound [nsmbwiiBowserJrFireBall v]\n        create clone of (spinderlaser v)\n        repeat (3)\n            Position\n            if <<<touching (player v)?> and <(dead) = [0]>> or <touching (missile v)?>> then\n                change [score+ v] by (1)\n                set [score+x v] to (X)\n                set [score+y v] to (Y)\n                create clone of (score+ v)\n                switch costume to (spinder explosion v)\n                set rotation style [all around v]\n                set [animation v] to [1]\n                start sound [nsmbwiiBobomb v]\n                repeat (13)\n                    turn right (20) degrees\n                    Position\n                    set size to (item (animation) of [explosion size v]) %\n                    change [animation v] by (1)\n                end\n                go [backward v] (100) layers\n                turn right (100) degrees\n                repeat until <([abs v] of ((X) - (CamX)) ) > [250]>\n                    switch costume to (spinder dead v)\n                    set size to (25) %\n                    Position\n                end\n                delete this clone\n            end\n        end\n    end\nend\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\n@spinderlaser\n\ndefine Position\ngo to x: ((X) - (CamX)) y: (Y)\n\nwhen I start as a clone\nswitch costume to (spinderlaser v)\nshow\nset rotation style [all around v]\nset [x v] to (spinderlaser x)\nset [y v] to (spinderlaser y)\npoint in direction (spinderlaser dir)\nturn right (180) degrees\nset [xvel v] to (([sin v] of (direction) ) * (7.5))\nset [yvel v] to (([cos v] of (direction) ) * (7.5))\nPosition\nforever\n    if <(dead) < [3]> then\n        if <([abs v] of (Y) ) > [180]> then\n            delete this clone\n        end\n        if <([abs v] of ((X) - (CamX)) ) > [240]> then\n            delete this clone\n        end\n        Move\n        Position\n        if <<<touching (land v)?> or <touching (squishy v)?>> or <touching (missile v)?>> then\n            switch costume to (laser explosion v)\n            set rotation style [all around v]\n            set [animation v] to [1]\n            start sound [nsmbwiiElectrocuted v]\n            repeat (13)\n                turn right (20) degrees\n                Position\n                set size to (item (animation) of [explosion size v]) %\n                change [animation v] by (1)\n            end\n            delete this clone\n        end\n        if <<touching (player v)?> and <(dead) = [0]>> then\n            if <(invincible) = [0]> then\n                set [dead v] to [1]\n            end\n            switch costume to (laser explosion v)\n            set rotation style [all around v]\n            set [animation v] to [1]\n            start sound [nsmbwiiElectrocuted v]\n            repeat (13)\n                turn right (20) degrees\n                Position\n                set size to (item (animation) of [explosion size v]) %\n                change [animation v] by (1)\n            end\n            delete this clone\n        end\n    end\nend\n\ndefine Move\nchange [x v] by (Xvel)\nchange [y v] by (Yvel)\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\n@squishy\n\ndefine Position\ngo to x: ((X) - (CamX)) y: (Y)\n\nwhen I start as a clone\nset [x v] to (squishy x)\nset [y v] to ((squishy y) + (23))\nshow\nswitch costume to (squishy1 v)\nset [animation v] to [0]\nforever\n    if <(dead) < [3]> then\n        switch costume to (squishy hit v)\n        if <touching (player v)?> then\n            if <(dead) = [0]> then\n                change [score+ v] by (1)\n                set [score+x v] to (X)\n                set [score+y v] to (Y)\n                create clone of (score+ v)\n                set [bounce v] to [1]\n                switch costume to (squishy dead v)\n                repeat (10)\n                    Position\n                    change [ghost v] effect by (10)\n                end\n                delete this clone\n            end\n        end\n        if <<touching (spinderlaser v)?> or <touching (missile v)?>> then\n            change [score+ v] by (1)\n            set [score+x v] to (X)\n            set [score+y v] to (Y)\n            create clone of (score+ v)\n            switch costume to (squishy dead v)\n            repeat (10)\n                change [ghost v] effect by (10)\n            end\n            delete this clone\n        end\n        if <([abs v] of (Y) ) > [180]> then\n            delete this clone\n        end\n        if <((X) - (CamX)) < [-240]> then\n            delete this clone\n        end\n        Position\n        change [animation v] by (0.5)\n        if <(animation) > [6]> then\n            set [animation v] to [0.2]\n        end\n        switch costume to (join [squishy] ([ceiling v] of (animation) ))\n        if <touching (player v)?> then\n            if <(invincible) = [0]> then\n                set [dead v] to [1]\n            end\n        end\n    end\nend\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\n@score+\n\ndefine Position\ngo to x: ((X) - (CamX)) y: (Y)\n\nwhen I start as a clone\nset [x v] to (score+x)\nset [y v] to (score+y)\nshow\nif <(score+) > [6]> then\n    set [score+ v] to [6]\nend\nif <(score+) = [6]> then\n    start sound [nsmbwii1up1 v]\n    change [lives v] by (1)\nelse\n    change [score v] by (([10 ^ v] of ((score+) * ([log v] of (2) )) ) * (100))\nend\nswitch costume to (score+)\nset size to ((10) + ((score+) * (2.5))) %\nrepeat (10)\n    Position\n    change [y v] by (1)\nend\nrepeat (10)\n    Position\n    change [y v] by (1)\n    change [ghost v] effect by (10)\nend\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\n@heart\n\nwhen I start as a clone\nchange x by (((clone) * (5)) + (10))\nset size to (12.5) %\nforever\n    switch costume to ((letter ((clone) - (1)) of (lives)) + (3))\n    if <(clone) = [1]> then\n        switch costume to (x v)\n    end\n    show\n    if <(clone) > ((length of (lives)) + (1))> then\n        hide\n    end\nend\n\nwhen I receive [main v]\nhide\ndelete this clone\n\nwhen I receive [start v]\nwait (0) seconds\nshow\nswitch costume to (heart v)\nset [clone v] to [0]\ngo to x: (-170) y: (160)\nset size to (25) %\nforever\n    go to [front v] layer\n    if <(clone) < ((length of (lives)) + (1))> then\n        change [clone v] by (1)\n        create clone of (_myself_ v)\n    end\nend\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\n@score\n\nwhen I receive [main v]\nhide\ndelete this clone\n\nwhen I receive [start v]\nwait (0) seconds\nset [clone v] to [0]\ngo to x: (170) y: (160)\nset size to (25) %\nforever\n    set [score v] to (round (score))\n    if <(clone) < ((length of (score)) + (1))> then\n        change [clone v] by (1)\n        create clone of (_myself_ v)\n    end\nend\n\nwhen I start as a clone\nset size to (12.5) %\nforever\n    set x to ((((length of ((score) + (1))) - (clone)) * (-5)) + (160))\n    switch costume to ((letter (clone) of (score)) + (2))\n    show\n    if <(clone) = ((length of (score)) + (1))> then\n        switch costume to (pts v)\n    end\n    if <(clone) > ((length of (score)) + (1))> then\n        hide\n    end\nend\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\n@faster\n\nwhen I receive [main v]\nwait (0) seconds\nset [cade v] to [1]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [start v]\nforever\n    wait until <(CamX) > ((cade) * (2500))>\n    create clone of (_myself_ v)\n    create clone of (+coins v)\n    animation\n    change [cade v] by (cade)\nend\n\nwhen I start as a clone\ngo to x: (160) y: (145)\nif <(score) > (Personal Best)> then\n    set y to (135)\nend\nset size to (12.5) %\nshow\nset [ghost v] effect to (0)\nswitch costume to (+1000 v)\nchange [score v] by (1000)\nrepeat (10)\n    change y by (1)\nend\nrepeat (10)\n    change y by (1)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\ndefine animation\ngo to x: (0) y: (100)\nswitch costume to (faster v)\nset size to (20) %\nshow\nset [ghost v] effect to (100)\nstart sound [nsmbwiiHurryUp v]\nrepeat (3)\n    repeat (10)\n        change [ghost v] effect by (-10)\n        change [scroll speed v] by ((1) / (60))\n    end\n    repeat (10)\n        change [ghost v] effect by (10)\n        change [scroll speed v] by ((1) / (60))\n    end\nend\nhide\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\n@personal best\n\nwhen I receive [main v]\nshow\ngo to x: (153) y: (148)\n\nset [personal best v] to [0]\nset [unicoins v] to [0]\n\nwhen I receive [start v]\nhide\nforever\n    if <(score) > (Personal Best)> then\n        show\n        set [personal best v] to (score)\n    end\nend\n\n@tutorial\n\nwhen I start as a clone\nset [tutorial v] to [2]\nswitch costume to (box1 v)\nset y to (30)\nwait until <(tutorial) = [3]>\npoint in direction (180)\nrepeat until <(x position) < [-20]>\n    change x by (((-25) - (x position)) / (2))\nend\nsquish\nset [tutorial v] to [4]\nwait until <(tutorial) = [5]>\npoint in direction (0)\nrepeat until <(x position) > [20]>\n    change x by (((25) - (x position)) / (2))\nend\nsquish\nset [tutorial v] to [6]\nwait until <(tutorial) = [7]>\npoint in direction (90)\nset x to (0)\nwait until <(tutorial) = [8]>\nsquish\nrepeat until <(y position) > [60]>\n    change y by (((65) - (y position)) / (2))\nend\nrepeat until <(y position) = [30]>\n    change y by ((0) - (((65) - (y position)) / (2)))\n    if <((y position) + ((0) - (((65) - (y position)) / (2)))) < [30]> then\n        set y to (30)\n    end\nend\nsquish\nset [tutorial v] to [9]\nwait until <(tutorial) = [10]>\nrepeat (1)\n    switch costume to (box2 v)\nend\nrepeat (1)\n    switch costume to (box3 v)\nend\nrepeat (1)\n    switch costume to (box4 v)\nend\nwait until <(tutorial) = [11]>\nrepeat (1)\n    switch costume to (box3 v)\nend\nrepeat (1)\n    switch costume to (box2 v)\nend\nrepeat (1)\n    switch costume to (box1 v)\nend\nwait until <(tutorial) = [12]>\ndelete this clone\n\ndefine squish\nrepeat (1)\n    switch costume to (box2 v)\nend\nrepeat (1)\n    switch costume to (box3 v)\nend\nrepeat (1)\n    switch costume to (box2 v)\nend\nrepeat (1)\n    switch costume to (box1 v)\nend\n\nwhen I receive [main v]\npoint in direction (90)\nhide\nwait (0) seconds\nwait until <(start) = [1]>\nwait (0) seconds\nset [tutorial v] to [1]\nwait until <(tutorial) = [1]>\ngo to x: (0) y: (0)\nshow\nrepeat until <(dead) = [0]>\n    switch costume to (space1 v)\n    repeat (10)\n    end\n    switch costume to (space2 v)\n    repeat (5)\n    end\nend\ncreate clone of (_myself_ v)\nswitch costume to (move1 v)\nwait until <(tutorial) = [2]>\nrepeat (10)\nend\nswitch costume to (move2 v)\nset [tutorial v] to [3]\nwait until <(tutorial) = [4]>\nswitch costume to (move1 v)\nrepeat (10)\nend\nswitch costume to (move3 v)\nset [tutorial v] to [5]\nwait until <(tutorial) = [6]>\nswitch costume to (move1 v)\nrepeat (10)\nend\nswitch costume to (jump1 v)\nset [tutorial v] to [7]\nrepeat (10)\nend\nswitch costume to (jump2 v)\nset [tutorial v] to [8]\nrepeat (5)\nend\nswitch costume to (jump1 v)\nwait until <(tutorial) = [9]>\nrepeat (10)\nend\nswitch costume to (duck1 v)\nrepeat (10)\nend\nswitch costume to (duck2 v)\nset [tutorial v] to [10]\nrepeat (20)\nend\nswitch costume to (duck1 v)\nset [tutorial v] to [11]\nrepeat (10)\nend\nset [tutorial v] to [12]\nhide\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\n@logo\n\nwhen I start as a clone\nset [ghost v] effect to (100)\nset size to (25) %\ngo to x: (0) y: (-50)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\nwhen I start as a clone\nforever\n    switch costume to (start1 v)\n    repeat (10)\n    end\n    switch costume to (start2 v)\n    repeat (5)\n    end\nend\n\nwhen I receive [start v]\nhide\ndelete this clone\n\nwhen I receive [main v]\nshow\nset size to (25) %\nset [ghost v] effect to (100)\nswitch costume to (presenting v)\ngo to x: (0) y: (-50)\nrepeat until <(y position) > [-25]>\n    change y by (((0) - (y position)) / (5))\n    change [ghost v] effect by (-25)\nend\nrepeat until <(y position) > [25]>\n    change y by (((50) - (y position)) / (25))\n    change [ghost v] effect by (-25)\nend\nrepeat until <(y position) > [50]>\n    change y by (((75) - (y position)) / (5))\n    change [ghost v] effect by (25)\nend\nset [ghost v] effect to (100)\nrepeat (10)\nend\nset size to (50) %\nswitch costume to (logo v)\ngo to x: (0) y: (50)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\ncreate clone of (_myself_ v)\nwait until <<key (space v) pressed?> or <mouse down?>>\nstart sound [nsmbwiiStartLevel v]\ncreate clone of (black v)\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\n@black\n\nwhen I receive [main v]\nshow\nswitch costume to (black8 v)\nrepeat (7)\n    switch costume to ((costume [number v]) - (1))\nend\nhide\n\nwhen I start as a clone\nshow\nswitch costume to (black1 v)\nrepeat (7)\n    next costume\nend\nrepeat (25)\nend\nbroadcast (start v)\nset [start v] to [1]\nrepeat (5)\nend\nrepeat (7)\n    switch costume to ((costume [number v]) - (1))\nend\ndelete this clone\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\n@Unicoin hud\n\nwhen I receive [main v]\nhide\ndelete this clone\n\nwhen I start as a clone\nchange x by (((clone) * (5)) + (10))\nset size to (12.5) %\nforever\n    switch costume to ((letter ((clone) - (1)) of (Unicoins)) + (3))\n    if <(clone) = [1]> then\n        switch costume to (x v)\n    end\n    show\n    if <(clone) > ((length of (Unicoins)) + (1))> then\n        hide\n    end\nend\n\nwhen I receive [start v]\nwait (0) seconds\nshow\nswitch costume to (unicoin v)\nset [clone v] to [0]\ngo to x: (-125) y: (160)\nset size to ((25) / (3)) %\nforever\n    go to [front v] layer\n    if <(clone) < ((length of (Unicoins)) + (1))> then\n        change [clone v] by (1)\n        create clone of (_myself_ v)\n    end\nend\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\n@gsquishy\n\nwhen I start as a clone\nset [x v] to (squishy x)\nset [y v] to ((squishy y) + (23))\nshow\nswitch costume to (squishy1 v)\nset [animation v] to [0]\nforever\n    if <(dead) < [3]> then\n        switch costume to (squishy hit v)\n        if <touching (player v)?> then\n            if <(dead) = [0]> then\n                change [score+ v] by (1)\n                set [score+x v] to (X)\n                set [score+y v] to (Y)\n                create clone of (score+ v)\n                create clone of (+coins v)\n                set [bounce v] to [1]\n                switch costume to (squishy dead v)\n                repeat (10)\n                    Position\n                    change [ghost v] effect by (10)\n                end\n                delete this clone\n            end\n        end\n        if <<touching (spinderlaser v)?> or <touching (missile v)?>> then\n            change [score+ v] by (1)\n            set [score+x v] to (X)\n            set [score+y v] to (Y)\n            create clone of (score+ v)\n            switch costume to (squishy dead v)\n            repeat (10)\n                change [ghost v] effect by (10)\n            end\n            delete this clone\n        end\n        if <([abs v] of (Y) ) > [180]> then\n            delete this clone\n        end\n        if <((X) - (CamX)) < [-240]> then\n            delete this clone\n        end\n        Position\n        change [animation v] by (0.5)\n        if <(animation) > [6]> then\n            set [animation v] to [0.2]\n        end\n        switch costume to (join [squishy] ([ceiling v] of (animation) ))\n        if <touching (player v)?> then\n            if <(invincible) = [0]> then\n                set [dead v] to [1]\n            end\n        end\n    end\nend\n\ndefine Position\ngo to x: ((X) - (CamX)) y: (Y)\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\n@+coins\n\nwhen I start as a clone\ngo to x: (-105) y: (145)\nset size to (12.5) %\nshow\nset [ghost v] effect to (0)\nswitch costume to (+100 v)\nchange [unicoins v] by (100)\nstart sound [nsmbwiiCoin v]\nrepeat (10)\n    change y by (1)\nend\nrepeat (10)\n    change y by (1)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nwhen I receive [main v]\nhide\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\n@Power Up HUD\n\nwhen I receive [start v]\nshow\nset [power up v] to [none]\nforever\n    switch costume to (power up)\n    if <(power up) = [random]> then\n        start sound [Item Box1 v]\n        repeat (25)\n            next costume\n        end\n        set [power up v] to (item (pick random (1) to (length of [power ups v])) of [power ups v])\n        start sound [Item Box2 v]\n    end\nend\n\nwhen I receive [main v]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\n@Power up\n\nwhen I start as a clone\nset [x v] to (powerx)\nset [y v] to ((powery) + (75))\nshow\nswitch costume to (powerup v)\nforever\n    if <(dead) < [3]> then\n        if <([abs v] of (Y) ) > [180]> then\n            delete this clone\n        end\n        if <((X) - (CamX)) < [-240]> then\n            delete this clone\n        end\n        Position\n        if <touching (player v)?> then\n            switch costume to (powerup v)\n            start sound [Item Box Hit v]\n            repeat (10)\n                change [fisheye v] effect by (50)\n                change [ghost v] effect by (10)\n                change size by (2.5)\n            end\n            set [power up v] to [random]\n            delete this clone\n        end\n    end\nend\n\ndefine Position\ngo to x: ((X) - (CamX)) y: (Y)\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\n@gage\n\nwhen I receive [main v]\nhide\nset [gage v] to [100]\nforever\n    switch costume to (join ((round ((gage) / (5))) * (5)) [g])\n    show\n    go to x: (([x position v] of [player v]) / (2)) y: (([y position v] of [player v]) / (2))\n    if <(invincible) = [0]> then\n        hide\n    end\nend\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\n@continue\n\nwhen I receive [main v]\nset [dead v] to [0]\nhide\ndelete this clone\n\nwhen I start as a clone\nif <(clone) = [1]> then\n    set [ghost v] effect to (100)\n    set size to (25) %\n    go to x: (0) y: (-50)\n    switch costume to (space2 v)\n    repeat (10)\n        change [ghost v] effect by (-10)\n    end\n    forever\n        switch costume to (space1 v)\n        repeat (10)\n            if <(dead) = [0]> then\n                hide\n                stop [other scripts in sprite v]\n                delete this clone\n            end\n        end\n        switch costume to (space2 v)\n        repeat (5)\n            if <(dead) = [0]> then\n                hide\n                stop [other scripts in sprite v]\n                delete this clone\n            end\n        end\n    end\nelse\n    set [ghost v] effect to (100)\n    set size to (10) %\n    go to x: (0) y: (-65)\n    switch costume to (500 coins v)\n    repeat (10)\n        change [ghost v] effect by (-10)\n    end\nend\nforever\n    if <(dead) = [0]> then\n        hide\n        stop [other scripts in sprite v]\n        delete this clone\n    end\nend\n\nwhen I receive [start v]\nforever\n    hide\n    wait until <(dead) = [3]>\n    show\n    set [ghost v] effect to (100)\n    go to x: (0) y: (-50)\n    switch costume to (continue v)\n    set [clone v] to [1]\n    create clone of (_myself_ v)\n    set [clone v] to [2]\n    create clone of (_myself_ v)\n    set [clone v] to [0]\n    repeat until <(y position) > [-25]>\n        change y by (((0) - (y position)) / (5))\n        change [ghost v] effect by (-25)\n    end\n    repeat until <<(y position) > [25]> or <<key (space v) pressed?> and <(Unicoins) > [499]>>>\n        change y by (((50) - (y position)) / (100))\n        change [ghost v] effect by (-25)\n    end\n    if <<<key (space v) pressed?> or <mouse down?>> and <(Unicoins) > [499]>> then\n        change [unicoins v] by (-500)\n        set [lives v] to [5]\n        set [dead v] to [4]\n        start sound [nsmbwiiStartLevel v]\n        repeat until <(y position) > [50]>\n            change y by (((75) - (y position)) / (5))\n            change [ghost v] effect by (25)\n        end\n    else\n        repeat until <(y position) > [50]>\n            change y by (((75) - (y position)) / (5))\n            change [ghost v] effect by (25)\n        end\n        set [ghost v] effect to (100)\n        set [dead v] to [0]\n        broadcast (main v)\n    end\nend\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\n@music\n\nwhen I receive [main v]\nshow\n\nwhen this sprite clicked\nnext costume\nset [volume v] to (((costume [number v]) - (1)) * (100))\nbroadcast (volumechange v)\n\nwhen flag clicked\nforever\n    set volume to (volume) %\n    if <(costume [number v]) = [1]> then\n        set [ghost v] effect to (25)\n    else\n        set [ghost v] effect to (0)\n    end\nend\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\n@personal best main\n\nwhen I receive [main v]\nwait (0) seconds\nset [clone v] to [0]\ngo to x: (170) y: (160)\nset size to (25) %\nhide\nforever\n    if <(clone) < ((length of (Personal Best)) + (1))> then\n        change [clone v] by (1)\n        create clone of (_myself_ v)\n    end\nend\n\nwhen I start as a clone\nset size to (12.5) %\nforever\n    set x to ((((length of ((Personal Best) + (1))) - (clone)) * (-5)) + (160))\n    switch costume to ((letter (clone) of (Personal Best)) + (2))\n    show\n    if <(clone) = ((length of (Personal Best)) + (1))> then\n        switch costume to (pts v)\n    end\n    if <(clone) > ((length of (Personal Best)) + (1))> then\n        hide\n    end\nend\n\nwhen I receive [start v]\nhide\nstop [other scripts in sprite v]\ndelete this clone\n\nwhen I receive [volumechange v]\nset volume to (volume) %\n\n