Platformer Part-11 (Portals)

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 lava (red), crusher (grey), and spikes (grey).\nThere are 24 levels.\nEvery level is possible.\n     ✧ - - - - ✧ - - - - ✧ - - - - ✧ - - - - ✧ - - - - ✧ - - - - ✧\n                                    UPDATES\n8th June 2021 - shared\n✧ - - - - ✧ - - - - ✧ - - - - ✧ - - - - ✧ - - - - ✧ - - - - ✧

@Stage\n\nwhen flag clicked\nforever\n    if <(Level) = [1]> then\n        switch backdrop to (backdrop1 v)\n    end\n    if <(Level) = [13]> then\n        switch backdrop to (backdrop2 v)\n    end\n    if <(Level) = [16]> then\n        switch backdrop to (backdrop3 v)\n    end\n    if <(Level) = [19]> then\n        switch backdrop to (backdrop1 v)\n    end\n    if <(Level) = [23]> then\n        switch backdrop to (backdrop4 v)\n    end\n    if <(Level) = [25]> then\n        switch backdrop to (backdrop1 v)\n    end\nend\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        set [xs v] to [0]\n        set [ys v] to [0]\n        go to x: (-190) y: (20)\n    end\n    if <<<touching (spikes v)?> or <(y position) < [-178]>> or <<touching (crusher v)?> or <<touching (saws 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 (ice v)?> then\n        set [xs v] to [20]\n    end\n    if <touching (coins v)?> then\n        play sound [Wood  v] until done\n        broadcast (c v)\n    end\nend\n\nwhen I receive [start v]\nforever\n    play sound [Sunshine v] until done\nend\n\nchange [level v] by (10)\n\nset [level v] to [12]\n\n@Shine\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nshow\ngo to [back v] layer\nforever\n    go to (player v)\nend\n\n@Ground\n\nwhen I receive [start v]\ngo to x: (0) y: (0)\nshow\nswitch costume to (1 v)\ngo to [front v] layer\nforever\n    switch costume to (Level)\nend\n\nwhen flag clicked\nhide\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    go to [front v] layer\n    switch costume to (Level)\nend\n\n@Spikes\n\nwhen I receive [start v]\ngo to [back 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@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)\ngo to [back v] layer\nshow\nswitch costume to (1 v)\nforever\n    switch costume to (Level)\nend\n\nwhen flag clicked\nhide\n\n@Ice\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@Trampoline\n\nwhen I receive [start v]\ngo to [back 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@Crusher\n\nwhen I receive [start v]\ngo to [back 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\nwhen I receive [start v]\ngo to x: (0) y: (0)\nforever\n    glide (1) secs to x: (x position) y: ((y position) + (50))\n    glide (1) secs to x: (x position) y: ((y position) + (-50))\nend\n\n@Skip\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nshow\ngo to x: (190) y: (-150)\npoint in direction (90)\nforever\n    go to [front v] layer\n    if <touching (mouse-pointer v)?> then\n        switch costume to (skip2 v)\n    else\n        switch costume to (skip v)\n    end\n    if <(Level) = [24]> then\n        hide\n    end\nend\n\nwhen this sprite clicked\nchange [level v] by (1)\n\n@Intro\n\nwhen flag clicked\nset [val v] to [0]\nhide\nswitch costume to (costume1 v)\ncreate clone of (_myself_ v)\nswitch costume to (costume2 v)\ncreate clone of (_myself_ v)\n\nwhen flag clicked\nplay sound [video \(2\) v] until done\n\nwhen I start as a clone\nif <(costume [number v]) = [1]> then\n    go to x: (0) y: (200)\n    show\n    wait (6.1) seconds\n    repeat (10)\n        change [brightness v] effect by (25)\n    end\n    repeat (10)\n        change [brightness v] effect by (-10)\n    end\n    wait until <(val) = [1]>\n    repeat (5)\n        repeat (10)\n            change [brightness v] effect by (1)\n        end\n        wait (1) seconds\n        repeat (10)\n            change [brightness v] effect by (-1)\n        end\n        wait (1) seconds\n    end\nend\nif <(costume [number v]) = [2]> then\n    show\n    repeat (3)\n        wait (0.8) seconds\n        repeat (10)\n            change [ghost v] effect by (-10)\n        end\n        wait (0.2) seconds\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n    end\n    wait (1) seconds\n    repeat (10)\n        change [ghost v] effect by (-10)\n    end\n    broadcast (new v)\n    forever\n        set y to (([cos v] of ((timer) * (150)) ) * (25))\n        point in direction ((([tan v] of ((timer) * (110)) ) * (5)) + (90))\n    end\nend\n\nwhen I receive [new v]\nset [val v] to [1]\nforever\n    if <(costume [number v]) = [1]> then\n        change y by (([cos v] of ((timer) * (100)) ) * (-10))\n    end\nend\n\ndefine create motion blur\nrepeat (pick random (5) to (10))\n    stamp\n    change x by (-1)\nend\n\nwhen flag clicked\nerase all\n\nwhen flag clicked\nwait (20) seconds\nbroadcast (intro end v)\nbroadcast (Start v)\n\nwhen I receive [intro end v]\nrepeat (10)\n    change [ghost v] effect by (25)\nend\nhide\n\n@Thumbnail\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