Platformer Part-10 (Forest)

Instructions: ╔∘ ★ ∘══════╗\n::PLATFORMER::\n╚══════∘ ★ ∘╝\n@jindalsargun\nLove, fav, remix, and follow! \nPart-01 - https://scratch.mit.edu/projects/511930996/\nPart-02 - https://scratch.mit.edu/projects/520595337/\nPart-03 - https://scratch.mit.edu/projects/524135352/\nPart-04 - https://scratch.mit.edu/projects/526959655/\nPart-05 - https://scratch.mit.edu/projects/528697474/\nPart-06 - https://scratch.mit.edu/projects/529835140/\nPart-07 - https://scratch.mit.edu/projects/530465929/\nPart-08 - https://scratch.mit.edu/projects/532679243/\nPart-09 - https://scratch.mit.edu/projects/535570060/\nPart-10 - https://scratch.mit.edu/projects/538021056/\nPart-11 - https://scratch.mit.edu/projects/540774309/\nPart-12 - https://scratch.mit.edu/projects/542317456/\n     ✧ - - - - ✧ - - - - ✧ - - - - ✧ - - - - ✧ - - - - ✧ - - - - ✧\n                               INSTRUCTIONS\nPress WASD or arrow buttons to move.\nAvoid spikes (grey), lava (red), arrows kinda things (red), saws (grey), and enemies (red).\nYou can swim in water (blue).\nTrampolines (black) make you jump higher.\nThere are 10 levels.\nEvery level is possible.\n     ✧ - - - - ✧ - - - - ✧ - - - - ✧ - - - - ✧ - - - - ✧ - - - - ✧\n                                    UPDATES\n1st June 2021 - shared\n     ✧ - - - - ✧ - - - - ✧ - - - - ✧ - - - - ✧ - - - - ✧ - - - - ✧

