Pen platformer #p2 

Instructions: -Press arrow keys to move\n-Only for PC\n-Red is dangerous\n-Go to the purple place to pass the levels\n------------\nHow much have you played through the level, please comment below and don't forget to give me an extra star or heart and moreover give me a follow so that I have the motivation to do more of the Platformer project. Sincere thanks. I wish you have fun! Bye! :)

@Stage\n\n@StartMenu\n\ndefine Hide all variable\nhide variable [direction v]\nhide variable [elevator v]\nhide variable [falling? v]\nhide variable [jump key v]\nhide variable [level v]\nhide variable [level v]\nhide variable [score v]\nhide variable [slope v]\nhide variable [sx v]\nhide variable [sy v]\nhide variable [tick v]\nhide variable [x v]\nhide variable [y v]\n\nwhen flag clicked\nHide all variable\nset size to (0) %\nset [y v] to [0]\nset [direction v] to [0]\ncreate clone of (_myself_ v)\nswitch costume to (ads v)\nrepeat (15)\n    change size by (((100) - (size)) / (6))\n    point in direction ((90) + (([sin v] of (Direction) ) * (7)))\n    set y to ((40) + (([sin v] of (Y) ) * (7)))\n    change [y v] by (8)\n    change [direction v] by (4)\nend\nforever\n    change [color v] effect by (5)\n    point in direction ((90) + (([sin v] of (Direction) ) * (7)))\n    set y to ((40) + (([sin v] of (Y) ) * (7)))\n    change [y v] by (8)\n    change [direction v] by (4)\nend\n\nwhen I start as a clone\ngo to [front v] layer\ngo to x: (0) y: (-50)\npoint in direction (90)\nswitch costume to (start button v)\nforever\n    set y to ((-40) + (([sin v] of (Y) ) * (7)))\n    point in direction ((90) + (([sin v] of (Direction) ) * (7)))\n    change [direction v] by (6)\n    if <touching (mouse-pointer v)?> then\n        change size by (((120) - (size)) / (6))\n        if <mouse down?> then\n            reset timer\n            broadcast (vanish v)\n        end\n    else\n        change size by (((100) - (size)) / (6))\n    end\nend\n\nwhen I receive [vanish v]\nstop [other scripts in sprite v]\nrepeat (15)\n    change size by (((0) - (size)) / (6))\n    change [ghost v] effect by (7)\nend\nif <(costume [number v]) = [1]> then\n    set size to (100) %\n    switch costume to (fade v)\n    set [ghost v] effect to (0)\n    point in direction (90)\n    go to x: (0) y: (0)\n    broadcast (start v)\n    wait (0.2) seconds\n    repeat (10)\n        change [ghost v] effect by (10)\n    end\nend\n\n@pen\n\ndefine LevelRender\nDanger\nLines\nLevel End\ngo to x: (-240) y: (-140)\nset pen color to (#c88330)\nset pen size to (80)\npen down\ngo to x: (240) y: (-140)\nchange pen shade by (-5)\nset pen size to (15)\npen up\nset [x v] to [-240]\nrepeat (10)\n    pen up\n    go to x: (X) y: (-180)\n    pen down\n    go to x: ((X) + (40)) y: (-110)\n    change [x v] by (50)\nend\npen up\nset pen color to (#5cb712)\nset pen shade to (20)\ngo to x: (-240) y: (-105)\npen down\ngo to x: (240) y: (-105)\npen up\ngo to x: (240) y: (-102)\nset pen size to (10)\nchange pen shade by (15)\npen down\ngo to x: (-240) y: (-102)\npen up\n\ndefine Level End\nif <(Level) = [1]> then\n    End Dot X (105) Y (155)\nelse\n    if <(Level) = [2]> then\n        End Dot X (-220) Y (150)\n    else\n        if <(Level) = [3]> then\n            End Dot X (-210) Y (120)\n        else\n            if <(Level) = [4]> then\n                End Dot X (-210) Y (120)\n            else\n                if <(Level) = [5]> then\n                    End Dot X (220) Y (120)\n                else\n                    if <(Level) = [6]> then\n                        End Dot X (-110) Y (150)\n                    else\n                        if <(Level) = [7]> then\n                            End Dot X (-210) Y (155)\n                        else\n                            if <(Level) = [8]> then\n                                End Dot X (-210) Y (-69)\n                            else\n                                broadcast (end v)\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine Draw lava from x, y (x) (y) to (x2) (y2) With pen size (pensize)\nset pen color to (#ff0000)\nset pen shade to (50)\npen up\nset pen size to (pensize)\ngo to x: (x) y: (y)\npen down\ngo to x: (x2) y: (y2)\npen up\n\ndefine End Dot X (x) Y (y)\nset pen color to (#632d99)\nset pen shade to (50)\npen up\nset pen size to (30)\ngo to x: (x) y: (y)\npen down\npen up\n\ndefine Draw ground line from || x, y (x) (y) to (x2) (y2) With pen size (pensize)\nset pen color to (#5cb712)\nset pen shade to (35)\npen up\nset pen size to (pensize)\ngo to x: (x) y: (y)\npen down\ngo to x: (x2) y: (y2)\npen up\n\nwhen I receive [start v]\nforever\n    erase all\n    LevelRender\n    if <(Level) = [9]> then\n        show variable [score v]\n        set [score v] to (round (timer))\n        stop [other scripts in sprite v]\n        stop [this script v]\n    end\nend\n\ndefine Danger\nif <(Level) = [1]> then\n    Draw ground line from || x, y [-90] [-60] to [-150] [-60] With pen size [20]\n    Draw ground line from || x, y [-40] [0] to [30] [0] With pen size [20]\n    Draw ground line from || x, y [140] [75] to [70] [75] With pen size [20]\nelse\n    if <(Level) = [2]> then\n        Draw lava from x, y [240] [-95] to [-100] [-95] With pen size [20]\n        Draw ground line from || x, y [-220] [70] to [-180] [70] With pen size [20]\n        Draw ground line from || x, y [-240] [-180] to [240] [180] With pen size [20]\n        Draw ground line from || x, y [-10] [90] to [-50] [90] With pen size [20]\n        Draw ground line from || x, y [-100] [90] to [-140] [80] With pen size [20]\n    else\n        if <(Level) = [3]> then\n            Draw ground line from || x, y [-240] [-30] to [-100] [-30] With pen size [20]\n            Draw lava from x, y [-100] [-70] to [-100] [-15] With pen size [20]\n            Draw ground line from || x, y [-100] [-70] to [70] [-70] With pen size [20]\n            Draw ground line from || x, y [75] [-70] to [75] [70] With pen size [20]\n            Draw ground line from || x, y [150] [-79] to [150] [100] With pen size [20]\n            Draw ground line from || x, y [250] [100] to [150] [100] With pen size [20]\n            Draw lava from x, y [250] [100] to [240] [180] With pen size [20]\n            Draw ground line from || x, y [-100] [100] to [-10] [100] With pen size [20]\n            Draw ground line from || x, y [-230] [100] to [-180] [100] With pen size [20]\n            Draw lava from x, y [-240] [-100] to [240] [-100] With pen size [20]\n        else\n            if <(Level) = [4]> then\n                Draw ground line from || x, y [-135] [-160] to [-135] [-40] With pen size [20]\n                Draw ground line from || x, y [-135] [90] to [-135] [40] With pen size [20]\n                Draw ground line from || x, y [-20] [-160] to [-20] [-40] With pen size [20]\n                Draw ground line from || x, y [-20] [90] to [-20] [40] With pen size [20]\n                Draw ground line from || x, y [95] [-160] to [95] [-40] With pen size [20]\n                Draw ground line from || x, y [95] [90] to [95] [40] With pen size [20]\n                Draw ground line from || x, y [110] [90] to [79] [90] With pen size [20]\n                Draw ground line from || x, y [-5] [90] to [-35] [90] With pen size [20]\n                Draw ground line from || x, y [-120] [90] to [-150] [90] With pen size [20]\n                Draw ground line from || x, y [190] [100] to [190] [-100] With pen size [20]\n                Draw ground line from || x, y [190] [100] to [240] [100] With pen size [20]\n                Draw lava from x, y [240] [180] to [240] [-180] With pen size [20]\n                Draw lava from x, y [290] [-100] to [-130] [-100] With pen size [20]\n                Draw lava from x, y [-240] [-180] to [-240] [180] With pen size [20]\n            else\n                if <(Level) = [5]> then\n                    Draw ground line from || x, y [-170] [-180] to [-170] [90] With pen size [20]\n                    Draw ground line from || x, y [-170] [30] to [-100] [30] With pen size [20]\n                    Draw lava from x, y [-130] [30] to [-120] [30] With pen size [20]\n                    Draw ground line from || x, y [0] [180] to [] [-50] With pen size [20]\n                    Draw lava from x, y [-30] [-50] to [] [-50] With pen size [20]\n                    Draw ground line from || x, y [80] [-180] to [80] [90] With pen size [20]\n                    Draw ground line from || x, y [80] [90] to [60] [90] With pen size [20]\n                    Draw lava from x, y [70] [75] to [70] [60] With pen size [20]\n                    Draw ground line from || x, y [170] [-180] to [170] [90] With pen size [20]\n                    Draw lava from x, y [125] [90] to [125] [] With pen size [20]\n                    Draw ground line from || x, y [170] [] to [90] [] With pen size [20]\n                    Draw ground line from || x, y [170] [90] to [900] [90] With pen size [20]\n                else\n                    if <(Level) = [6]> then\n                        Draw lava from x, y [-240] [180] to [-240] [-180] With pen size [20]\n                        Draw ground line from || x, y [-160] [180] to [-160] [-40] With pen size [20]\n                        Draw ground line from || x, y [-160] [-40] to [180] [-40] With pen size [20]\n                        Draw lava from x, y [-160] [-40] to [-170] [-40] With pen size [20]\n                        Draw ground line from || x, y [240] [] to [-110] [] With pen size [20]\n                        Draw ground line from || x, y [190] [50] to [-150] [50] With pen size [20]\n                        Draw ground line from || x, y [240] [90] to [-110] [90] With pen size [20]\n                        Draw ground line from || x, y [-150] [130] to [200] [130] With pen size [20]\n                    else\n                        if <(Level) = [7]> then\n                            Draw ground line from || x, y [-180] [130] to [-240] [130] With pen size [10]\n                            Draw ground line from || x, y [100] [70] to [-240] [70] With pen size [10]\n                            Draw ground line from || x, y [-140] [-10] to [-100] [-10] With pen size [10]\n                            Draw ground line from || x, y [0] [-180] to [] [-10] With pen size [10]\n                            Draw ground line from || x, y [70] [-10] to [] [-10] With pen size [10]\n                            Draw ground line from || x, y [150] [-10] to [240] [-10] With pen size [10]\n                            Draw lava from x, y [-135] [-100] to [1240] [-100] With pen size [20]\n                            Draw ground line from || x, y [-140] [-180] to [-140] [-10] With pen size [10]\n                            Draw ground line from || x, y [100] [70] to [180] [120] With pen size [10]\n                            Draw ground line from || x, y [0] [111] to [] [70] With pen size [10]\n                            Draw ground line from || x, y [-86] [100] to [-130] [100] With pen size [10]\n                            Draw ground line from || x, y [-180] [130] to [-130] [100] With pen size [10]\n                            Draw lava from x, y [-80] [100] to [-80] [70] With pen size [10]\n                        else\n                            if <(Level) = [8]> then\n                                Draw ground line from || x, y [-240] [-50] to [-170] [-50] With pen size [10]\n                                Draw ground line from || x, y [-170] [-50] to [-170] [13] With pen size [10]\n                                Draw ground line from || x, y [-170] [180] to [-170] [90] With pen size [10]\n                                Draw ground line from || x, y [-170] [90] to [180] [90] With pen size [10]\n                                Draw ground line from || x, y [-170] [13] to [180] [13] With pen size [10]\n                                Draw lava from x, y [-90] [13] to [-76] [13] With pen size [10]\n                                Draw lava from x, y [-82.5] [25] to [-82.5] [15] With pen size [10]\n                                Draw lava from x, y [-5] [90] to [-20] [90] With pen size [10]\n                                Draw lava from x, y [-11] [90] to [-11] [80] With pen size [10]\n                                Draw lava from x, y [85] [13] to [70] [13] With pen size [10]\n                                Draw lava from x, y [78] [25] to [78] [13] With pen size [10]\n                                Draw lava from x, y [160] [90] to [180] [90] With pen size [10]\n                                Draw lava from x, y [170] [90] to [170] [80] With pen size [10]\n                                Draw lava from x, y [240] [-180] to [240] [180] With pen size [20]\n                                Draw ground line from || x, y [-80] [-50] to [80] [-50] With pen size [10]\n                                Draw ground line from || x, y [-80] [-50] to [-80] [-180] With pen size [10]\n                                Draw ground line from || x, y [80] [-50] to [80] [-180] With pen size [10]\n                                Draw lava from x, y [30] [-48] to [50] [-48] With pen size [15]\n                                Draw lava from x, y [-50] [-48] to [-30] [-48] With pen size [15]\n                            else\n                                broadcast (end v)\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nerase all\n\ndefine Danger\n\n@Thumbnail\n\nwhen flag clicked\nswitch costume to (thumbnail v)\ngo to x: (0) y: (0)\npoint in direction (90)\ngo to [front v] layer\nshow\nset [ghost v] effect to (100)\n\nwhen I receive [end v]\nset [ghost v] effect to (0)\nswitch costume to (costume1 v)\nforever\n    point in direction ((((90) + ([cos v] of ((timer) * (150)) )) * (15)) + (180))\nend\n\n@player\n\ndefine Respawn\nset [sx v] to [0]\nset [sy v] to [0]\nset [falling? v] to [10]\nswitch costume to (you v)\nset size to (50) %\ngo to x: (-190) y: (-40)\nshow\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nbroadcast (levelchange v)\nset [level v] to [1]\nRespawn\nwait (0.4) seconds\nforever\n    change [sy v] by (-1.5)\n    change y by (SY)\n    Touch Ground <(SY) > [0]>\n    set [sx v] to ((SX) * (0.8))\n    if <key (left arrow v) pressed?> then\n        change [sx v] by (-1.5)\n    end\n    if <key (right arrow v) pressed?> then\n        change [sx v] by (1.5)\n    end\n    if <not <(SX) = [0]>> then\n        Walk (SX) Wall Jump (10) (11)\n    end\n    if <key (up arrow v) pressed?> then\n        if <<(Jump Key) = [0]> and <(Falling?) < [3]>> then\n            set [sy v] to [14]\n            set [falling? v] to [6]\n        end\n    else\n        set [jump key v] to [0]\n    end\n    if <<(y position) < [-180]> or <touching color (#ff0000)?>> then\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n        set [ghost v] effect to (0)\n        Respawn\n    end\n    if <touching color (#7f00ff)?> then\n        change [level v] by (1)\n        broadcast (levelchange v)\n        Respawn\n    end\nend\n\ndefine Walk (speed) Wall Jump (x) (y)\nchange x by (speed)\nset [slope v] to [0]\nrepeat until <<(Slope) = [8]> or <not <<touching color (#55bf00)?> or <touching (_edge_ v)?>>>>\n    change y by (1)\n    change [slope v] by (1)\nend\nif <(Slope) = [8]> then\n    change y by ((0) - (Slope))\n    if <key (up arrow v) pressed?> then\n        if <<key (right arrow v) pressed?> or <key (left arrow v) pressed?>> then\n            if <(speed) < [0]> then\n                set [sx v] to (x)\n            else\n                set [sx v] to ((0) - (x))\n            end\n            set [sy v] to (y)\n        end\n    end\n    repeat until <not <<touching color (#55bf00)?> or <touching (_edge_ v)?>>>\n        if <(speed) > [0]> then\n            change x by (-1)\n        else\n            change x by (1)\n        end\n    end\nend\n\ndefine Touch Ground <up?>\nchange [falling? v] by (1)\nrepeat until <not <<touching color (#55bf00)?> or <touching (_edge_ v)?>>>\n    if <up?> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [falling? v] to [0]\n    end\n    set [sy v] to [0]\nend\n\ndefine Draw lava from (x) (y) to (x2) (y2) With pen size (pensize)\nset pen color to (#ff0000)\nset pen shade to (50)\npen up\nset pen size to (pensize)\ngo to x: (x) y: (y)\npen down\ngo to x: (x2) y: (y2)\npen up\n\n@music\n\nwhen I receive [levelchange v]\n\nwhen I receive [start v]\n\nstart sound [y2mate v]\n\n