Simple Platformer engine #engine

Instructions: This is a platformer engine by me.\nThere might be many engines in scratch but this is by me.\nADD YOUR OWN MUSIC\nthis is not a game its engine :)

@Stage\n\nwhen flag clicked\nset [pitch v] effect to (0)\nset volume to (100) %\nforever\n    play sound [TownTheme v] until done\nend\n\nwhen [c v] key pressed\nif <(username) = [JustinPlayz234]> then\n    ask [] and wait\n    broadcast (set v)\nend\n\n@tn\n\nwhen flag clicked\nset [ghost v] effect to (100)\nshow\ngo to [front v] layer\n\nhide\n\n@player\n\nwhen flag clicked\nset rotation style [left-right v]\ngo to x: (-220) y: (-25)\npoint in direction (90)\nshow\nset [fails v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nforever\n    if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n        change [x v] by (0.8)\n        point in direction (90)\n    end\n    if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n        change [x v] by (-0.8)\n        point in direction (-90)\n    end\n    set [x v] to ((x) * (0.9))\n    change x by (x)\n    if <touching (levels v)?> then\n        change y by (1)\n        if <touching (levels v)?> then\n            change y by (1)\n            if <touching (levels v)?> then\n                change y by (1)\n                if <touching (levels v)?> then\n                    change y by (1)\n                    if <touching (levels v)?> then\n                        change y by (1)\n                        if <touching (levels v)?> then\n                            change x by ((x) * (-1))\n                            change y by (-5)\n                            if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n                                if <(x) > [0]> then\n                                    set [x v] to [-5]\n                                else\n                                    set [x v] to [5]\n                                end\n                                set [y v] to [10]\n                            else\n                                set [x v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change [y v] by (-1)\n    change y by (y)\n    if <touching (levels v)?> then\n        change y by ((y) * (-1))\n        set [y v] to [0]\n    end\n    change y by (-1)\n    if <touching (levels v)?> then\n        if <<key (w v) pressed?> or <key (up arrow v) pressed?>> then\n            set [y v] to [13]\n        end\n    end\n    change y by (1)\n    if <<touching (lava v)?> or <<<touching (danger 3 v)?> or <touching (spike v)?>> or <(y) < [-100]>>> then\n        broadcast (Die v)\n    end\n    if <(x position) > [235]> then\n        broadcast (Reset v)\n    end\nend\n\nwhen I receive [reset v]\nset x to (-220)\nchange y by (-180)\nup\nset [x v] to [0]\nset [y v] to [0]\n\ndefine up\nrepeat (360)\n    if <touching (levels v)?> then\n        change y by (1)\n    else\n        stop [this script v]\n    end\nend\n\nwhen [r v] key pressed\nbroadcast (Die v)\nwait until <not <key (r v) pressed?>>\n\nwhen I receive [die v]\nchange [fails v] by (1)\nset x to (-220)\nchange y by (-180)\nup\nset [x v] to [0]\nset [y v] to [0]\n\n@spike\n\nwhen flag clicked\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\n\nwhen I receive [reset v]\nnext costume\n\n@levels\n\nwhen I receive [reset v]\nnext costume\n\nwhen flag clicked\nswitch costume to (level 1 v)\n\n@lava\n\nwhen flag clicked\nswitch costume to (costume2 v)\n\nwhen I receive [reset v]\nnext costume\n\nwhen flag clicked\nforever\n    glide (1) secs to x: (-6) y: (12)\n    glide (1) secs to x: (-6) y: (4)\nend\n\n