@Stage\n\n@Player\n\nwhen flag clicked\nset [level v] to [1]\ngo to [front v] layer\nhide\n\nwhen I receive [start v]\nshow\nset [signal v] to [disactivated]\npoint in direction (90)\ngo to x: (-190) y: (20)\nset [xs v] to [0]\nset [ys v] to [0]\nforever\n    if <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>>> then\n        change [xs v] by (1.5)\n        switch costume to (right v)\n    end\n    if <<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>>> then\n        change [xs v] by (-1.5)\n        switch costume to (left v)\n    end\n    if <<<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>>> and <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>>> then\n        switch costume to (upright v)\n    end\n    if <<<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>>> and <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>>> then\n        switch costume to (upleft v)\n    end\n    if <not <<key (right arrow v) pressed?> or <<key (left arrow v) pressed?> or <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<key (a v) pressed?> or <<key (d v) pressed?> or <<<mouse down?> and <(mouse x) > (x position)>> or <<mouse down?> and <(mouse x) < (x position)>>>>>>>>>> then\n        switch costume to (normal v)\n    end\n    if <<key (down arrow v) pressed?> or <<key (s v) pressed?> or <<mouse down?> and <(mouse y) < (y position)>>>> then\n        switch costume to (down v)\n    end\n    change x by (Xs)\n    if <touching (ground v)?> then\n        change x by ((Xs) * (-1))\n        if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n            if <(Xs) > [0]> then\n                set [xs v] to [-15]\n                set [ys v] to [10]\n            else\n                set [xs v] to [15]\n                set [ys v] to [10]\n            end\n        else\n            set [xs v] to [0]\n        end\n    else\n        set [xs v] to ((Xs) * (0.8))\n    end\n    change y by (Ys)\n    if <touching (ground v)?> then\n        change y by ((Ys) * (-1))\n        set [ys v] to [0]\n        if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n            switch costume to (player - up v)\n            if <(Jumping) = [yes]> then\n                set [ys v] to [12]\n                set [jumping v] to [no]\n            end\n        end\n    else\n        change [ys v] by (-1)\n        set [jumping v] to [yes]\n    end\n    if <(x position) > [239]> then\n        change [level v] by (1)\n        go to x: (-190) y: (20)\n        set [xs v] to [0]\n        set [ys v] to [0]\n    end\n    if <<<touching (spikes v)?> or <(y position) < [-178]>> or <<touching (arrow v)?> or <<touching (saws v)?> or <<touching (enemy v)?> or <touching (lava v)?>>>>> then\n        go to x: (-190) y: (50)\n        set [xs v] to [0]\n        set [ys v] to [0]\n    end\n    if <touching (trampoline v)?> then\n        set [ys v] to [20]\n    end\n    if <touching (water v)?> then\n        set [ys v] to [-1]\n        if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> then\n            set [ys v] to [5]\n        end\n        if <<<key (down arrow v) pressed?> or <key (s v) pressed?>> or <<mouse down?> and <(y position) > (mouse y)>>> then\n            set [ys v] to [-5]\n        end\n    end\n    if <touching (speed ups v)?> then\n        set [xs v] to [20]\n    end\nend\n\nwhen I receive [start v]\nforever\n    play sound [Waterflame - Jumper.mp3 v] until done\nend\n\nset [level v] to [8]\n\nwhen flag clicked\nwait (10) seconds\nbroadcast (Start v)\n\n@Ground\n\nwhen I receive [start v]\ngo to x: (0) y: (0)\nshow\nswitch costume to (1 v)\nforever\n    go to [front v] layer\n    switch costume to (Level)\nend\n\nwhen flag clicked\nhide\n\nset [level v] to [8]\n\n@Text\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\ngo to x: (0) y: (0)\nshow\nswitch costume to (1 v)\nforever\n    switch costume to (Level)\nend\n\n@Spikes\n\nwhen I receive [start v]\ngo to [front v] layer\ngo to x: (0) y: (0)\nshow\nswitch costume to (1 v)\nforever\n    switch costume to (Level)\nend\n\nwhen flag clicked\nhide\n\n@Arrow\n\nwhen I receive [start v]\ngo to x: (0) y: (0)\nshow\nswitch costume to (1 v)\nforever\n    switch costume to (Level)\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nforever\n    glide (1) secs to x: (0) y: ((y position) + (50))\n    glide (1) secs to x: (0) y: ((y position) + (-50))\nend\n\nchange [level v] by (1)\n\n@Saws\n\nwhen I receive [start v]\nswitch costume to (1 v)\nshow\ngo to x: (133) y: (-108)\ngo to [front v] layer\nforever\n    switch costume to (Level)\n    turn right (5) degrees\nend\n\nwhen flag clicked\nhide\n\nwhen flag clicked\nforever\n    if <(Level) = [2]> then\n        go to x: (-119) y: (-85)\n    end\n    if <(Level) = [5]> then\n        go to x: (90) y: (-180)\n    end\n    if <(Level) = [9]> then\n        go to x: (-10) y: (-110)\n    end\nend\n\n@Lava\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    repeat (30)\n        change y by (-0.4)\n    end\n    repeat (30)\n        change y by (0.4)\n    end\nend\n\nwhen I receive [start v]\ngo to x: (0) y: (0)\nshow\nswitch costume to (1 v)\nforever\n    switch costume to (Level)\nend\n\nwhen flag clicked\nhide\n\n@Enemy\n\nwhen flag clicked\nset [level v] to [1]\nhide\n\nwhen flag clicked\nforever\n    if <(Level) = [2]> then\n        switch costume to (forward v)\n        show\n        go to x: (127) y: (-73)\n        glide (1) secs to x: (214) y: (-73)\n        switch costume to (backward v)\n        glide (1) secs to x: (127) y: (-73)\n    end\nend\n\nset [level v] to [9]\n\nwhen flag clicked\nforever\n    if <(Level) = [3]> then\n        hide\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [7]> then\n        switch costume to (forward v)\n        show\n        go to x: (70) y: (-73)\n        glide (1) secs to x: (214) y: (-73)\n        switch costume to (backward v)\n        glide (1) secs to x: (70) y: (-73)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [8]> then\n        hide\n    end\nend\n\nshow\n\nwhen flag clicked\nforever\n    if <(Level) = [10]> then\n        switch costume to (forward v)\n        show\n        go to x: (-217) y: (142)\n        glide (1) secs to x: (-94) y: (142)\n        switch costume to (backward v)\n        glide (1) secs to x: (-217) y: (142)\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [1]> then\n        hide\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [4]> then\n        hide\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [5]> then\n        hide\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [6]> then\n        hide\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [9]> then\n        hide\n    end\nend\n\n@Trampoline\n\nwhen I receive [start v]\ngo to [front v] layer\ngo to x: (0) y: (0)\nshow\nswitch costume to (1 v)\nforever\n    switch costume to (Level)\nend\n\nwhen flag clicked\nhide\n\n@Speed Ups\n\nwhen I receive [start v]\ngo to [front v] layer\ngo to x: (0) y: (0)\nshow\nswitch costume to (1 v)\nforever\n    switch costume to (Level)\nend\n\nwhen flag clicked\nhide\n\n@Water\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\ngo to x: (0) y: (0)\nshow\nswitch costume to (1 v)\nforever\n    switch costume to (Level)\nend\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    repeat (30)\n        change y by (-0.4)\n    end\n    repeat (30)\n        change y by (0.4)\n    end\nend\n\n@Trees\n\nwhen I receive [start v]\ngo to x: (0) y: (0)\nshow\nswitch costume to (1 v)\ngo to [back v] layer\nforever\n    switch costume to (Level)\nend\n\nwhen flag clicked\nhide\n\n@Clouds\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\ngo to x: (270) y: (135)\nshow\nglide (4) secs to x: (-300) y: (135)\ndelete this clone\n\nwhen I receive [start v]\nset [ghost v] effect to (25)\nforever\n    go to [back v] layer\n    switch costume to (pick random (1) to (2))\n    create clone of (_myself_ v)\n    wait (pick random (2) to (5)) seconds\nend\n\n@Intro\n\nwhen flag clicked\nhide\nset size to (100) %\ngo to x: (0) y: (0)\npoint in direction (90)\nstart sound [Liu - Groove v]\nset [clone id v] to [background]\ncreate clone of (_myself_ v)\nset [clone id v] to [screen]\ncreate clone of (_myself_ v)\nset [clone id v] to [name]\ncreate clone of (_myself_ v)\nset [clone id v] to [back arrows]\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nif <(clone id) = [background]> then\n    show\n    switch costume to (background v)\n    go to [back v] layer\n    set size to (100) %\nend\n\nwhen I start as a clone\nif <(clone id) = [screen]> then\n    show\n    switch costume to (size hack v)\n    set size to (200) %\n    switch costume to (screen v)\n    go to [front v] layer\n    wait (0.3) seconds\n    go to x: (0) y: (0)\n    repeat (12)\n        switch costume to (size hack v)\n        change size by (((100) - (size)) / (3))\n        switch costume to (screen v)\n    end\n    forever\n        set [whirl v] effect to ((shake) * (9))\n    end\nend\n\nwhen I start as a clone\nif <(clone id) = [name]> then\n    point in direction (90)\n    set [shake v] to [0]\n    set [count v] to [0]\n    set [end? v] to [0]\n    show\n    switch costume to (name v)\n    set size to (9) %\n    repeat (10)\n        change size by (((100) - (size)) / (3))\n    end\n    wait (1.7) seconds\n    shake\n    wait (0.2) seconds\n    shake\n    wait (0.2) seconds\n    shake\n    wait (0.2) seconds\n    shake\n    wait (0.1) seconds\n    shake\n    wait (0.45) seconds\n    shake\n    wait (0.03) seconds\n    shake\n    wait (0.03) seconds\n    shake\n    wait (0.03) seconds\n    shake\n    wait (0.03) seconds\n    shake\n    wait (0.03) seconds\n    shake\n    wait (0.03) seconds\n    shake\n    shake\n    wait (0.1) seconds\n    shake\n    wait (0.2) seconds\n    shake\n    wait (0.2) seconds\n    shake\n    wait (0.3) seconds\n    shake\n    wait (0.2) seconds\n    shake\n    wait (0.4) seconds\n    shake\n    set [clone id v] to [end]\n    create clone of (_myself_ v)\n    wait (0.1) seconds\n    shake\n    wait (0.03) seconds\n    shake\n    wait (0.03) seconds\n    shake\n    wait (0.03) seconds\n    shake\n    wait (0) seconds\n    shake\nend\n\ndefine shake\nline explosion\nshockwave\nchange [count v] by (1)\nset [clone id v] to [white]\ncreate clone of (_myself_ v)\nset [clone id v] to [arrow]\ncreate clone of (_myself_ v)\nset [clone id v] to [arrow2]\ncreate clone of (_myself_ v)\nset size to (180) %\nif <((count) mod (2)) = [0]> then\n    point in direction (75)\n    set [shake v] to [10]\n    repeat (5)\n        go to x: (pick random (() - (shake)) to (shake)) y: (pick random (() - (shake)) to (shake))\n        change [shake v] by (-2)\n        change size by (((100) - (size)) / (3))\n    end\nelse\n    point in direction (105)\n    set [shake v] to [-10]\n    repeat (5)\n        go to x: (pick random (() - (shake)) to (shake)) y: (pick random (() - (shake)) to (shake))\n        change [shake v] by (2)\n        change size by (((100) - (size)) / (3))\n    end\nend\ngo to x: (0) y: (0)\nset size to (100) %\n\nwhen I start as a clone\nif <(clone id) = [white]> then\n    if <(end?) = [0]> then\n        show\n        switch costume to (white v)\n        point in direction (90)\n        set size to (100) %\n        go to [front v] layer\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nif <(clone id) = [end]> then\n    set [end? v] to [1]\n    show\n    point in direction (90)\n    switch costume to (size hack v)\n    set size to (1000) %\n    switch costume to (end v)\n    repeat until <(size) < [120]>\n        go to [front v] layer\n        switch costume to (size hack v)\n        change size by ((() - (size)) / (9))\n        switch costume to (end v)\n    end\n    switch costume to (size hack v)\n    set size to (600) %\n    switch costume to (end2 v)\n    set [end? v] to [2]\n    repeat until <(size) < [120]>\n        go to [front v] layer\n        switch costume to (size hack v)\n        change size by ((() - (size)) / (9))\n        switch costume to (end2 v)\n    end\n    switch costume to (end3 v)\n    wait (1) seconds\n    broadcast (end v)\nend\n\nwhen I receive [end v]\ndelete this clone\n\nwhen I start as a clone\nif <(clone id) = [arrow]> then\n    show\n    go to x: (81) y: (0)\n    point in direction (90)\n    switch costume to (arrow v)\n    set size to (100) %\n    repeat (30)\n        change x by (((-500) - (x position)) / (9))\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nif <(clone id) = [arrow2]> then\n    show\n    go to x: (-81) y: (0)\n    point in direction (90)\n    switch costume to (arrow2 v)\n    set size to (100) %\n    repeat (30)\n        change x by (((500) - (x position)) / (9))\n    end\n    delete this clone\nend\n\nwhen I start as a clone\nif <(clone id) = [back arrows]> then\n    show\n    switch costume to (size hack v)\n    set size to (120) %\n    switch costume to (back arrows v)\n    set [ghost v] effect to (50)\n    go to [back v] layer\n    go [forward v] (1) layers\n    go to x: (9) y: (0)\n    forever\n        change y by (9)\n    end\nend\n\ndefine line explosion\nset [clone id v] to [line explosion]\npoint in direction (90)\nrepeat (8)\n    create clone of (_myself_ v)\n    turn right (45) degrees\nend\n\nwhen I start as a clone\nif <(clone id) = [line explosion]> then\n    show\n    set size to (100) %\n    go to x: (0) y: (0)\n    switch costume to (line v)\n    repeat (10)\n        move (27) steps\n    end\n    delete this clone\nend\n\nrepeat (30)\n    change x by (((500) - (x position)) / (9))\nend\ndelete this clone\n\nwhen I start as a clone\nif <(clone id) = [shockwave]> then\n    show\n    set size to (81) %\n    clear graphic effects\n    switch costume to (shockwave v)\n    set [fisheye v] effect to (-50)\n    set [ghost v] effect to (10)\n    repeat (9)\n        change [fisheye v] effect by (20)\n        change [ghost v] effect by (10)\n    end\n    delete this clone\nend\n\ndefine shockwave\nset [clone id v] to [shockwave]\ngo to x: (-127) y: (81)\ncreate clone of (_myself_ v)\ngo to x: (127) y: (81)\ncreate clone of (_myself_ v)\ngo to x: (-127) y: (-81)\ncreate clone of (_myself_ v)\ngo to x: (127) y: (-81)\ncreate clone of (_myself_ v)\ngo to x: (0) y: (0)\n\n@Tn\n\nwhen flag clicked\nshow\nset [ghost v] effect to (100)\ngo to [front v] layer\ngo to x: (0) y: (0)\nset volume to (100) %\n\n