Sandstorm || A Platformer #games

Instructions: Use WASD or arrow keys to move. All levels are possible. This is a sequel. The first part is here : https://scratch.mit.edu/projects/466583701/

@Stage\n\nwhen flag clicked\nset [level v] to [0]\nswitch backdrop to (landscape v)\nwait (9) seconds\nswitch backdrop to (landscape v)\nforever\n    set [ghost v] effect to (10)\n    if <(level) = [10]> then\n        next backdrop\n        stop [this script v]\n    else\n        switch backdrop to (landscape v)\n    end\nend\n\n@Ground\n\nwhen I receive [next level v]\nnext costume\n\nwhen flag clicked\nshow\ngo to x: (44) y: (27)\nrepeat (10)\n    switch costume to (costume1 v)\nend\n\n@Spikes\n\nwhen flag clicked\ngo to [back v] layer\nshow\nswitch costume to (download \(14\) v)\n\nwhen I receive [next level v]\nnext costume\n\n@Trampoline\n\nwhen flag clicked\ngo to [back v] layer\nswitch costume to (costume2 v)\n\nwhen I receive [next level v]\nnext costume\n\n@boost right\n\nwhen flag clicked\nswitch costume to (costume2 v)\n\nwhen I receive [next level v]\nnext costume\n\n@boost left\n\nwhen flag clicked\nshow\nswitch costume to (costume2 v)\n\nwhen I receive [next level v]\nnext costume\n\n@Sprite1\n\nwhen flag clicked\nswitch costume to (costume2 v)\nwait (10) seconds\nswitch costume to (costume1 v)\ngo to x: (100) y: (-10)\nset [ghost v] effect to (0)\nshow\ngo to [front v] layer\nset size to (100) %\nforever\n    if <touching (mouse-pointer v)?> then\n        change size by (10)\n        set size to (size) %\n        wait until <not <touching (mouse-pointer v)?>>\n    else\n        set size to (100) %\n    end\nend\n\nwhen this sprite clicked\nbroadcast (START v)\nrepeat (10)\n    wait (0.1) seconds\n    change [pixelate v] effect by (10)\nend\nhide\n\n@Sprite3\n\nwhen flag clicked\nhide\nwait (10) seconds\nset [level v] to [1]\ngo to x: (-204) y: (160)\nset [ghost v] effect to (0)\nshow\nset size to (80) %\nforever\n    go to [front v] layer\n    if <(level) = [10]> then\n        hide\n    end\nend\n\nwhen I receive [next level v]\nchange [level v] by (1)\n\nwhen flag clicked\nwait (10) seconds\nforever\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        broadcast (Next level v)\n        go to [front v] layer\n        go [backward v] (2) layers\n        wait (0.5) seconds\n    end\nend\n\n@Sprite4\n\nwhen flag clicked\nwait (10) seconds\nforever\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        broadcast (Return v)\n    end\nend\n\nwhen flag clicked\nhide\nwait (10) seconds\ngo to x: (-120) y: (159)\nset [ghost v] effect to (0)\nshow\nset size to (80) %\nforever\n    go to [front v] layer\n    if <(level) = [10]> then\n        hide\n    end\nend\n\nwhen I receive [start v]\ngo to [front v] layer\n\n@Sandstorm platformer Thumbnail2\n\nwhen I receive [start v]\nrepeat (10)\n    wait (0.1) seconds\n    change [pixelate v] effect by (10)\nend\nswitch costume to (costume1 v)\n\nwhen flag clicked\nhide\nwait (9) seconds\nswitch costume to (screen shot 2020-05-19 at 10 v)\ngo to x: (-1) y: (-3)\ngo to [front v] layer\ngo [backward v] (1) layers\nset [ghost v] effect to (0)\nshow\nset size to (100) %\nforever\n    set size to (120) %\nend\n\n@Sprite2\n\nwhen flag clicked\ngo to x: (-69) y: (162)\nwait (9) seconds\nswitch costume to (costume1 v)\nforever\n    set volume to (100) %\n    play sound [media v] until done\nend\n\nwhen this sprite clicked\n\nchange volume by (-10)\n\n@Sprite6\n\nwhen I start as a clone\nshow\nset y to (pick random (152) to (64))\nset [ghost v] effect to (pick random (30) to (50))\nswitch costume to (pick random (1) to (4))\nrepeat until <(x position) > [251]>\n    change x by (5)\nend\ndelete this clone\n\nwhen [space v] key pressed\ngo to [back v] layer\ngo to x: (-236) y: (41)\nhide\n\nwhen flag clicked\nhide\nforever\n    create clone of (_myself_ v)\n    wait (pick random (1) to (2.5)) seconds\nend\n\n@Sprite7\n\nwhen flag clicked\nset [level v] to [0]\nswitch costume to (costume1 v)\nset size to (800) %\ngo to [back v] layer\nforever\n    set y to (([y position v] of [player v]) * (-0.5))\n    set x to (([x position v] of [player v]) * (-0.5))\n    go to [back v] layer\n    if <(level) = [10]> then\n        next costume\n        go to [back v] layer\n        stop [this script v]\n    else\n        switch costume to (costume1 v)\n    end\nend\n\nwhen flag clicked\nforever\n    go to [back v] layer\nend\n\n@Sprite5\n\nwhen flag clicked\nhide\n\nwhen flag clicked\nshow\nswitch costume to (costume2 v)\ngo to [front v] layer\nset [ghost v] effect to (70)\n\nwhen I receive [won v]\nswitch costume to (costume1 v)\nshow\ngo to [front v] layer\nset [ghost v] effect to (70)\n\n@decor\n\nwhen flag clicked\ngo to x: (36) y: (28)\nswitch costume to (costume1 v)\nforever\n    go to [back v] layer\n    go [forward v] (10) layers\nend\n\nwhen I receive [next level v]\nnext costume\n\n@sandstorm\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nshow\ngo to [back v] layer\nswitch costume to (big v)\nset size to (pick random (30) to (130)) %\nswitch costume to (snow v)\nset [me v] to (pick random (30) to (70))\nset [ghost v] effect to (pick random (0) to (70))\ngo to x: (250) y: (pick random (-250) to (250))\npoint in direction (pick random (200) to (300))\nrepeat until \n    move ((0.5) + ((size) * (0.2))) steps\n    turn right ((1) * ([sin v] of ((1.3) * ((tick) + (me))) )) degrees\nend\ndelete this clone\n\ndelete this clone\n\nwhen flag clicked\nforever\n    switch costume to (costume1 v)\nend\n\nwhen flag clicked\nforever\n    create clone of (_myself_ v)\n    if <(level) = [10]> then\n        stop [other scripts in sprite v]\n        stop [this script v]\n    end\nend\n\nwhen I receive [won v]\nstop [other scripts in sprite v]\n\n@quicksand\n\nwhen I start as a clone\nshow\ngo to x: (50) y: (-150)\nset [ghost v] effect to (60)\ngo to [front v] layer\ngo [backward v] (10000) layers\nforever\n    set [time v] to [2]\n    switch costume to (level)\nend\n\nwhen flag clicked\nrepeat (3)\n    create clone of (_myself_ v)\n    wait (0.5) seconds\nend\n\nwhen I receive [next v]\nnext costume\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\n\nhide\n\nshow\ngo to [front v] layer\n\n@Player\n\nwhen flag clicked\nhide\nwait (10) seconds\nshow\nbroadcast (Return v)\nRefresh \nswitch costume to (right v)\nset [level v] to [1]\nforever\n    set size to (100) %\n    change [yvel v] by (-1)\n    if <<key (d v) pressed?> or <<key (right arrow v) pressed?> or <<(x position) < (mouse x)> and <mouse down?>>>> then\n        switch costume to (right v)\n        change [my variable v] by (0.8)\n        if <(level) = [10]> then\n            switch costume to (right2 v)\n        end\n    end\n    if <<key (a v) pressed?> or <<key (left arrow v) pressed?> or <<(x position) > (mouse x)> and <mouse down?>>>> then\n        switch costume to (left v)\n        change [my variable v] by (-0.8)\n        if <(level) = [10]> then\n            switch costume to (left2 v)\n        end\n    end\n    set [my variable v] to ((my variable) * (0.9))\n    change x by (my variable)\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                        change x by ((my variable) * (-1))\n                        change y by (-5)\n                        if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<(y position) < (mouse y)> and <mouse down?>>>> then\n                            set [yvel v] to [12.5]\n                            if <(my variable) > [0]> then\n                                set [my variable v] to [-7.5]\n                            else\n                                set [my variable v] to [7.5]\n                            end\n                        else\n                            set [my variable v] to [0]\n                            set size to (120) %\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (Yvel)\n    if <touching (ground v)?> then\n        change y by ((Yvel) * (-1))\n        set [yvel v] to [0]\n    end\n    change y by (-1)\n    if <touching (ground v)?> then\n        if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<(y position) < (mouse y)> and <mouse down?>>>> then\n            set [yvel v] to [14]\n        end\n    end\n    change y by (1)\n    if <(x position) > [239]> then\n        go to x: (-211) y: (-37)\n        change [level v] by (1)\n        Refresh \n        broadcast (Next level v)\n    end\n    if <<touching (spikes v)?> or <(y position) < [-175]>> then\n        repeat (10)\n            change size by (-5)\n            wait (0.01) seconds\n        end\n        wait (0.1) seconds\n        set [my variable v] to [0]\n        set [yvel v] to [0]\n        broadcast (Return v)\n        repeat (10)\n            change size by (5)\n            wait (0.01) seconds\n        end\n    end\n    if <touching (quicksand v)?> then\n        repeat until <<touching (ground v)?> or <(y position) < [-175]>>\n            change y by (-2)\n        end\n        repeat (10)\n            change size by (-5)\n            wait (0.01) seconds\n        end\n        wait (0.1) seconds\n        set [my variable v] to [0]\n        set [yvel v] to [0]\n        broadcast (Return v)\n        repeat (10)\n            change size by (5)\n            wait (0.01) seconds\n        end\n    end\n    if <touching (water v)?> then\n        change y by (-2)\n    end\n    if <touching (trampoline v)?> then\n        set [yvel v] to [22.5]\n        broadcast (Tj v)\n    end\n    if <touching (boost right v)?> then\n        change [my variable v] by (7.5)\n    end\n    if <touching (boost left v)?> then\n        change [my variable v] by (-7.5)\n    end\n    if <touching (trampoline v)?> then\n        set [yvel v] to [22.5]\n        broadcast (Tj v)\n    end\n    if <touching (boost right v)?> then\n        change [my variable v] by (7.5)\n    end\n    if <touching (boost left v)?> then\n        change [my variable v] by (-7.5)\n    end\nend\n\nwhen flag clicked\ngo to x: (-224) y: (11)\n\nwhen I receive [return v]\ngo to x: (-224) y: (11)\n\nwhen I receive [next level v]\ngo to x: (-224) y: (11)\n\nwhen I receive [start v]\ngo to [front v] layer\n\nwhen flag clicked\nwait (10) seconds\nforever\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nrepeat (10)\n    change size by (-3)\n    change y by (-0.3)\n    change [ghost v] effect by (10)\n    show\n    wait (0) seconds\nend\ndelete this clone\n\nswitch costume to (right v)\n\nwhen flag clicked\nset [color v] to [0]\nforever\n    if <<[-111] > (mouse x)> and <[-170] > (mouse y)>> then\n        set [color v] to [1]\n    end\n    if <(color) = [1]> then\n        change [color v] effect by (25)\n        wait (0.05) seconds\n    end\nend\n\n@Sprite8\n\nwhen flag clicked\nswitch costume to (costume1 v)\ngo to [front v] layer\ngo [backward v] (8) layers\nwait (9) seconds\nwait (1) seconds\ngo to [back v] layer\nswitch costume to (costume2 v)\n\n@TB\n\nwhen flag clicked\ngo to [front v] layer\nset [ghost v] effect to (100)\ngo to x: (-300) y: (0)\nforever\n    set [checktimer v] to (timer)\nend\n\nwhen [timer v] > (Checktimer)\nrepeat (30)\n    change [ghost v] effect by (0)\n    change x by (((0) - (x position)) / (3))\nend\n\n@Intro\n\nwhen I start as a clone\nif <(Clone) = [Particles]> then\n    switch costume to (pick random (29) to (31))\n    set size to (pick random (50) to (150)) %\n    set [ghost v] effect to (pick random (0.) to (5.))\n    set [brightness v] effect to (pick random (-25.) to (100.))\n    go to x: (0) y: (0)\n    point in direction (pick random (-180) to (180))\n    set [x v] to (pick random (10.) to (12.))\n    set [i v] to (pick random (2.) to (9.))\n    go to [front v] layer\n    show\n    repeat until <touching (_edge_ v)?>\n        move (X) steps\n        change y by (I)\n        change [i v] by (-0.4)\n        set [x v] to ((X) * (0.95))\n    end\n    delete this clone\nend\n\ndefine Particles\nset [clone v] to [Particles]\nrepeat (50)\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nif <(Clone) = [Name]> then\n    switch costume to (name v)\n    set size to (50) %\n    clear graphic effects\n    go to [front v] layer\n    go to x: (0) y: (-100)\n    point in direction (0)\n    show\n    repeat (50)\n        go to [front v] layer\n        change size by (((130) - (size)) / (8))\n        change y by (((0) - (y position)) / (8))\n        turn right (((90) - (direction)) / (8)) degrees\n    end\n    set [i v] to [-1]\n    repeat (10)\n        go to [front v] layer\n        change size by (I)\n        change [i v] by (join [-] (([abs v] of (I) ) / (2)))\n        turn right (I) degrees\n    end\n    switch costume to (logo v)\n    repeat (40)\n        go to [front v] layer\n        change size by (((130) - (size)) / (8))\n        turn right (((90) - (direction)) / (8)) degrees\n    end\n    set [i v] to [-1]\n    repeat (20)\n        go to [front v] layer\n        change size by ((I) / (3))\n        change [i v] by (join [-] (([abs v] of (I) ) / (4)))\n        turn right ((I) / (-3)) degrees\n    end\n    delete this clone\nend\n\nwhen flag clicked\nreset timer\nhide\nstart sound [Prismo - Stronger v]\nset volume to (100) %\nclear graphic effects\nset size to (100) %\npoint in direction (90)\ngo to x: (0) y: (0)\nset [clone v] to [Square]\ncreate clone of (_myself_ v)\nwait (1) seconds\nset [clone v] to [Name]\ncreate clone of (_myself_ v)\nwait (0) seconds\nrepeat (2)\n    Spiral spline explosion\n    Particles\n    Rect\n    Spiral spline explosion\nend\nCircle\nrepeat (4)\n    Spiral spline explosion\n    Particles\n    Rect\n    Spiral spline explosion\nend\nCircle\nrepeat (2)\n    Spiral spline explosion\n    Rect\n    Spiral spline explosion\nend\n\nwhen I start as a clone\nif <(Clone) = [Square]> then\n    clear graphic effects\n    show\n    set size to (0) %\n    go to x: (0) y: (300)\n    point in direction (0)\n    switch costume to (square v)\n    repeat (20)\n        change size by (((100) - (size)) / (5))\n        turn right (((90) - (direction)) / (5)) degrees\n        change y by (((0) - (y position)) / (5))\n    end\n    point in direction (90)\n    repeat (12)\n        next costume\n    end\n    repeat (20)\n        switch costume to (blank v)\n        change size by (((2000) - (size)) / (5))\n        switch costume to (square13 v)\n    end\n    wait (3) seconds\n    repeat (20)\n        switch costume to (blank v)\n        change size by (((100) - (size)) / (5))\n        switch costume to (square13 v)\n    end\n    repeat (12)\n        switch costume to ((costume [number v]) - (1))\n        change size by (-5)\n    end\n    set [i v] to [-1]\n    repeat (20)\n        change size by ((I) / (3))\n        change [i v] by (join [-] (([abs v] of (I) ) / (4)))\n        turn right ((I) / (-3)) degrees\n        change y by ((I) / (3))\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nif <(Clone) = [Bursts]> then\n    switch costume to (lineexplosion1 v)\n    clear graphic effects\n    go to [front v] layer\n    go [backward v] (1) layers\n    set [i v] to (pick random (1) to (3))\n    if <(I) = [1]> then\n        set [brightness v] effect to (100)\n    else\n        if <(I) = [2]> then\n            set [brightness v] effect to (25)\n        else\n            set [brightness v] effect to (-25)\n        end\n    end\n    show\n    set [i v] to [20]\n    Animate   x: [0] y: [0] size: [0] rotate: (pick random (-180) to (180)) speed: [1]\n    repeat (2)\n        set [i v] to ((I) * (0.9))\n        move (I) steps\n        Size: [100] speed: [5]\n    end\n    repeat (10)\n        set [i v] to ((I) * (0.9))\n        move (I) steps\n        Size: [100] speed: [5]\n        change [ghost v] effect by (10)\n        next costume\n    end\n    delete this clone\nend\n\ndefine Animate   x: (x) y: (y) size: (s) rotate: (r) speed: (s)\nchange x by (((round (x)) - (round (x position))) / (s))\nchange y by (((round (y)) - (round (y position))) / (s))\nchange size by (((round (s)) - (round (size))) / (s))\nturn right (((round (r)) - (round (direction))) / (s)) degrees\n\ndefine Spiral spline explosion\nset [clone v] to [Bursts]\nrepeat (5)\n    create clone of (_myself_ v)\nend\n\ndefine Size: (s) speed: (spd)\nchange size by (((round (s)) - (round (size))) / (spd))\n\ndefine Rect\nset [clone v] to [Rect]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nif <(Clone) = [Rect]> then\n    clear graphic effects\n    show\n    set size to (0) %\n    go to (random position v)\n    point in direction (90)\n    switch costume to (background rect v)\n    repeat until <(round (size)) = [300]>\n        change size by (((300) - (size)) / (15))\n        change [ghost v] effect by (4)\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nif <(Clone) = [Circle]> then\n    clear graphic effects\n    set [brightness v] effect to (100)\n    go to [front v] layer\n    go [backward v] (2) layers\n    show\n    set size to (0) %\n    go to x: (0) y: (0)\n    point in direction (90)\n    switch costume to (circle explosion 1 v)\n    repeat (20)\n        switch costume to (blank v)\n        change size by (((300) - (size)) / (5))\n        switch costume to (circle explosion 1 v)\n    end\n    delete this clone\nend\n\ndefine Circle\nset [clone v] to [Circle]\ncreate clone of (_myself_ v)\nwait (0.1) seconds\nset [clone v] to [Circle 2]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nif <(Clone) = [Circle 2]> then\n    clear graphic effects\n    set [brightness v] effect to (0)\n    go to [front v] layer\n    go [backward v] (1) layers\n    show\n    set size to (0) %\n    go to x: (0) y: (0)\n    point in direction (90)\n    switch costume to (circle explosion 1 v)\n    repeat (20)\n        switch costume to (blank v)\n        change size by (((300) - (size)) / (5))\n        switch costume to (circle explosion 1 v)\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nchange [color v] effect by (140)\nrepeat (10)\n    go to [front v] layer\nend\nforever\n    if <(costume [number v]) = [16]> then\n        set [color v] effect to (0)\n    end\nend\n\n@Sprite9\n\nwhen flag clicked\ngo to [back v] layer\nhide\nset [ghost v] effect to (60)\nforever\n    create clone of (_myself_ v)\n    wait (2) seconds\n    if <(level) = [10]> then\n        next costume\n        stop [this script v]\n    end\nend\n\nwhen I start as a clone\ngo to [back v] layer\ngo [forward v] (1) layers\nshow\ngo to x: (788) y: (31)\nrepeat until \n    change x by (-4)\nend\ndelete this clone\n\nwhen I receive [won v]\nstop [other scripts in sprite v]\n\n@water\n\nwhen I start as a clone\nshow\ngo to x: (50) y: (-150)\nset [ghost v] effect to (60)\ngo to [front v] layer\ngo [backward v] (10000) layers\nforever\n    set [time v] to [2]\n    switch costume to (level)\n    if <(costume [number v]) = [10]> then\n        repeat (5)\n            change y by (time)\n            switch costume to (level)\n        end\n        repeat (5)\n            change y by ((time) * (-1))\n            switch costume to (level)\n        end\n    end\nend\n\nwhen flag clicked\nrepeat (3)\n    create clone of (_myself_ v)\n    wait (1) seconds\nend\n\nwhen I receive [next v]\nnext costume\n\nwhen flag clicked\nswitch costume to (costume1 v)\nhide\n\nhide\n\nshow\ngo to [front v] layer\n\n@rain\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nshow\ngo to [front v] layer\nswitch costume to (costume2 v)\nset size to (pick random (30) to (130)) %\nset [me v] to (pick random (30) to (70))\nset [ghost v] effect to (pick random (0) to (70))\ngo to x: (pick random (-250) to (250)) y: (180)\npoint in direction (180)\nrepeat until <<touching (water v)?> or <touching (ground v)?>>\n    move ((0.5) + ((size) * (0.1))) steps\n    turn right ((1) * ([sin v] of ((1) * ((tick) + (me))) )) degrees\nend\ndelete this clone\n\nwhen flag clicked\nforever\n    if <(level) = [10]> then\n        create clone of (_myself_ v)\n    end\nend\n\n