Illusion - A Platformer

Instructions: Yeah boi!!!   #TRENDING\n\nFirst page trending on games! 31/05/20\n#12 on trending for games! I am so happy! :D 31/05/20\n- Arrow keys to move\n- Avoid lava\n- 'R' to restart the level\n- No skips or wall jump (I wanted you to have more of a challenge)\n- The cave levels are very hard, but possible; I've done them all without dying 'cos I'm a pro ;)\n- 15 levels\n- Have fun!\n\nStory: You are an explorer on a quest to find an ancient diamond. Can you survive the dangers and find the gem?\n\n\nA love, fave and follow will be really appreciated ;)\n\n\n#Games #DefenderOfTheMask #Trending

@Stage\n\n@You\n\nwhen I receive [start v]\nchange [☁ players v] by (1)\nshow\ngo to [front v] layer\nswitch backdrop to (1 v)\ngo to x: (-200) y: (0)\nset [xv v] to [0]\nset [yv v] to [0]\nforever\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        point in direction (90)\n        change [xv v] by (1)\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 (-1)\n    end\n    set [xv v] to ((Xv) * (0.9))\n    change x by (Xv)\n    if <touching (level v)?> then\n        change y by (1)\n        if <touching (level v)?> then\n            change y by (1)\n            if <touching (level v)?> then\n                change y by (1)\n                if <touching (level v)?> then\n                    change y by (1)\n                    if <touching (level v)?> then\n                        change y by (1)\n                        if <touching (level v)?> then\n                            change x by ((Xv) * (-1))\n                            change y by (-5)\n                            if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                                if <(Xv) > [0]> then\n                                    set [xv v] to [-5]\n                                else\n                                    set [xv v] to [5]\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 [yv v] by (-1)\n    change y by (Yv)\n    if <touching (level v)?> then\n        change y by ((Yv) * (-1))\n        set [yv v] to [0]\n    end\n    change y by (-1)\n    if <touching (level v)?> then\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            set [yv v] to [15]\n        end\n    end\n    change y by (1)\n    if <(x position) > [220]> then\n        set [xv v] to [0]\n        set [yv v] to [0]\n        broadcast (New v)\n        go to x: (-200) y: (0)\n    end\n    if <[-160] > (y position)> then\n        set [xv v] to [0]\n        set [yv v] to [0]\n        start sound [Crunch v]\n        repeat (20)\n            change [ghost v] effect by (5)\n            change size by (.2)\n            change [pixelate v] effect by (20)\n        end\n        set size to (15) %\n        clear graphic effects\n        go to x: (-200) y: (0)\n        go to x: (-200) y: (0)\n    end\n    if <touching (spikes v)?> then\n        set [xv v] to [0]\n        set [yv v] to [0]\n        start sound [Crunch v]\n        repeat (20)\n            change [ghost v] effect by (5)\n            change size by (.2)\n            change [pixelate v] effect by (20)\n        end\n        set size to (15) %\n        clear graphic effects\n        go to x: (-200) y: (0)\n    end\n    if <touching (bounce v)?> then\n        set [yv v] to [22]\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [end v]\nhide\nstop all sounds\nstop [other scripts in sprite v]\nif <(Time) < (☁ Record)> then\n    set [☁ record v] to (Time)\nend\n\nwhen I receive [mute v]\nset volume to (0) %\n\nwhen I receive [unmute v]\nset volume to (100) %\n\nwhen I receive [start v]\nshow variable [☁ record v]\nshow variable [time v]\nset [time v] to [0]\nforever\n    change [time v] by (0.04)\nend\n\nwhen flag clicked\nhide variable [time v]\nhide variable [☁ record v]\n\nwhen flag clicked\nwait (4) seconds\nbroadcast (Unmute v)\nforever\n    play sound [the piano moosic v] until done\nend\n\n@Intro\n\nwhen flag clicked\nstart sound [Intro v]\nshow\nswitch costume to (bbmlogo v)\nset [ghost v] effect to (0)\ngo to x: (0) y: (0)\nset size to (0) %\npoint in direction (90)\nrepeat (20)\n    change size by (5)\n    turn right (70) degrees\nend\npoint in direction (90)\nrepeat (5)\n    repeat (15)\n        change size by (.7)\n    end\n    repeat (15)\n        change size by (-.7)\n    end\nend\nwait (1) seconds\nrepeat (50)\n    change [ghost v] effect by (10)\nend\nhide\nbroadcast (Start v)\n\nwhen flag clicked\nset volume to (100) %\nwait (5) seconds\nrepeat (40)\n    change volume by (-2.5)\nend\n\n@Sprite1\n\nwhen flag clicked\nshow\n\nwhen I receive [start v]\nhide\n\n@Background\n\nwhen I receive [end v]\nhide\nstop all sounds\nstop [other scripts in sprite v]\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nshow\n\n@Level\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nswitch costume to (1 v)\nshow\ngo to [front v] layer\ngo [backward v] (1) layers\n\nwhen I receive [new v]\nif <(costume [name v]) = [10]> then\n    broadcast (end v)\nelse\n    next costume\nend\n\nwhen I receive [end v]\nhide\nstop all sounds\nstop [other scripts in sprite v]\n\n@Spikes\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nshow\nswitch costume to (1 v)\n\nwhen I receive [new v]\nnext costume\n\nwhen I receive [end v]\nhide\nstop all sounds\nstop [other scripts in sprite v]\n\n@Outro2Scratch\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [end v]\nadd (username) to [finishers v]\nwait (1.5) seconds\nforever\n    wait (pick random (.02) to (.2)) seconds\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\ngo to [front v] layer\nswitch costume to (pick random (1) to (4))\nif <(costume [number v]) = [4]> then\n    set size to (25) %\nelse\n    set size to (10) %\nend\npoint in direction (pick random (1) to (360))\ngo to x: (pick random (-240) to (240)) y: (182)\nshow\nglide (.5) secs to x: (x position) y: (-182)\nhide\ndelete this clone\n\n@OutroForScratch\n\ndefine Change Size (change) (speed)\nset [sizegoal v] to ((size) + (change))\nrepeat until <([abs v] of ((SizeGoal) - (size)) ) < [0.1]>\n    change size by (((SizeGoal) - (size)) * ((speed) / (5)))\nend\n\ndefine Glide (x) (y) (speed)\nrepeat (50)\n    change x by (((x) - (x position)) * ((speed) / (5)))\n    change y by (((y) - (y position)) * ((speed) / (5)))\nend\n\nwhen flag clicked\nset size to (100) %\nclear graphic effects\nswitch costume to (costume1 v)\nset [outro: clone id v] to [1]\ngo to x: (0) y: (0)\n\nwhen I start as a clone\nif <(Outro: Clone ID) = [1]> then\n    set size to (400) %\n    switch costume to (costume2 v)\n    go to x: (0) y: (195)\n    Glide (0) (0) (1.5)\nelse\n    if <(Outro: Clone ID) = [2]> then\n        go to [front v] layer\n        switch costume to (costume4 v)\n        repeat (20)\n            change [ghost v] effect by (5)\n        end\n        delete this clone\n    else\n        if <(Outro: Clone ID) = [3]> then\n            switch costume to (costume5 v)\n            forever\n                point in direction ((([sin v] of (rfvdcsx) ) * (7)) + (90))\n                change y by ([sin v] of (rfvdcsx) )\n                change size by ([sin v] of (rfvdcsx) )\n                change [rfvdcsx v] by (10)\n            end\n        else\n            if <(Outro: Clone ID) = [4]> then\n                switch costume to (costume6 v)\n                Change Size (900) (0.8)\n            else\n                if <(Outro: Clone ID) = [5]> then\n                    set [ghost v] effect to (100)\n                    switch costume to (costume7 v)\n                    go to [front v] layer\n                    repeat (20)\n                        change [ghost v] effect by (-5)\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I start as a clone\nif <(Outro: Clone ID) = [1]> then\n    wait until <(Outro: Clone ID) = [2]>\n    next costume\n    go to [front v] layer\n    Change Size (250) (0.5)\nend\n\nwhen I receive [end v]\nchange [☁ finishers v] by (1)\nwait (0.8) seconds\ncreate clone of (_myself_ v)\nwait (0.7) seconds\nrepeat (3)\n    change [outro: clone id v] by (1)\n    create clone of (_myself_ v)\nend\nwait (3) seconds\nset [outro: clone id v] to [5]\ncreate clone of (_myself_ v)\nwait (3) seconds\n\nwhen I receive [end v]\nwait (1.5) seconds\nforever\n    play sound [Outro v] until done\nend\n\nwhen I start as a clone\nwait (1) seconds\nforever\n    point in direction ((([sin v] of (rfvdcsx) ) * (7)) + (90))\n    change y by ([sin v] of (rfvdcsx) )\n    change size by ([sin v] of (rfvdcsx) )\n    change [rfvdcsx v] by (1)\nend\n\n@Thumbnail\n\nwhen flag clicked\ngo to [front v] layer\nset [ghost v] effect to (100)\n\n@Poot\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nforever\n    go to (you v)\n    create clone of (_myself_ v)\nend\n\nwhen I receive [end v]\nhide\nstop all sounds\nstop [other scripts in sprite v]\n\nwhen I start as a clone\nshow\nrepeat (20)\n    change [ghost v] effect by (10)\n    change size by (-3)\nend\ndelete this clone\n\n@Sprite2\n\nwhen flag clicked\nhide\n\nwhen I receive [end v]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [start v]\nshow\nforever\n    go to [front v] layer\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        if <(costume [name v]) = [0%]> then\n            switch costume to (100% v)\n            broadcast (Unmute v)\n        else\n            switch costume to (0% v)\n            broadcast (Mute v)\n        end\n        wait until <not <mouse down?>>\n    end\nend\n\n@Bounce\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nshow\nswitch costume to (1 v)\n\nwhen I receive [new v]\nnext costume\n\nwhen I receive [end v]\nhide\nstop all sounds\nstop [other scripts in sprite v]\n\n