Loop - Platformer

Instructions: How To Make A Platformer On Scratch! :D \nhttps://scratch.mit.edu/discuss/youtube/-fTrmte3LCQ/\n\nHow To Make A Clicker Game On Scratch! :D \nhttps://scratch.mit.edu/discuss/youtube/bfTXxRX_CQw\n\n\nCheck Out My Best Ever Fifa 23 Goals And Saves Youtube Video! :D https://scratch.mit.edu/discuss/youtube/ZRyV9PBylbU/\n\nNew Game Out! :D https://scratch.mit.edu/projects/850524404/\n\nDodge Toxic Green Slime Saws And Machines Climb Across The Boxes And Complete The Levels\n\nPlease love and fav this! :D\nThanks Fatrat For The Music! :D

@Stage\n\nwhen I receive [color v]\nset [color v] effect to (0)\n\nwhen I receive [planet v]\nswitch backdrop to (backdrop1 v)\n\nwhen I receive [spaaace v]\nswitch backdrop to (backdrop2 v)\n\nwhen I receive [spaaace v]\nclear graphic effects\ndelete this clone\n\nwhen flag clicked\nset [!!! v] to [0]\nset [!! v] to [0]\nHide\nswitch backdrop to (backdrop3 v)\n\nwhen I receive [start v]\nforever\n    play sound [Avicii - Levels v] until done\n    play sound [Vexento - Lights v] until done\n    play sound [Masked Heroes v] until done\nend\n\ndefine Show\nshow variable [gravity v]\nshow variable [invincibility v]\nshow variable [planets unlocked v]\nshow variable [space borders? v]\nshow variable [space speed v]\nshow variable [xv speed v]\nshow variable [lps \(leaves per second\) v]\nset [!!! v] to [1]\n\ndefine Hide\nhide variable [gravity v]\nhide variable [invincibility v]\nhide variable [planets unlocked v]\nhide variable [space borders? v]\nhide variable [space speed v]\nhide variable [xv speed v]\nhide variable [lps \(leaves per second\) v]\nset [!!! v] to [0]\n\nwhen [h v] key pressed\nif <(!!) = [1]> then\n    if <(!!!) = [0]> then\n        Show\n    else\n        Hide\n    end\nend\n\nwhen [l v] key pressed\nif <(lag?) = [1]> then\n    set [lag? v] to [0]\nelse\n    set [lag? v] to [1]\nend\n\nstart sound [Avicii - Levels v]\n\n@player\n\nwhen I receive [color v]\nset [color v] effect to (0)\n\nwhen I receive [spaaace v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nwhen I receive [planet v]\nshow\ngo to x: (-220) y: (-150)\nset rotation style [left-right v]\nset [yv v] to [0]\nset [xv v] to [0]\nset [gravity v] to (item ([ceiling v] of ((level#) / (5)) ) of [gravity v])\nset [xv speed v] to (item ([ceiling v] of ((level#) / (5)) ) of [speed v])\nforever\n    if <key (space v) pressed?> then\n        broadcast (SPAAACE v)\n    end\n    change [f v] by (1)\n    change [yv v] by (gravity)\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        point in direction (90)\n        change [xv v] by (Xv speed)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        point in direction (-90)\n        change [xv v] by ((Xv speed) * (-1))\n    end\n    change x by (Xv)\n    if <touching (ground v)?> then\n        change y by (1)\n        if <touching (ground v)?> then\n            change y by (1)\n            if <touching (ground v)?> then\n                change y by (1)\n                if <touching (ground v)?> then\n                    change y by (1)\n                    if <touching (ground v)?> then\n                        change y by (1)\n                        if <touching (ground v)?> then\n                            change x by ((Xv) * (-1))\n                            change x by (-1)\n                            change y by (-5)\n                            change x by (1)\n                            if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                                if <[0] > (Xv)> then\n                                    set [xv v] to ((Xv speed) * (16))\n                                else\n                                    set [xv v] to ((Xv speed) * (-16))\n                                end\n                                set [yv v] to [10]\n                            else\n                                set [xv v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (Yv)\n    if <touching (ground v)?> then\n        change y by ((Yv) * (-1))\n        set [yv v] to [-1]\n    end\n    change y by (-5)\n    if <touching (ground v)?> then\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            set [yv v] to [10]\n        end\n    end\n    if <<<touching (ded v)?> or <(y position) < [-180]>> and <(invincibility) = [0]>> then\n        go to x: (-220) y: (-150)\n        set rotation style [left-right v]\n        set [yv v] to [0]\n        set [xv v] to [0]\n    end\n    if <key (r v) pressed?> then\n        go to x: (-220) y: (-150)\n        set [yv v] to [0]\n        set [xv v] to [0]\n    end\n    change y by (5)\n    set [xv v] to ((Xv) * (0.93))\n    if <<(x position) > [235]> and <not <[0] = ((level#) mod (5))>>> then\n        go to x: (-220) y: (-150)\n        set [yv v] to [0]\n        set [xv v] to [0]\n        change [level# v] by (1)\n        broadcast (Planet v)\n    end\n    if <<key (j v) pressed?> and <not <[0] = ((level#) mod (5))>>> then\n        go to x: (-220) y: (-150)\n        set [yv v] to [0]\n        set [xv v] to [0]\n        change [level# v] by (1)\n        broadcast (Planet v)\n    end\n    if <<[0] = ((level#) mod (5))> and <((level#) / (5)) = (planets unlocked)>> then\n        change [planets unlocked v] by (1)\n    end\nend\n\nwhen I receive [spaaace v]\nclear graphic effects\ndelete this clone\n\nset [color v] to [0]\nbroadcast (color v)\n\nwhen I receive [start v]\nset [lag? v] to [1]\nset [level# v] to [1]\nset [planets unlocked v] to [1]\nset [space borders? v] to [1]\nset [invincibility v] to [0]\nset [space speed v] to [0.22]\nbroadcast (Planet v)\n\nwhen flag clicked\n\nwhen flag clicked\nhide\n\n@Background Creator\n\ndefine generate\nshow\nswitch costume to (costume4 v)\ngo to x: (-240) y: (180)\nrepeat (pick random (3) to (4))\n    change x by (pick random (50) to (150))\n    repeat until <(y position) < [-176]>\n        change y by (-10)\n        if <touching (ground v)?> then\n            set [! v] to [1]\n            check\n            switch costume to (costume1 v)\n            if <(!) = [1]> then\n                if <(pick random (1) to (10)) < [7]> then\n                    create clone of (_myself_ v)\n                else\n                    switch costume to (costume2 v)\n                    create clone of (_myself_ v)\n                end\n                repeat until <<not <touching (ground v)?>> or <(y position) < [-179]>>\n                    change y by (-1)\n                end\n                change x by (pick random (-10) to (50))\n            end\n        end\n        switch costume to (costume4 v)\n    end\n    set y to (180)\nend\nhide\n\nwhen I start as a clone\nrepeat (20)\n    go to [back v] layer\nend\n\nwhen I receive [color v]\nset [color v] effect to (color)\n\nwhen I receive [spaaace v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nwhen I receive [generate v]\nif <not <(level#) = [30]>> then\n    generate\nend\nset [color v] to (item ([ceiling v] of ((level#) / (5)) ) of [!c v])\nbroadcast (color v)\n\nwhen I receive [planet v]\ndelete this clone\n\nwhen I receive [spaaace v]\nclear graphic effects\ndelete this clone\n\ndefine check\nrepeat (25)\n    change x by (-1)\n    if <not <touching (ground v)?>> then\n        set [! v] to [0]\n    end\nend\nchange x by (25)\nrepeat (25)\n    change x by (1)\n    if <not <touching (ground v)?>> then\n        set [! v] to [0]\n    end\nend\nchange x by (-25)\n\nwhen flag clicked\nhide variable [lives: v]\nhide\n\n@ground\n\nwhen I receive [color v]\nset [color v] effect to (color)\n\nwhen I receive [spaaace v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nwhen I receive [planet v]\nshow\ngo to x: (0) y: (0)\nswitch costume to (level#)\nbroadcast (generate v)\n\nwhen I receive [spaaace v]\nclear graphic effects\ndelete this clone\n\nwhen flag clicked\nhide\n\nset [level# v] to [29]\nbroadcast (Planet v)\n\n@Ded\n\nwhen I receive [spaaace v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nwhen I receive [spaaace v]\n\nwhen I receive [spaaace v]\nclear graphic effects\ndelete this clone\n\nwhen I receive [planet v]\ngo to x: (0) y: (0)\nshow\nswitch costume to (level#)\nrepeat (10)\n    go to [back v] layer\nend\n\nwhen I receive [color v]\nset [color v] effect to (color)\n\nwhen I receive [spaaace v]\nhide\n\nwhen flag clicked\nhide\n\n@Text\n\nwhen I receive [color v]\nset [color v] effect to (color)\n\nwhen I receive [spaaace v]\nhide\n\nwhen I receive [planet v]\ngo to x: (0) y: (0)\ngo to [back v] layer\nshow\nswitch costume to (level#)\n\nwhen flag clicked\nhide\n\n@leaves\n\nwhen I start as a clone\nshow\ngo to [front v] layer\ngo to x: (2408) y: (pick random (-130) to (180))\nset size to (pick random (80.) to (200)) %\nset [ghost v] effect to ((size) / (10))\nset [turn v] to (pick random (-5.) to (5))\nset [y v] to (pick random (-1.3) to (0.25))\nset [x v] to (pick random (-3.3) to (-1))\nset [xv v] to [0]\nset [yv v] to [0]\nrepeat until <<not <touching (_edge_ v)?>> or <(x position) < [-239]>>\n    turn right (turn) degrees\n    change y by (y)\n    change x by (x)\n    if <touching (player v)?> then\n        set [xv v] to (([xv v] of [player v]) * (0.5))\n        set [yv v] to (([yv v] of [player v]) * (0.5))\n    end\n    change y by (yv)\n    change x by (xv)\n    set [xv v] to ((xv) * (0.9))\n    set [yv v] to ((yv) * (0.9))\nend\nrepeat until <<touching (_edge_ v)?> or <(x position) < [-239]>>\n    turn right (turn) degrees\n    change y by (y)\n    change x by (x)\n    if <touching (player v)?> then\n        set [xv v] to (([xv v] of [player v]) * (0.5))\n        set [yv v] to (([yv v] of [player v]) * (0.5))\n    end\n    change y by (yv)\n    change x by (xv)\n    set [xv v] to ((xv) * (0.9))\n    set [yv v] to ((yv) * (0.9))\nend\ndelete this clone\n\nwhen I receive [color v]\nset [color v] effect to (color)\n\nforever\n    change [color v] by (1)\nend\n\nbroadcast (color v)\n\nwhen I receive [generate v]\nrepeat (10)\n    delete this clone\nend\nhide\nforever\n    if <(lag?) = [1]> then\n        create clone of (_myself_ v)\n        wait ((1) / (LPS \(leaves per second\))) seconds\n    end\nend\n\nwhen I receive [spaaace v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nwhen I receive [planet v]\n\ncreate clone of (_myself_ v)\n\nwhen I receive [spaaace v]\nclear graphic effects\ndelete this clone\n\nwhen flag clicked\nset [lps \(leaves per second\) v] to [1.6]\nhide\n\n@fps\n\nwhen flag clicked\nforever\n    wait (1) seconds\n    set [fps v] to (f)\n    set [f v] to [0]\nend\n\nwhen flag clicked\nhide\n\n@Enemies\n\ndefine (x1) , y: (y1) and x: (x2) , y: (y2)\nset [d v] to ([sqrt v] of ((((x1) - (x2)) * ((x1) - (x2))) + (((y1) - (y2)) * ((y1) - (y2)))) )\n\ndefine point towards x: (x) y: (y)\nif <not <(y) < (y position)>> then\n    point in direction ([atan v] of (((x) - (x position)) / ((y) - (y position))) )\nelse\n    point in direction ((180) + ([atan v] of (((x) - (x position)) / ((y) - (y position))) ))\nend\n\nwhen I start as a clone\nset [d v] to [0]\nrepeat until <(d) > [500]>\n    set [ship x v] to (pick random (-2400) to (2400))\n    set [ship y v] to (pick random (-1800) to (1800))\n    (ship x) , y: (ship y) and x: (x pos) , y: (y pos)\nend\nforever\n    (ship x) , y: (ship y) and x: (x pos) , y: (y pos)\n    if <(d) < [500]> then\n        move [5] [999]\n    else\n        move [5] [5]\n    end\n    Show? ((ship x) - (x pos)) ((ship y) - (y pos))\nend\n\ndefine move (steps) (turn)\nif <(turn) = [999]> then\n    go to x: ((ship x) / (10)) y: ((ship y) / (10))\n    point towards x: ((x pos) / (10)) y: ((y pos) / (10))\n    move ((steps) / (10)) steps\n    set [ship x v] to ((x position) * (10))\n    set [ship y v] to ((y position) * (10))\nelse\n    go to x: ((ship x) / (10)) y: ((ship y) / (10))\n    turn right (turn) degrees\n    move ((steps) / (10)) steps\n    set [ship x v] to ((x position) * (10))\n    set [ship y v] to ((y position) * (10))\nend\n\ndefine Show? (x) (y)\ngo to x: (x) y: (y)\nif <<(x position) = (x)> and <(y position) = (y)>> then\n    show\nelse\n    hide\nend\n\ndefine shoot\nadd (ship x) to [bx v]\nadd (ship y) to [by v]\nadd (direction) to [bd v]\nadd [0] to [runs v]\nadd [1] to [bc v]\n\nwhen I start as a clone\nforever\n    wait (3) seconds\n    if <(d) < [500]> then\n        shoot\n    end\nend\n\nif <touching color (join [#FF0000] [])?> then\n    delete this clone\nend\n\nwhen I receive [spaaace v]\nrepeat (1)\n    delete this clone\nend\nrepeat (10)\n    create clone of (_myself_ v)\nend\n\nwhen I receive [planet v]\nerase all\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nwhen flag clicked\nhide\n\n@Space and Player\n\ndefine Set 'Distance:' variable to the distance between x: (x1) , y: (y1) and x: (x2) , y: (y2)\nset [distance: v] to ([sqrt v] of ((((x1) - (x2)) * ((x1) - (x2))) + (((y1) - (y2)) * ((y1) - (y2)))) )\n\ndefine Show? (x) (y)\nset pen color to (#ffffff)\nset pen size to (5)\nSet 'Distance:' variable to the distance between x: (item (2) of [x v]) , y: (item (2) of [y v]) and x: (x pos) , y: (y pos)\nif <(Distance:) < [500]> then\n    go to x: (x) y: (y)\n    pen down\nend\npen up\n\ndefine render\nerase all\nswitch costume to (costume1 v)\nset [2 v] to [1]\nrepeat (length of [x v])\n    Show? ((item (2) of [x v]) - (x pos)) ((item (2) of [y v]) - (y pos))\n    change [2 v] by (1)\nend\ndraw planets\npoint in direction (90)\ngo to x: ((0) - (x pos)) y: ((50) - (y pos))\nif <<(x position) = ((0) - (x pos))> and <(y position) = ((50) - (y pos))>> then\n    switch costume to (costume4 v)\n    stamp\nend\nswitch costume to (costume1 v)\ndraw minimap\nbullets\ngo to x: (0) y: (0)\n\ndefine lal\ndelete all of [x v]\ndelete all of [y v]\ndelete all of [planetx v]\ndelete all of [planety v]\ndelete all of [c v]\ndelete all of [s v]\ndelete all of [bx v]\ndelete all of [bd v]\ndelete all of [by v]\ndelete all of [runs v]\ndelete all of [bc v]\ndelete all of [gravity v]\ndelete all of [speed v]\nrepeat (300)\n    add (pick random (-2400) to (2400)) to [x v]\n    add (pick random (-2400) to (2400)) to [y v]\nend\nplanet at [0] [0] Size [200] Color [130] Gravity [-0.5] Speed [0.5]\nplanet at [-2000] [500] Size [450] Color [10] Gravity [-1] Speed [2]\nplanet at [1500] [1000] Size [100] Color [60] Gravity [-0.25] Speed [4]\nplanet at [-500] [-1500] Size [250] Color [30] Gravity [-0.75] Speed [0.25]\nplanet at [-1000] [1300] Size [150] Color [150] Gravity [-0.3] Speed [1]\nplanet at [1000] [-1200] Size [1000] Color [170] Gravity [-2] Speed [1]\n\ndefine draw minimap\nset pen (saturation v) to (0)\nset pen (brightness v) to (100)\nset pen size to (5)\nif <(Space Borders?) = [1]> then\n    pen up\n    go to x: (115) y: (-180)\n    pen down\n    go to x: (115) y: (-85)\n    go to x: (240) y: (-85)\nend\npen up\nset [# v] to [1]\nrepeat (planets unlocked)\n    planet\n    change [# v] by (1)\nend\ngo to x: (((x pos) / (40)) + (180)) y: (((y pos) / (40)) + (-135))\nset pen (brightness v) to (100)\nset pen (saturation v) to (0)\nset pen size to (5)\npen down\npen up\n\ndefine planet\nset pen (brightness v) to (100)\nset pen (saturation v) to (75)\ngo to x: (((item (#) of [planetx v]) / (40)) + (180)) y: (((item (#) of [planety v]) / (40)) + (-135))\nset pen (color v) to ((item (#) of [c v]) / (2))\nset pen (brightness v) to (50)\nset pen size to (((item (#) of [s v]) / (40)) + (4))\npen down\npen up\nset pen (brightness v) to (100)\nset pen size to ((item (#) of [s v]) / (40))\npen down\npen up\n\ndefine draw planets\nset [# v] to [1]\nrepeat (planets unlocked)\n    pen up\n    set pen (brightness v) to (100)\n    set pen (saturation v) to (75)\n    go to x: ((item (#) of [planetx v]) - (x pos)) y: ((item (#) of [planety v]) - (y pos))\n    if <<(x position) = ((item (#) of [planetx v]) - (x pos))> and <(y position) = ((item (#) of [planety v]) - (y pos))>> then\n        set pen (color v) to ((item (#) of [c v]) / (2))\n        set pen (brightness v) to (50)\n        set pen size to ((item (#) of [s v]) + (40))\n        pen down\n        pen up\n        set pen (brightness v) to (100)\n        set pen size to (item (#) of [s v])\n        pen down\n        pen up\n    end\n    change [# v] by (1)\nend\n\ndefine planet at (x) (y) Size (s) Color (c) Gravity (g) Speed (ss)\nadd (s) to [s v]\nadd (c) to [c v]\nadd (x) to [planetx v]\nadd (y) to [planety v]\nadd (g) to [gravity v]\nadd (ss) to [speed v]\n\ndefine chreck\nif <(Space Borders?) = [1]> then\n    if <(x pos) < [-2400]> then\n        set [x pos v] to [-2400]\n    end\n    if <(x pos) > [2400]> then\n        set [x pos v] to [2400]\n    end\n    if <(y pos) < [-1800]> then\n        set [y pos v] to [-1800]\n    end\n    if <(y pos) > [1800]> then\n        set [y pos v] to [1800]\n    end\nend\n\ndefine shoot\nadd (x pos) to [bx v]\nadd (y pos) to [by v]\nadd (direction) to [bd v]\nadd [0] to [runs v]\nadd [1] to [bc v]\n\ndefine bullets\nset [touching? v] to [0]\nset [# v] to [1]\nrepeat (length of [bd v])\n    go to x: ((item (#) of [bx v]) / (10)) y: ((item (#) of [by v]) / (10))\n    point in direction (item (#) of [bd v])\n    move (1.5) steps\n    replace item (#) of [bx v] with ((x position) * (10))\n    replace item (#) of [by v] with ((y position) * (10))\n    replace item (#) of [runs v] with ((item (#) of [runs v]) + (1))\n    go to x: ((item (#) of [bx v]) - (x pos)) y: ((item (#) of [by v]) - (y pos))\n    if <<(x position) = ((item (#) of [bx v]) - (x pos))> and <(y position) = ((item (#) of [by v]) - (y pos))>> then\n        if <(item (#) of [bc v]) = [1]> then\n            set pen color to (join [#FF0000] [])\n            Set 'Distance:' variable to the distance between x: (item (#) of [bx v]) , y: (item (#) of [by v]) and x: (x pos) , y: (y pos)\n            if <<(Distance:) < [50]> and <(invincibility) < [1]>> then\n                set [touching? v] to [1]\n            end\n        else\n            set pen color to (#ff0404)\n        end\n        set pen size to (10)\n        pen down\n    end\n    pen up\n    if <(item (#) of [runs v]) = [100]> then\n        delete (#) of [bd v]\n        delete (#) of [bx v]\n        delete (#) of [by v]\n        delete (#) of [bc v]\n        delete (#) of [runs v]\n    else\n        change [# v] by (1)\n    end\nend\n\nwhen I receive [spaaace v]\nswitch costume to (costume2 v)\nset size to (100) %\nshow\npoint in direction (0)\ngo to x: (0) y: (0)\nshow variable [lives: v]\nset [turn2 v] to [0]\nset [x pos v] to (item ([ceiling v] of ((level#) / (5)) ) of [planetx v])\nset [y pos v] to (item ([ceiling v] of ((level#) / (5)) ) of [planety v])\nset [accel v] to [0]\nset [lives: v] to [3]\nset [xv v] to [0]\nset [yv v] to [0]\nlal\nrender\nswitch costume to (costume2 v)\nwait until <not <key (space v) pressed?>>\nout of planet\nset [direction v] to (direction)\nset [touched? v] to [0]\nforever\n    change [f v] by (1)\n    render\n    change [direction v] by (turn2)\n    point in direction (direction)\n    if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n        change [turn2 v] by (0.4)\n    end\n    if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n        change [turn2 v] by (-0.4)\n    end\n    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        change [accel v] by (Space speed)\n        change [xv v] by (([sin v] of (direction) ) * ((accel) / (10)))\n        change [yv v] by (([cos v] of (direction) ) * ((accel) / (10)))\n        switch costume to (costume3 v)\n    else\n        switch costume to (costume2 v)\n    end\n    if <<key (s v) pressed?> or <key (down arrow v) pressed?>> then\n        set [accel v] to ((accel) * (0.9))\n    end\n    set [accel v] to ((accel) * (0.99))\n    set [turn2 v] to ((turn2) * (0.97))\n    change [x pos v] by (xv)\n    change [y pos v] by (yv)\n    if <(planets unlocked) = [7]> then\n        set [planets unlocked v] to [6]\n    end\n    chreck\n    if <(touching?) = [1]> then\n        if <<touching color (join [#FF0000] [])?> and <(touched?) = [0]>> then\n            set [touched? v] to [1]\n            change [lives: v] by (-1)\n        else\n            if <not <touching color (join [#FF0000] [])?>> then\n                set [touched? v] to [0]\n            end\n        end\n    end\n    if <key (space v) pressed?> then\n        what planet\n    end\n    if <(Lives:) = [0]> then\n        broadcast (SPAAACE v)\n    end\nend\n\nwhen I receive [planet v]\nerase all\nhide variable [lives: v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\ndefine what planet\nif <touching color (#3f52ff)?> then\n    set [level# v] to [1]\n    to the planet\nelse\n    if <touching color (#ff793f)?> then\n        set [level# v] to [6]\n        to the planet\n    else\n        if <touching color (#65ff3f)?> then\n            set [level# v] to [11]\n            to the planet\n        else\n            if <touching color (#ffeb3f)?> then\n                set [level# v] to [16]\n                to the planet\n            else\n                if <touching color (#9f3fff)?> then\n                    set [level# v] to [21]\n                    to the planet\n                else\n                    if <touching color (#ff3feb)?> then\n                        set [level# v] to [26]\n                        to the planet\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine to the planet\nset size to (100) %\nrepeat (40)\n    change size by (-2)\n    turn right (15) degrees\nend\nbroadcast (Planet v)\n\nadd (color) to [!c v]\nbroadcast (SPAAACE v)\n\nwhen flag clicked\ndelete all of [!c v]\nadd [0] to [!c v]\nadd [104] to [!c v]\nadd [158] to [!c v]\nadd [128] to [!c v]\nadd [26] to [!c v]\nadd [69] to [!c v]\n\ndefine out of planet\nset size to (20) %\nrepeat (40)\n    change size by (2)\n    turn right (-19) degrees\nend\n\nrepeat (10)\n    planet at (pick random (-2400) to (2400)) (pick random (-1800) to (1800)) Size (pick random (50) to (1000)) Color (pick random (0) to (200)) Gravity [-2] Speed [1]\nend\n\nwhen flag clicked\nhide\n\n@Intro1\n\nwhen flag clicked\npoint in direction (90)\nrepeat (12)\n    turn left (30) degrees\nend\n\nwhen flag clicked\ngo to x: (223) y: (0)\nrepeat (12)\n    glide (.3) secs to x: (0) y: (0)\nend\n\nwhen flag clicked\nshow\nreset timer\nset [button color v] to [0]\nset size to (100) %\nwait (.45) seconds\nbroadcast (1 v)\nrepeat (10)\n    change [button color v] by (1)\n    change size by (button color)\nend\nrepeat until <(timer) > [4]>\n    repeat (20)\n        change [button color v] by (-1)\n        change size by (button color)\n    end\n    repeat (20)\n        change [button color v] by (1)\n        change size by (button color)\n    end\nend\nbroadcast (2 v)\n\nwhen I start as a clone\nrepeat (50)\n    change size by (5)\n    change [ghost v] effect by (2)\nend\ndelete this clone\n\nwhen flag clicked\nset size to (100) %\nwait (.45) seconds\nrepeat until <(timer) > [4]>\n    create clone of (_myself_ v)\n    wait (0.6) seconds\nend\n\nwhen flag clicked\nset volume to (100) %\nreset timer\nset [button color v] to [0]\nset size to (100) %\nwait (.45) seconds\nstart sound [Jackpot! The fat rat2 v]\nwait until <(timer) > [9.5]>\nrepeat (16)\n    change volume by (-5)\nend\nrepeat (20)\n    change volume by (-1)\nend\nstop all sounds\nbroadcast (Start v)\n\nwhen flag clicked\nerase all\n\nwhen I receive [start v]\nstop [other scripts in sprite v]\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nhide\ndelete this clone\n\n@Intro2\n\nwhen flag clicked\npoint in direction (90)\nrepeat (12)\n    turn left (30) degrees\nend\n\nwhen flag clicked\nset size to (0) %\ngo to x: (0) y: (0)\nrepeat (12)\n    change size by (8.333)\nend\n\nwhen flag clicked\nshow\nwait (.45) seconds\nrepeat until <(timer) > [4]>\n    repeat (10)\n        change size by (3)\n    end\n    repeat (10)\n        change size by (-3)\n    end\nend\nset size to (150) %\n\nwhen I receive [start v]\nstop [other scripts in sprite v]\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nhide\ndelete this clone\n\n@Intro3\n\nwhen flag clicked\nset size to (300) %\ngo to x: (0) y: (0)\npoint in direction (75)\nhide\nrepeat (10)\n    create clone of (_myself_ v)\n    turn left (15) degrees\nend\n\nwhen I receive [2 v]\nset [momentum v] to (pick random (10) to (15))\nset [yv v] to (pick random (2) to (3))\nchange size by (pick random (-150) to (0))\nchange [brightness v] effect by (pick random (-20) to (20))\nturn right (pick random (-10) to (10)) degrees\nshow\nrepeat until <touching (_edge_ v)?>\n    go to [back v] layer\n    move (Momentum) steps\n    change y by (Yv)\n    change [yv v] by (-0.4)\n    set [momentum v] to ((Momentum) * (0.95))\nend\nhide\ndelete this clone\n\nwhen I receive [start v]\nstop [other scripts in sprite v]\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nhide\ndelete this clone\n\n@Intro4\n\nwhen flag clicked\npoint in direction (90)\nrepeat (12)\n    turn left (30) degrees\nend\n\nwhen flag clicked\nshow\ngo to x: (0) y: (-300)\nglide (.3) secs to x: (0) y: (0)\n\nwhen flag clicked\nset size to (100) %\nwait (.45) seconds\nrepeat (10)\n    change size by (6)\nend\nrepeat until <(timer) > [4]>\n    repeat (10)\n        change size by (-6)\n    end\n    repeat (10)\n        change size by (6)\n    end\nend\n\nwhen I receive [start v]\nstop [other scripts in sprite v]\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nhide\ndelete this clone\n\n@Thumbnail\n\nwhen flag clicked\nrepeat (10)\n    change [ghost v] effect by (10)\nend\n\n