Mango Underwater || Scrolling Platformer 2

Instructions: Arrow keys, WASD or mobile.\n\nPropose the project below to be featured: https://scratch.mit.edu/projects/700390048/\n

@Stage\n\nwhen flag clicked\nforever\n    play sound [platformer_;\) v] until done\nend\n\n@PLATFORMS\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((X) - (Scroll X)) ((Y) - (Scroll Y))\n\nwhen I receive [setup v]\nhide\nset [y v] to [0]\nset [x v] to [0]\nif <(Level) = [1]> then\n    switch costume to (level 1 v)\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\n    Clone at X: [360] Y: [0]\nend\n\ndefine Position (x) (y)\ngo to x: (x) y: (y)\nif <<(x) = (x position)> and <(y) = (y position)>> then\n    show\nelse\n    hide\nend\n\nwhen I receive [reset v]\ndelete this clone\n\ndefine Clone at X: (x) Y: (y)\ncreate clone of (_myself_ v)\nchange [x v] by (x)\nchange [y v] by (y)\nnext costume\n\n@PLAYER\n\nwhen flag clicked\nswitch costume to (none v)\nbroadcast (Green Flag v) and wait\nbroadcast (Play Game v) and wait\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\n\nwhen I receive [play game v]\nset [level v] to [1]\nforever\n    broadcast (Reset v) and wait\n    broadcast (Setup v) and wait\n    Game On\n    repeat until <(EXIT) > []>\n        Tick\n        broadcast (Tick v)\n    end\n    if <(EXIT) = [win]> then\nend\n\ndefine Game On\nset [sx v] to [0]\nset [x v] to [0]\nset [y v] to [0]\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset [sy v] to [0]\nset [in air v] to [0]\nset [exit v] to []\npoint in direction (90)\nset size to (60) %\nshow\nset [ghost v] effect to (0)\n\ndefine Tick\nif <<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>>> then\n    change [sx v] by (-3)\n    switch costume to (left v)\nelse\n    switch costume to (none v)\nend\nif <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <(mouse x) > (x position)>>>> then\n    switch costume to (`right v)\n    change [sx v] by (3)\nelse\n    switch costume to (none v)\nend\nset [sx v] to ((sx) * (0.8))\nif <([abs v] of (sx) ) > [0.9]> then\n    Change Player X by (round (sx))\nend\nif <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n    if <(in air) < [4]> then\n        set [sy v] to [16]\n    end\nend\nchange [sy v] by (-2)\nChange Player Y by (sy)\nPosition\nTest- Die\nset [scroll x v] to (X)\nif <(Scroll X) < [0]> then\n    set [scroll x v] to [0]\nend\nchange [scroll y v] by (round (((Y) - (Scroll Y)) / (10)))\nif <(Scroll Y) < [0]> then\n    set [scroll y v] to [0]\nend\nPosition\nif <(Y) < [-180]> then\n    set [exit v] to [die]\nend\n\ndefine Change Player Y by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nPosition\nTest- Die\nrepeat until <not <touching (platforms v)?>>\n    if <(sy) > [0]> then\n        change [y v] by (-1)\n    else\n        change [y v] by (1)\n        set [in air v] to [0]\n    end\n    Position\n    set [sy v] to [0]\nend\n\ndefine Position\ngo to x: ((X) - (Scroll X)) y: ((Y) - (Scroll Y))\n\ndefine Change Player X by (sx)\nchange [x v] by (sx)\nPosition\nTest- Die\nif <touching (platforms v)?> then\n    repeat (12)\n        change [y v] by (1)\n        Position\n        if <not <touching (platforms v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-12)\n    if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>>> then\n        if <(sx) > [0]> then\n            set [sx v] to [-16]\n        else\n            set [sx v] to [16]\n        end\n        set [in air v] to [0]\n    else\n        set [sx v] to [0]\n    end\n    repeat until <not <touching (platforms v)?>>\n        if <(sx) > [0]> then\n            change [x v] by (-1)\n        else\n            change [x v] by (1)\n        end\n        Position\n    end\nend\n\ndefine Game- Die\nset [exit v] to []\nrepeat (4)\n    change [pixelate v] effect by (25)\n    wait (0.02) seconds\n    change [brightness v] effect by (25)\n    wait (0.02) seconds\n    change [whirl v] effect by (25)\nend\nclear graphic effects\nhide\nwait (0.5) seconds\n\ndefine Test- Die\nif <touching color (#ff0000)?> then\n    set [exit v] to [die]\nend\n\n@Bubble\n\nwhen flag clicked\nset size to (10) %\nhide\nforever\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nshow\ngo to [back v] layer\ngo to x: (pick random (-240) to (240)) y: (-180)\nset [cloneyv v] to [0]\nrepeat until <(y position) > [175]>\n    change [cloneyv v] by (1)\n    change y by (cloneYv)\nend\ndelete this clone\n\n@TN\n\nwhen flag clicked\nset [ghost v] effect to (100)\ngo to [front v] layer\nshow\n\n