Smooth Scrolling Platformer

Instructions: Reload the page if the body of the player doesn't load\nYELLOW IS THE END!!!\nUse Arrow keys to move, end is at the bottom\nMOBILE IS SUPPORTED!\nWorking on adding more levels\nPres space to reset the graphic effects.

@Stage\n\nwhen flag clicked\nforever\n    play sound [recording1 v] until done\nend\n\n@map\n\nwhen flag clicked\nset [level v] to [1]\nshow\npoint in direction (90)\nSet costume Size to [700]\nforever\n    Move\nend\n\ndefine Move\nset [scroll x v] to (([x position v] of [charecter v]) / (-10))\nset [scroll y v] to (([y position v] of [charecter v]) / (-10))\nchange x by (scroll x)\nchange y by (scroll y)\n\ndefine Set costume Size to (size)\ngo to [back v] layer\nswitch costume to (resize v)\nset size to (size) %\nswitch costume to (maze v)\nrepeat ((Level) - (1))\n    next costume\nend\ngo to x: (1580) y: (-900)\n\nwhen I receive [restart v]\nglide (1) secs to x: (954) y: (-1028)\nbroadcast (Done v)\nbroadcast (Done v)\nbroadcast (Done v)\nbroadcast (Done v)\nbroadcast (Done v)\nbroadcast (Done v)\n\nwhen I receive [next level v]\nSet costume Size to [900]\n\nchange [level v] by (1)\n\nwhen [space v] key pressed\nclear graphic effects\n\n@Sprite1\n\nwhen flag clicked\nset [clones v] to [0]\nforever\n    go to [back v] layer\n    hide\n    wait (pick random (1) to (5)) seconds\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\npoint in direction (pick random (1) to (360))\nshow\nchange [clones v] by (1)\nset [ghost v] effect to (50)\nset size to (pick random (1) to (100)) %\nrepeat until <(clones) = [30]>\n    move (8) steps\n    if on edge, bounce\nend\nchange [clones v] by (-1)\ndelete this clone\n\nglide (1) secs to (random position v)\n\nwhen I start as a clone\nset [size v] to (pick random (-10) to (10))\nforever\n    repeat (10)\n        change size by (size)\n    end\n    repeat (10)\n        change size by ((size) * (-1))\n    end\n    set [size v] to (pick random (-10) to (10))\nend\n\n@Sprite2\n\nwhen flag clicked\nswitch costume to (costume2 v)\nset size to (250) %\nswitch costume to (costume1 v)\nforever\n    go to (charecter v)\nend\n\n@Screen Shot 2019-05-16 at 4\n\nwhen flag clicked\nforever\n    go to x: (0) y: (0)\n    show\n    go to [front v] layer\n    set [ghost v] effect to (100)\nend\n\n@Charecter\n\nwhen flag clicked\nset size to (100) %\nset size to (20) %\nset size to (100) %\nset size to (20) %\nReset\nforever\n    Platformer Engine\nend\n\ndefine Left, Right, and Up\nswitch costume to (hitbox v)\nset [x vel v] to ((X Vel) * (0.9))\nif <<key (right arrow v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>> then\n    set [direction v] to [90]\n    change [x vel v] by (0.6)\nend\nif <<key (left arrow v) pressed?> or <<mouse down?> and <(x position) > (mouse x)>>> then\n    set [direction v] to [-90]\n    change [x vel v] by (-0.6)\nend\nif <<touching color (#000000)?> and <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n    set [y vel v] to [10]\nend\nchange y by (1)\nchange x by (X Vel)\nswitch costume to (player v)\n\ndefine Gravity and Ground Sensing\nchange [y vel v] by (-0.5)\nchange y by (Y vel)\nswitch costume to (hitbox v)\nif <touching color (#000000)?> then\n    change y by ((-1) * (Y vel))\n    set [y vel v] to [0]\nend\nif <touching color (#ffffff)?> then\n    broadcast (Restart v)\nend\nif <touching color (#ffc600)?> then\n    broadcast (Next Level v)\nend\nif <touching color (#3b508d)?> then\nchange y by (-1)\nswitch costume to (player v)\n\ndefine Wall and Slope Check\nswitch costume to (hitbox v)\nif <touching color (#000000)?> then\n    change y by (1)\n    if <touching color (#000000)?> then\n        change y by (1)\n        if <touching color (#000000)?> then\n            change y by (1)\n            if <touching color (#000000)?> then\n                change y by (1)\n                if <touching color (#000000)?> then\n                    change y by (1)\n                    if <touching color (#000000)?> then\n                        change x by ((-2) * (X Vel))\n                        set [x vel v] to ((-1) * (X Vel))\n                        change y by ((-0.2) * (Y vel))\n                        if <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> then\n                            if <touching color (#000000)?> then\n                                set [y vel v] to [-15]\n                            else\n                                set [y vel v] to [15]\n                            end\n                        else\n                            set [y vel v] to [-1]\n                        end\n                    end\n                    change y by (-2)\n                end\n            end\n        end\n    end\nend\nswitch costume to (player v)\n\n\n\ndefine Platformer Engine\nset [color v] effect to ((10) / (0))\nchange x by (scroll x)\nchange y by (scroll y)\npoint in direction (90)\nGravity and Ground Sensing\nLeft, Right, and Up\nWall and Slope Check\npoint in direction (direction)\n\ndefine Reset\nset drag mode [not draggable v]\ngo to [front v] layer\nshow\nset [direction v] to [90]\nset size to (20) %\nset rotation style [left-right v]\ngo to x: (0) y: (0)\nset [x vel v] to [0]\nset [y vel v] to [0]\nset [scroll y v] to [0]\nset [scroll x v] to [0]\ngo to x: (0) y: (0)\npoint in direction (90)\nset [x vel v] to [0]\n\nwhen I receive [restart v]\nrepeat (20)\n    change [pixelate v] effect by (50)\nend\n\nwhen I receive [done v]\nclear graphic effects\n\nrepeat (20)\n    change [pixelate v] effect by (-50)\nend\n\nwhen flag clicked\nforever\n    if <<key (right arrow v) pressed?> or <key (left arrow v) pressed?>> then\n        wait (0.1) seconds\n    end\nend\n\n