A Platformer engine!!

Instructions: Arrow keys to move \nRemix for your own levels\n2200+ views thank you so much!!

@Stage\n\n@Player \n\nwhen flag clicked\nreset\nforever\n    physics\nend\n\ndefine physics\nif <key (right arrow v) pressed?> then\n    change [x velocity v] by (1)\nend\nif <key (left arrow v) pressed?> then\n    change [x velocity v] by (-1)\nend\nset [x velocity v] to ((X Velocity) * (0.9))\nchange x by (X Velocity)\nif <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 ((X Velocity) * (-1))\n                        change y by (-5)\n                        if <key (up arrow v) pressed?> then\n                            if <(X Velocity) > [0]> then\n                                set [x velocity v] to [-10]\n                            else\n                                set [x velocity v] to [10]\n                            end\n                            set [y velocity v] to [15]\n                        else\n                            set [x velocity v] to [0]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\nchange y by (Y Velocity)\nchange [y velocity v] by (-1)\nif <touching (level v)?> then\n    change y by ((Y Velocity) * (-1))\n    set [y velocity v] to [0]\nend\nchange y by (-2)\nif <key (up arrow v) pressed?> then\n    if <touching (level v)?> then\n        set [y velocity v] to [15]\n    end\nend\nchange y by (2)\nif <(x position) > [230]> then\n    broadcast (Next Level v)\n    reset\nend\nif <<touching (spikes v)?> or <touching (enimies v)?>> then\n    broadcast (die v)\n    spin off screen\nend\n\ndefine reset\npoint in direction (90)\ngo to [front v] layer\nset [x velocity v] to [0]\nset [y velocity v] to [0]\ngo to x: (-184) y: (-99)\ngo [backward v] (1) layers\nbroadcast (Reset v)\nbroadcast (Setup v)\n\nwhen I start as a clone\nrepeat (10)\n    change [ghost v] effect by (10)\n    change size by (-5)\nend\ndelete this clone\n\ndefine spin off screen\nset [y velocity v] to [10]\nrepeat until <(y position) < [-175]>\n    turn right (15) degrees\n    change [y velocity v] by (-1)\n    change y by (Y Velocity)\nend\nreset\n\nwhen flag clicked\nforever\n    create clone of (_myself_ v)\nend\n\nwhen I receive [deafeat v]\nset [y velocity v] to [10]\n\n@Level\n\nwhen flag clicked\nset [level v] to [1]\nswitch costume to (level 1 v)\ngo to x: (0) y: (0)\nforever\n    switch costume to (LEVEL)\n    set [level v] to (costume [number v])\nend\n\nwhen I receive [next level v]\nchange [level v] by (1)\n\n@Clouds\n\nwhen flag clicked\nhide\nforever\n    create clone of (_myself_ v)\n    wait (0.5) seconds\nend\n\nwhen I start as a clone\nset [ghost v] effect to (30)\nshow\nset y to ((round (pick random (100) to (1000))) / (10))\nif <(pick random (1) to (2)) = [1]> then\n    set x to (131)\n    repeat until <touching (_edge_ v)?>\n        change x by (-10)\n    end\nelse\n    set x to (-131)\n    repeat until <touching (_edge_ v)?>\n        change x by (10)\n    end\nend\ndelete this clone\n\n@Thumbnail\n\nwhen flag clicked\nshow\ngo to [front v] layer\nset [ghost v] effect to (100)\n\n@Spikes\n\nwhen flag clicked\ngo to [back v] layer\nforever\n    switch costume to (LEVEL)\nend\n\nwhen flag clicked\nforever\n    set y to (([sin v] of ((timer) * (400)) ) * (5))\nend\n\n@Enimies\n\nwhen flag clicked\nhide\n\ndefine clone enemy (x) (y)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\n\nwhen [space v] key pressed\nset [mouse v] to (join (mouse x) (join [,] (mouse y)))\n\nwhen I receive [setup v]\nif <(LEVEL) = [3]> then\n    clone enemy [-5] [25]\nelse\n    hide\nend\n\nwhen I start as a clone\nforever\n    show\n    if <([x position v] of [player  v]) > (x position)> then\n        change [x velocity v] by (0.5)\n    end\n    if <([x position v] of [player  v]) < (x position)> then\n        change [x velocity v] by (-0.5)\n    end\n    set [x velocity v] to ((X Velocity) * (0.9))\n    change x by (X Velocity)\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 ((X Velocity) * (-1))\n                            change y by (-5)\n                            if <not <(y position) = ([y position v] of [player  v])>> then\n                                if <(X Velocity) > [0]> then\n                                    set [x velocity v] to [-10]\n                                else\n                                    set [x velocity v] to [10]\n                                end\n                                set [y velocity v] to [15]\n                            else\n                                set [x velocity v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (Y Velocity)\n    change [y velocity v] by (-1)\n    if <touching (level v)?> then\n        change y by ((Y Velocity) * (-1))\n        set [y velocity v] to [0]\n    end\n    change y by (-1)\n    if <([y position v] of [player  v]) > (y position)> then\n        if <touching (level v)?> then\n            set [y velocity v] to [10]\n        end\n    end\n    change y by (1)\n    if <<touching (spikes v)?> or <touching (bottom sensor v)?>> then\n        broadcast (deafeat v)\n        die\n    end\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine die\nset [y velocity v] to [-10]\ngo to [back v] layer\nrepeat until <(y position) < [-175]>\n    change [y velocity v] by (-0.05)\n    change y by (Y Velocity)\nend\ndelete this clone\n\n@Bottom sensor\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    go to (player  v)\n    change y by (10)\nend\n\nwhen I receive [die v]\nhide\n\nwhen I receive [reset v]\nshow\n\n