Oceans - A Platformer

Instructions: Note, This isn't a sequel to https://scratch.mit.edu/projects/586920290/

@Stage\n\nwhen flag clicked\nforever\n    switch backdrop to (LEVEL)\nend\n\n@Player\n\nwhen flag clicked\nbroadcast (Green Flag v) and wait\nbroadcast (Play Game v) and wait\n\nwhen I receive [play game v]\nset [level v] to [1]\nforever\n    broadcast (Setup v) and wait\n    setup\n    repeat until <(EXIT) > []>\n        loop\n        broadcast (Loop v) and wait\n    end\n    if <(EXIT) = [next]> then\n        change [level v] by (1)\n        hide\n        broadcast (NEXT LEVEL v) and wait\n    end\n    if <(EXIT) = [skip]> then\n        hide\n        broadcast (NEXT LEVEL v) and wait\n    end\n    set [exit v] to []\nend\n\nwhen I receive [green flag v]\nhide\ngo to [front v] layer\n\ndefine setup\nset [in air2 v] to [0]\nset [x v2 v] to [0]\nset [y v v] to [0]\ngo to x: (-220) y: (-109)\nshow\n\ndefine loop\nif <<not <<(TrussUp) = [1]> or <(TrussDown) = [1]>>> and <<key (left arrow v) pressed?> or <<<mouse down?> and <((mouse x) - (20)) < [0]>> or <key (a v) pressed?>>>> then\n    change [x v2 v] by (-1)\nend\nif <<not <<(TrussUp) = [1]> or <(TrussDown) = [1]>>> and <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <((mouse x) + (20)) > [0]>>>>> then\n    change [x v2 v] by (1)\nend\nset [x v2 v] to ((x v2) * (0.8))\nif <([abs v] of (x v2) ) > [0.9]> then\n    change player x by (round (x v2))\nend\nif <<not <<touching (climbable v)?> or <touching (truss on v)?>>> and <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <((mouse y) - (30)) > [0]>>>>> then\n    if <(in air2) < [4]> then\n        set [y v v] to [10]\n    end\nend\nchange [y v v] by (-2)\nchange player y by (y v)\nif <(x position) > [239]> then\n    set [exit v] to [next]\nend\nif <(y position) < [-179]> then\n    set [exit v] to [die]\n    set [level v] to [1]\nend\nif <<touching (spikes v)?> or <touching (moving spikes v)?>> then\n    set [exit v] to [die]\n    set [level v] to [1]\nend\nif <touching (spring v)?> then\n    if <([costume # v] of [spring v]) = [1]> then\n        set [y v v] to [27]\n    else\n        if <([costume # v] of [spring v]) = [2]> then\n            set [y v v] to [-8]\n        else\n            set [x v2 v] to [-27]\n        end\n    end\nend\n\ndefine change player y by (y v)\nif <not <<touching (climbable v)?> or <touching (truss on v)?>>> then\n    change y by (y v)\n    change [in air2 v] by (1)\n    repeat until <not <<touching (moving platforms v)?> or <<touching (on v)?> or <<touching (platform v)?> or <<touching (truss v)?> or <<<touching (conveyor right v)?> or <touching (conveyor left v)?>> or <<touching (conveyor left strong v)?> or <<touching (keydoor v)?> or <<touching (bap invert v)?> or <touching (conveyor right strong v)?>>>>>>>>>>\n        if <(y v) > [0]> then\n            change y by (-1)\n        else\n            change y by (1)\n            set [in air2 v] to [0]\n        end\n        set [y v v] to [0]\n    end\nend\n\nwhen I receive [reset v]\nsetup\n\nhide\n\nwhen flag clicked\nforever\n    if <<touching (climbable v)?> or <touching (truss on v)?>> then\n        set [in air2 v] to [0]\n    end\nend\n\nwhen flag clicked\nforever\n    if <<touching (climbable v)?> or <touching (truss on v)?>> then\n        if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <(TrussUp) = [1]>>> then\n            change y by (5)\n        else\n            if <<key (down arrow v) pressed?> or <<key (s v) pressed?> or <(TrussDown) = [1]>>> then\n                change y by (-5)\n            end\n        end\n    end\nend\n\nrepeat (10)\n\nchange y by (10)\n\nwhen flag clicked\nforever\n    if <(y v) < [-20]> then\n        set [y v v] to [-20]\n    end\nend\n\nwhen flag clicked\nforever\n    if <<touching (climbable v)?> or <touching (truss on v)?>> then\n        set [y v v] to [-5]\n        set [touchingclimbable v] to [1]\n    else\n        set [touchingclimbable v] to [0]\n    end\nend\n\n\n\nwhen flag clicked\nforever\n    change y by (-1)\n    if <touching (conveyor left v)?> then\n        change x by (-5)\n    else\n        if <touching (conveyor right v)?> then\n            change x by (5)\n        else\n            if <touching (conveyor left strong v)?> then\n                change x by (-10)\n            else\n                if <touching (conveyor right strong v)?> then\n                    change x by (10)\n                end\n            end\n        end\n    end\n    change y by (1)\nend\n\n\n\nwhen flag clicked\nforever\n    if <touching (bouncepad v)?> then\n        set [y v v] to [15]\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (teleport v)?> then\n        repeat (10)\n            go to (teleport exit v)\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (wallhop wall v)?> then\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            set [y v v] to [15]\n            wait until <not <<key (up arrow v) pressed?> or <key (w v) pressed?>>>\n            wait (0.1) seconds\n        end\n    end\nend\n\n\n\nset [y v v] to [15]\nwait (0.2) seconds\n\nwhen flag clicked\nforever\n    if <touching (cannon v)?> then\n        broadcast (check if zip v)\n    end\nend\n\nwhen I receive [confirm v]\nset [x v2 v] to [20]\n\ndefine change player x by (x v)\nchange x by (x v)\nif <<touching (moving platforms v)?> or <<touching (on v)?> or <<touching (platform v)?> or <<touching (truss v)?> or <<<touching (conveyor right v)?> or <touching (conveyor left v)?>> or <<touching (conveyor left strong v)?> or <<touching (keydoor v)?> or <<touching (bap invert v)?> or <touching (conveyor right strong v)?>>>>>>>>> then\n    repeat (10)\n        change y by (1)\n        if <not <<touching (moving platforms v)?> or <<touching (on v)?> or <<touching (platform v)?> or <<touching (truss v)?> or <<<touching (conveyor right v)?> or <touching (conveyor left v)?>> or <<touching (conveyor left strong v)?> or <<touching (keydoor v)?> or <<touching (bap invert v)?> or <touching (conveyor right strong v)?>>>>>>>>>> then\n            stop [this script v]\n        end\n    end\n    change y by (-10)\n    if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <<<touching (truss on v)?> or <touching (platform v)?>> or <<<touching (conveyor right v)?> or <touching (conveyor left v)?>> or <<touching (conveyor left strong v)?> or <<touching (keydoor v)?> or <<touching (bap invert v)?> or <touching (conveyor right strong v)?>>>>>>>>> then\n    repeat until <not <<touching (moving platforms v)?> or <<touching (on v)?> or <<touching (platform v)?> or <<<touching (conveyor right v)?> or <touching (conveyor left v)?>> or <<touching (conveyor left strong v)?> or <<touching (keydoor v)?> or <<touching (bap invert v)?> or <touching (conveyor right strong v)?>>>>>>>>>\n        if <(x v) > [0]> then\n            change x by (-1)\n        else\n            change x by (1)\n        end\n    end\nend\n\n@Thumbnail\n\ngo to [front v] layer\nshow\n\nwhen flag clicked\nhide\n\n@Timer\n\nwhen I receive [reset v]\nset [seconds v] to [0]\nset [minutes v] to [0]\n\nwhen flag clicked\nshow variable [seconds v]\n\nwhen flag clicked\nif < (LEVEL) contains [Win]?> then\n    broadcast (Win v)\nelse\n    repeat until < (backdrop [name v]) contains [Win]?>\n        wait (1) seconds\n        change [seconds v] by (1)\n    end\nend\n\nwhen flag clicked\nset [seconds v] to [0]\n\nwhen I receive [stoptimer v]\nstop [other scripts in sprite v]\n\n@Platform\n\nwhen flag clicked\ngo to [front v] layer\nforever\n    switch costume to (LEVEL)\nend\n\nset [level v] to [4]\n\nwhen flag clicked\nrepeat (2)\n    go to [front v] layer\nend\n\n@Spikes\n\nwhen flag clicked\nset [ghost v] effect to (50)\nforever\n    go to [front v] layer\n    switch costume to (LEVEL)\nend\n\n@Moving Platforms\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    glide (1) secs to x: (1) y: (74)\n    wait (1) seconds\n    glide (1) secs to x: (0) y: (0)\n    wait (1) seconds\nend\n\n@Climbable\n\nwhen flag clicked\nset [ghost v] effect to (0)\n\nset [ghost v] effect to (0)\n\nwhen flag clicked\ngo to [front v] layer\nforever\n    switch costume to (LEVEL)\nend\n\n@TrussButton1\n\nwhen flag clicked\ngo to x: (-218) y: (-136)\nforever\n    if <(TouchingClimbable) = [1]> then\n        show\n    else\n        hide\n    end\nend\n\nwhen flag clicked\nforever\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        set [trussup v] to [1]\n    else\n        set [trussup v] to [0]\n    end\nend\n\n@TrussButton2\n\nwhen flag clicked\ngo to x: (-171) y: (-136)\nforever\n    if <(TouchingClimbable) = [1]> then\n        show\n    else\n        hide\n    end\nend\n\nwhen flag clicked\nforever\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        set [trussdown v] to [1]\n    else\n        set [trussdown v] to [0]\n    end\nend\n\n@Win\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    if <(LEVEL) = [3]> then\n        show\n    else\n        hide\n    end\nend\n\nwhen flag clicked\nwait (1) seconds\nforever\n    if <touching (player v)?> then\n        broadcast (StopTimer v)\n        if <(Seconds) < (☁ World Record Time)> then\n            set [☁ world record time v] to (Seconds)\n        end\n    end\nend\n\n