Pixel Ninja || A Platformer

Instructions: If this is full try server 2:\nhttps://scratch.mit.edu/projects/409085782/\n\nWAD/arrow keys to move/ jump\ndon't touch lava/spikes/saws\ngo to the end, the signs will show you the way\norange is bouncy\ntry to get the highscore :)\ncan you beat my highscore, it's 65.135

@Stage\n\nwhen flag clicked\nerase all\nswitch backdrop to (fade v)\nforever\n    play sound [660775_Mountains.mp3 v] until done\nend\n\nwhen I receive [start v]\nswitch backdrop to (back v)\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 None\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\ndefine Lines\nif <(Level) = [1]> then\n    Draw ground line from (-50) (-102) to (-50) (-40) With pen size (20)\n    Draw ground line from (70) (180) to (70) (-50) With pen size (20)\nelse\n    if <(Level) = [2]> then\n        Draw ground line from (-100) (-102) to (-100) (0) With pen size (30)\n        Draw ground line from (60) (40) to (80) (40) With pen size (20)\n        Draw ground line from (40) (-60) to (80) (-60) With pen size (20)\n        Draw ground line from (160) (0) to (180) (0) With pen size (20)\n        Draw ground line from (-15) (110) to (-60) (110) With pen size (20)\n        Draw ground line from (-15) (110) to (-15) (100) With pen size (20)\n        Draw ground line from (-170) (100) to (-240) (100) With pen size (20)\n    else\n        if <(Level) = [3]> then\n            Draw ground line from (-30) (-40) to (-50) (-40) With pen size (20)\n            Draw ground line from (60) (-20) to (80) (-20) With pen size (20)\n            Draw ground line from (170) (0) to (190) (0) With pen size (20)\n            Draw ground line from (170) (120) to (190) (120) With pen size (20)\n            Draw ground line from (-80) (-95) to (-120) (-95) With pen size (20)\n            Draw ground line from (80) (100) to (60) (100) With pen size (20)\n            Draw ground line from (-30) (80) to (-50) (80) With pen size (20)\n            Draw ground line from (-220) (70) to (-180) (70) With pen size (20)\n        else\n            if <(Level) = [4]> then\n                Draw ground line from (-120) (-102) to (-120) (-60) With pen size (20)\n                Draw ground line from (-80) (-60) to (-120) (-60) With pen size (20)\n                Draw ground line from (-80) (-60) to (-80) (-20) With pen size (20)\n                Draw ground line from (-40) (-20) to (-80) (-20) With pen size (20)\n                Draw ground line from (-40) (-20) to (-40) (-110) With pen size (20)\n                Draw ground line from (160) (-40) to (15) (-40) With pen size (20)\n                Draw ground line from (15) (120) to (15) (-40) With pen size (20)\n                Draw ground line from (15) (120) to (-160) (120) With pen size (20)\n                Draw ground line from (-160) (80) to (-160) (120) With pen size (20)\n                Draw ground line from (-160) (80) to (-240) (80) With pen size (20)\n                Draw ground line from (160) (-40) to (160) (80) With pen size (20)\n                Draw ground line from (90) (180) to (90) (20) With pen size (20)\n                Draw ground line from (235) (235) to (235) (-100) With pen size (20)\n            else\n                if <(Level) = [5]> then\n                    Draw ground line from (-120) (-102) to (-120) (-60) With pen size (20)\n                    Draw ground line from (-50) (180) to (-50) (-60) With pen size (20)\n                    Draw ground line from (20) (120) to (20) (-100) With pen size (20)\n                    Draw ground line from (120) (180) to (120) (-60) With pen size (20)\n                    Draw ground line from (200) (80) to (200) (-100) With pen size (20)\n                    Draw ground line from (200) (80) to (240) (80) With pen size (20)\n                    Draw ground line from (200) (80) to (240) (80) With pen size (20)\n                    Draw ground line from (20) (120) to (60) (120) With pen size (20)\n                else\n                    if <(Level) = [6]> then\n                        Draw ground line from (-100) (-110) to (-100) (-60) With pen size (20)\n                        Draw ground line from (-70) (-60) to (-100) (-60) With pen size (20)\n                        Draw ground line from (130) (-110) to (130) (-60) With pen size (20)\n                        Draw ground line from (100) (-60) to (130) (-60) With pen size (20)\n                        Draw ground line from (190) (0) to (210) (0) With pen size (20)\n                        Draw ground line from (130) (60) to (110) (60) With pen size (20)\n                        Draw ground line from (-150) (60) to (-60) (60) With pen size (20)\n                        Draw ground line from (-150) (60) to (-150) (180) With pen size (20)\n                    else\n                        if <(Level) = [7]> then\n                            Draw ground line from (-100) (-110) to (-100) (-60) With pen size (20)\n                            Draw ground line from (0) (-60) to (-100) (-60) With pen size (20)\n                            Draw ground line from (0) (-60) to (0) (70) With pen size (20)\n                            Draw ground line from (0) (-60) to (120) (-60) With pen size (20)\n                            Draw ground line from (-240) (120) to (180) (120) With pen size (20)\n                            Draw ground line from (-240) (120) to (180) (120) With pen size (20)\n                            Draw ground line from (130) (30) to (130) (-110) With pen size (20)\n                            Draw ground line from (180) (-60) to (180) (120) With pen size (20)\n                        else\n                            if <(Level) = [8]> then\n                                Draw ground line from (-100) (-110) to (-100) (-60) With pen size (20)\n                                Draw ground line from (0) (-60) to (-100) (-60) With pen size (20)\n                                Draw ground line from (0) (-60) to (120) (-60) With pen size (20)\n                                Draw ground line from (120) (-120) to (120) (-60) With pen size (20)\n                                Draw ground line from (-240) (10) to (180) (10) With pen size (20)\n                                Draw ground line from (180) (180) to (180) (70) With pen size (20)\n                                Draw ground line from (180) (10) to (180) (-45) With pen size (20)\n                                Draw ground line from (-240) (120) to (-200) (120) With pen size (20)\n                                Draw ground line from (-125) (60) to (-100) (60) With pen size (20)\n                                Draw ground line from (50) (60) to (70) (60) With pen size (20)\n                            else\n                                switch backdrop to (back2 v)\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine None\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 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                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\ndefine None\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\nDraw ground line from (-30) (50) to (-50) (50) With pen size (20)\nDraw ground line from (60) (70) to (80) (70) With pen size (20)\n\nset pen color to (#ffffff)\nset pen size to (60)\ngo to x: (-240) y: (180)\npen down\nrepeat (5)\n    repeat (10)\n        change y by (-36)\n    end\n    change x by (60)\n    repeat (10)\n        change y by (36)\n    end\n    change x by (60)\nend\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 lava from (140) (-97) to (240) (-97) With pen size (20)\n    Draw lava from (60) (180) to (60) (50) With pen size (16)\nelse\n    if <(Level) = [2]> then\n        Draw lava from (-85) (-97) to (240) (-97) With pen size (20)\n    else\n        if <(Level) = [3]> then\n            Draw lava from (-80) (-100) to (240) (-100) With pen size (20)\n            Draw lava from (-30) (50) to (-50) (50) With pen size (20)\n            Draw lava from (60) (70) to (80) (70) With pen size (20)\n            Draw lava from (170) (90) to (190) (90) With pen size (20)\n        else\n            if <(Level) = [4]> then\n                Draw lava from (80) (240) to (80) (40) With pen size (10)\n                Draw lava from (170) (70) to (170) (-20) With pen size (10)\n                Draw lava from (-50) (130) to (-50) (130) With pen size (15)\n            else\n                if <(Level) = [5]> then\n                    Draw lava from (10) (-100) to (10) (-20) With pen size (10)\n                    Draw lava from (-40) (180) to (-40) (100) With pen size (10)\n                    Draw lava from (75) (20) to (115) (20) With pen size (15)\n                    Draw lava from (191) (77) to (191) (-110) With pen size (15)\n                else\n                    if <(Level) = [6]> then\n                        Draw lava from (10) (-100) to (10) (0) With pen size (10)\n                        Draw lava from (-91) (-97) to (120) (-97) With pen size (15)\n                    else\n                        if <(Level) = [7]> then\n                            Draw lava from (50) (115) to (50) (-20) With pen size (10)\n                            Draw lava from (-91) (-97) to (120) (-97) With pen size (15)\n                            Draw lava from (-240) (0) to (-50) (0) With pen size (15)\n                            Draw lava from (240) (-180) to (240) (0) With pen size (15)\n                            Draw lava from (190) (80) to (190) (110) With pen size (15)\n                        else\n                            if <(Level) = [8]> then\n                                Draw lava from (-91) (-97) to (120) (-97) With pen size (15)\n                                Draw lava from (-240) (0) to (-50) (0) With pen size (15)\n                                Draw lava from (-10) (-52) to (5) (-52) With pen size (15)\n                                Draw lava from (-240) (20) to (100) (20) With pen size (15)\n                                Draw lava from (100) (110) to (100) (20) With pen size (15)\n                                Draw lava from (65) (-52) to (80) (-52) With pen size (15)\n                            else\n                                if <(Level) = [7]> then\n                                    Draw lava from (50) (115) to (50) (-20) With pen size (10)\n                                    Draw lava from (-91) (-97) to (120) (-97) With pen size (15)\n                                    Draw lava from (-240) (0) to (-50) (0) With pen size (15)\n                                    Draw lava from (240) (-180) to (240) (0) With pen size (15)\n                                    Draw lava from (190) (80) to (190) (110) With pen size (15)\n                                else\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nhide variable [score v]\n\n@You\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 Respawn\nset [sx v] to [0]\nset [sy v] to [0]\nset [falling? v] to [10]\nswitch costume to (you v)\nset size to (70) %\ngo to x: (item (((Level) * (2)) - (1)) of [spawnpoints v]) y: (item ((Level) * (2)) of [spawnpoints v])\nshow\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\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\n@Thumbnail\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\nhide\n\n@Menu\n\nwhen flag clicked\nset size to (0) %\nset [y v] to [0]\nset [direction v] to [0]\ncreate clone of (_myself_ v)\nswitch costume to (title 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    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 x: (0) y: (-50)\npoint in direction (90)\nswitch costume to (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