99% Pen Scrolling Platformer (Mobile)

Instructions: Arrow / WASD / Mobile (I doubt someone could do it, but I added it) \nCheck out: https://scratch.mit.edu/projects/427343175\nMy friend made it :)

@Stage\n\n@Thumbnail\n\nwhen flag clicked\nhide\nset [ghost v] effect to (100)\nforever\n    set [aatimer2 v] to (timer)\nend\n\nwhen [timer v] > (AAtimer2)\ngo to [front v] layer\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\n@Game End\n\nwhen flag clicked\nhide\n\nwhen I receive [end game  v]\nshow\nforever\n    go to [front v] layer\nend\n\n@Game\n\ndefine Do physics\nchange [yv v] by (-1)\nif <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n    change [xv v] by (-1)\nend\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n    change [xv v] by (1)\nend\nset [xv v] to ((Xv) * (.9))\nchange x by (Xv)\nif <touching color (#a2a2a2)?> then\n    change y by (1)\nend\nif <touching color (#a2a2a2)?> then\n    change y by (1)\nend\nif <touching color (#a2a2a2)?> then\n    change y by (1)\nend\nif <touching color (#a2a2a2)?> then\n    change y by (1)\nend\nif <touching color (#a2a2a2)?> then\n    change y by (-4)\n    change x by ((Xv) * (-1))\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > [0]>>> then\n        set [yv v] to [17]\n        if <(Xv) > [0]> then\n            set [xv v] to [-10]\n        else\n            set [xv v] to [10]\n        end\n    else\n        set [xv v] to [0]\n    end\nend\nchange y by (Yv)\nif <touching color (#a2a2a2)?> then\n    change y by ((Yv) * (-1))\n    set [yv v] to [0]\nend\nchange y by (-1)\nif <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > [0]>>> and <touching color (#a2a2a2)?>> then\n    set [yv v] to [15]\nend\nchange y by (1)\n\ndefine Draw line from (x1) (y1) to (x2) (y2) with offset (ox) (oy)\ngo to x: ((x1) + (ox)) y: ((y1) + (oy))\npen down\ngo to x: ((x2) + (ox)) y: ((y2) + (oy))\npen up\n\ndefine Draw level collision with offset (ox) (oy)\nif <(Level) = [1]> then\n    set pen size to (32)\n    set pen color to (#a2a2a2)\n    Draw line from [-240] [-100] to [240] [-100] with offset (ox) (oy)\n    set pen size to (8)\n    set pen color to (#ff9400)\n    Draw square at [200] [-25] and size [50] with offset (ox) (oy)\n    set pen color to (#ff6151)\n    Draw line from [0] [-100] to [0] [-25] with offset (ox) (oy)\nend\nif <(Level) = [2]> then\n    set pen size to (32)\n    set pen color to (#a2a2a2)\n    Draw line from [-240] [-100] to [350] [-100] with offset (ox) (oy)\n    set pen size to (8)\n    set pen color to (#ff9400)\n    Draw square at [320] [-25] and size [50] with offset (ox) (oy)\n    set pen size to (20)\n    set pen size to (20)\n    set pen color to (#a2a2a2)\n    Draw line from [-95] [-15] to [100] [-15] with offset (ox) (oy)\n    set pen color to (#ff6151)\n    Draw line from [0] [0] to [0] [50] with offset (ox) (oy)\n    set pen size to (15)\n    set pen color to (#ff6151)\n    Draw line from [-100] [-75] to [105] [-75] with offset (ox) (oy)\nend\nif <(Level) = [3]> then\n    set pen size to (32)\n    set pen color to (#a2a2a2)\n    Draw line from [-240] [-100] to [500] [-100] with offset (ox) (oy)\n    set pen size to (8)\n    set pen color to (#ff9400)\n    Draw square at [450] [-25] and size [50] with offset (ox) (oy)\n    set pen color to (#ff6151)\n    Draw line from [0] [0] to [0] [50] with offset (ox) (oy)\n    set pen color to (#ff6151)\n    Draw line from [120] [90] to [120] [120] with offset (ox) (oy)\n    set pen color to (#ff6151)\n    Draw line from [300] [90] to [300] [-80] with offset (ox) (oy)\n    set pen size to (20)\n    set pen size to (20)\n    set pen size to (20)\n    set pen size to (20)\n    set pen color to (#a2a2a2)\n    Draw line from [-95] [-15] to [100] [-15] with offset (ox) (oy)\n    set pen size to (20)\n    set pen color to (#a2a2a2)\n    Draw line from [50] [75] to [200] [75] with offset (ox) (oy)\nend\nif <(Level) = [4]> then\n    set pen color to (#a2a2a2)\n    Draw line from [-250] [-90] to [-100] [-90] with offset (ox) (oy)\n    Draw line from [-50] [20] to [100] [20] with offset (ox) (oy)\n    Draw line from [150] [-90] to [300] [-90] with offset (ox) (oy)\n    set pen size to (32)\n    set pen size to (8)\n    set pen color to (#ff9400)\n    Draw square at [450] [-25] and size [50] with offset (ox) (oy)\n    set pen size to (20)\n    set pen size to (20)\n    set pen size to (5)\n    set pen size to (5)\n    set pen color to (#ff6151)\n    Draw line from [-50] [30] to [0] [30] with offset (ox) (oy)\n    set pen size to (5)\n    set pen color to (#ff6151)\n    Draw line from [50] [30] to [100] [30] with offset (ox) (oy)\n    set pen size to (5)\n    set pen color to (#ff6151)\n    Draw line from [250] [-80] to [200] [-80] with offset (ox) (oy)\nend\nif <(Level) = [5]> then\n    set pen color to (#a2a2a2)\n    Draw line from [-250] [-90] to [-100] [-90] with offset (ox) (oy)\n    Draw line from [-100] [30] to [50] [30] with offset (ox) (oy)\n    Draw line from [-250] [150] to [-100] [150] with offset (ox) (oy)\n    Draw line from [-190] [270] to [50] [270] with offset (ox) (oy)\n    set pen size to (32)\n    set pen size to (8)\n    set pen color to (#ff9400)\n    Draw square at [27] [300] and size [20] with offset (ox) (oy)\n    set pen size to (20)\n    set pen size to (20)\n    set pen size to (5)\n    set pen color to (#ff6151)\n    Draw line from [-180] [-80] to [-100] [-80] with offset (ox) (oy)\n    set pen size to (5)\n    set pen color to (#ff6151)\n    Draw line from [-50] [30] to [0] [30] with offset (ox) (oy)\n    set pen size to (5)\n    set pen color to (#ff6151)\n    Draw line from [50] [30] to [100] [30] with offset (ox) (oy)\n    set pen size to (5)\n    set pen color to (#ff6151)\n    Draw line from [250] [-80] to [200] [-80] with offset (ox) (oy)\n    Draw line from [-60] [40] to [20] [40] with offset (ox) (oy)\n    Draw line from [-180] [-80] to [-100] [-80] with offset (ox) (oy)\n    Draw line from [-200] [160] to [-140] [160] with offset (ox) (oy)\n    Draw line from [20] [40] to [50] [40] with offset (ox) (oy)\nend\n\nset pen color to (#ff6151)\nDraw line from [-180] [-80] to [-100] [-80] with offset (ox) (oy)\n\nset pen color to (#ff6151)\nDraw line from [0] [0] to [0] [50] with offset (ox) (oy)\nset pen color to (#ff6151)\nDraw line from [120] [90] to [120] [120] with offset (ox) (oy)\nset pen color to (#ff6151)\nDraw line from [300] [90] to [300] [-80] with offset (ox) (oy)\n\nset pen size to (20)\n\nDraw line from [-95] [-15] to [100] [-15] with offset (ox) (oy)\nDraw line from [50] [75] to [200] [75] with offset (ox) (oy)\nset pen size to (20)\n\ndefine Draw square at (center x) (center y) and size (side length) with offset (ox) (oy)\ngo to x: (((center x) + (ox)) + ((side length) / (2))) y: (((center y) + (oy)) + ((side length) / (2)))\npen down\ngo to x: (((center x) + (ox)) + ((side length) / (-2))) y: (((center y) + (oy)) + ((side length) / (2)))\ngo to x: (((center x) + (ox)) + ((side length) / (-2))) y: (((center y) + (oy)) + ((side length) / (-2)))\ngo to x: (((center x) + (ox)) + ((side length) / (2))) y: (((center y) + (oy)) + ((side length) / (-2)))\ngo to x: (((center x) + (ox)) + ((side length) / (2))) y: (((center y) + (oy)) + ((side length) / (2)))\npen up\n\ndefine Draw player\nset pen color to (#ff4516)\nset pen size to (10)\nDraw square at [0] [0] and size [13] with offset [0] [0]\nDraw square at [0] [0] and size [12] with offset [0] [0]\nDraw square at [0] [0] and size [11] with offset [0] [0]\nDraw square at [0] [0] and size [10] with offset [0] [0]\nset pen color to (#ffffff)\nDraw square at [0] [0] and size [3] with offset [0] [0]\nif <not <<key (any v) pressed?> or <mouse down?>>> then\n    set pen color to (#000000)\n    Draw square at [0] [0] and size [0.1] with offset [0] [0]\nend\nif <<<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> and <not <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > [0]>>>>> then\n    set pen color to (#000000)\n    Draw square at [0] [0] and size [0.1] with offset [-2] [0]\nend\nif <<<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> and <not <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > [0]>>> or <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>>>>> then\n    set pen color to (#000000)\n    Draw square at [0] [0] and size [0.1] with offset [2] [0]\nend\nif <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > [0]>>> and <not <<<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> or <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>>>>> then\n    set pen color to (#000000)\n    Draw square at [0] [0] and size [0.1] with offset [0] [2]\nend\nif <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > [0]>>> and <<<key (right arrow v) pressed?> or <key (d v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>>> then\n    set pen color to (#000000)\n    Draw square at [0] [0] and size [0.1] with offset [2] [2]\nend\nif <<<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > [0]>>> and <<<key (left arrow v) pressed?> or <key (a v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>>> then\n    set pen color to (#000000)\n    Draw square at [0] [0] and size [0.1] with offset [-2] [2]\nend\n\ndefine Do special collision\nif <<touching color (#ff6151)?> or <(Player Y) < [-200]>> then\n    Reset player\nend\nif <touching color (#ff9400)?> then\n    if <(Level) = [5]> then\n        broadcast (END GAME  v) and wait\n        stop [other scripts in sprite v]\n    else\n        change [level v] by (1)\n        Reset player\n    end\nend\n\ndefine Reset player\nset [player x v] to [-200]\nset [player y v] to [0]\nset [xv v] to [0]\nset [yv v] to [0]\n\ndefine Collision\nerase all\nDraw level collision with offset (() - (Player X)) (() - (Player Y))\ngo to x: (0) y: (0)\nDo physics\nchange [player x v] by (x position)\nchange [player y v] by (y position)\nDo special collision\n\ndefine Drawing\nset size to (10000) %\nerase all\nDraw level visual with offset (() - (Player X)) (() - (Player Y))\nDraw player\nset size to (100) %\n\ndefine Draw level visual with offset (ox) (oy)\nif <(Level) = [1]> then\n    set pen size to (3)\n    set pen size to (20)\n    set pen size to (10)\n    set pen color to (#a4f313)\n    Draw square at [200] [-25] and size [58] with offset (ox) (oy)\n    set pen size to (20)\n    set pen color to (#ff6151)\n    Draw line from [0] [-85] to [0] [-25] with offset (ox) (oy)\n    set pen size to (20)\n    set pen color to (#317996)\n    Draw line from [-250] [-90] to [250] [-90] with offset (ox) (oy)\nend\nif <(Level) = [2]> then\n    set pen size to (3)\n    set pen size to (20)\n    set pen size to (10)\n    set pen color to (#a4f313)\n    Draw square at [320] [-25] and size [58] with offset (ox) (oy)\n    set pen size to (20)\n    set pen color to (#713196)\n    Draw line from [-250] [-90] to [350] [-90] with offset (ox) (oy)\n    set pen size to (28)\n    set pen color to (#ff6151)\n    Draw line from [0] [0] to [0] [50] with offset (ox) (oy)\n    set pen size to (15)\n    set pen color to (#ff6151)\n    Draw line from [-100] [-75] to [105] [-75] with offset (ox) (oy)\n    set pen size to (20)\n    set pen size to (20)\n    set pen size to (28)\n    set pen color to (#723196)\n    Draw line from [-95] [-15] to [100] [-15] with offset (ox) (oy)\nend\nif <(Level) = [3]> then\n    set pen size to (3)\n    set pen size to (20)\n    set pen size to (10)\n    set pen color to (#a4f313)\n    Draw square at [450] [-25] and size [58] with offset (ox) (oy)\n    set pen color to (#ff6151)\n    Draw line from [0] [0] to [0] [50] with offset (ox) (oy)\n    set pen size to (20)\n    set pen color to (#ff6151)\n    Draw line from [120] [90] to [120] [120] with offset (ox) (oy)\n    set pen color to (#ff6151)\n    Draw line from [300] [90] to [300] [-80] with offset (ox) (oy)\n    set pen size to (20)\n    set pen size to (20)\n    set pen color to (#31963e)\n    Draw line from [-250] [-90] to [500] [-90] with offset (ox) (oy)\n    set pen size to (28)\n    set pen color to (#31963e)\n    Draw line from [-95] [-15] to [100] [-15] with offset (ox) (oy)\n    set pen size to (28)\n    set pen color to (#31963e)\n    Draw line from [50] [75] to [200] [75] with offset (ox) (oy)\nend\nif <(Level) = [4]> then\n    set pen size to (3)\n    set pen size to (20)\n    set pen size to (10)\n    set pen color to (#a4f313)\n    Draw square at [450] [-25] and size [58] with offset (ox) (oy)\n    set pen size to (20)\n    set pen size to (20)\n    set pen color to (#f9e568)\n    Draw line from [-250] [-90] to [-100] [-90] with offset (ox) (oy)\n    set pen color to (#f9e568)\n    Draw line from [-50] [20] to [100] [20] with offset (ox) (oy)\n    set pen color to (#f9e568)\n    Draw line from [150] [-90] to [300] [-90] with offset (ox) (oy)\n    set pen size to (5)\n    set pen size to (5)\n    set pen color to (#ff6151)\n    Draw line from [-50] [30] to [0] [30] with offset (ox) (oy)\n    set pen size to (5)\n    set pen color to (#ff6151)\n    Draw line from [50] [30] to [100] [30] with offset (ox) (oy)\n    set pen size to (5)\n    set pen color to (#ff6151)\n    Draw line from [250] [-80] to [200] [-80] with offset (ox) (oy)\nend\nif <(Level) = [5]> then\n    set pen size to (3)\n    set pen size to (20)\n    set pen size to (10)\n    set pen color to (#a4f313)\n    Draw square at [27] [300] and size [20] with offset (ox) (oy)\n    set pen size to (20)\n    set pen size to (20)\n    set pen color to (#f9ae68)\n    Draw line from [-250] [-90] to [-100] [-90] with offset (ox) (oy)\n    set pen color to (#9860ff)\n    Draw line from [-100] [30] to [50] [30] with offset (ox) (oy)\n    set pen color to (#8cf968)\n    Draw line from [-250] [150] to [-100] [150] with offset (ox) (oy)\n    set pen color to (#60dfff)\n    Draw line from [-190] [270] to [50] [270] with offset (ox) (oy)\n    set pen size to (5)\n    set pen color to (#ff6151)\n    Draw line from [-180] [-80] to [-100] [-80] with offset (ox) (oy)\n    set pen size to (5)\n    set pen color to (#ff6151)\n    Draw line from [-60] [40] to [20] [40] with offset (ox) (oy)\n    set pen size to (5)\n    set pen color to (#ff6151)\n    Draw line from [20] [40] to [50] [40] with offset (ox) (oy)\n    set pen size to (5)\n    set pen color to (#ff6151)\n    Draw line from [-210] [160] to [-140] [160] with offset (ox) (oy)\nend\n\nwhen flag clicked\nset [level v] to [1]\nReset player\nforever\n    Collision\n    Drawing\nend\n\nset pen color to (#ff6151)\nDraw line from [300] [90] to [300] [90] with offset (ox) (oy)\n\nset pen size to (20)\nset pen color to (#f9e568)\n\nset pen color to (#f9e568)\n\nDraw line from [-250] [-90] to [-100] [-90] with offset (ox) (oy)\nDraw line from [-50] [20] to [100] [20] with offset (ox) (oy)\nDraw line from [150] [-90] to [300] [-90] with offset (ox) (oy)\n\nset pen color to (#f9ae68)\n\nset pen color to (#ff6151)\n\nset pen size to (5)\nset pen color to (#ff6151)\n\nset pen color to (#ff6151)\n\nset pen size to (5)\nset pen color to (#ff6151)\n\nset pen size to (5)\n\n