Explorer||A Scrolling Platformer pt2

Instructions: Use Arrow keys or WADS to move, m to mute, u to unmute, C to change skin. 1, 2 or 3 to change the song. \n4 to make louder, 5 to make quieter. Part 1: https://scratch.mit.edu/projects/407358610\nCheck out my newest game: https://scratch.mit.edu/projects/419337409/

@Stage\n\n@Blank\n\nwhen flag clicked\ngo to [front v] layer\nset [ghost v] effect to (100)\nshow\n\n@Thumbnail\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\nwait (1) seconds\nglide (1.3) secs to x: (75) y: (0)\nglide (0.7) secs to x: (500) y: (0)\nhide\nbroadcast (Start v)\n\n@Player\n\nwhen flag clicked\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]\nwait (12.5) seconds\nset [level v] to [1]\nforever\n    broadcast (Reset v) and wait\n    broadcast (Setip v) and wait\n    Game on\n    repeat until <(EXIT) > []>\n        Tick\n        broadcast (Tick v) and wait\n    end\n    if <(EXIT) = [Win]> then\n        Game - Win\n    else\n        Game - Die\n    end\nend\n\ndefine Game on\nif <(Checkpoint) = [0]> then\n    set [x v] to [0]\n    set [player: y v] to [0]\n    switch backdrop to (backdrop2 v)\nelse\n    if <(Checkpoint) = [1]> then\n        set [x v] to [2233]\n        set [player: y v] to [144]\n        switch backdrop to (backdrop2 v)\n    else\n        set [x v] to [4307]\n        set [player: y v] to [-80]\n        if <(SCROLL X) > [5761]> then\n            switch backdrop to (backdrop2 v)\n        else\n            switch backdrop to (backdrop3 v)\n        end\n    end\nend\nset [player: speed y v] to [0]\nset [speed x v] to [0]\nset [player: in air v] to [0]\nset [exit v] to []\nset [scroll x v] to [0]\nset [scroll y v] to [0]\nset size to (10) %\nclear graphic effects\nshow\n\ndefine Tick\nif <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n    change [speed x v] by (-2)\n    point in direction (-90)\nend\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    change [speed x v] by (2)\n    point in direction (90)\nend\nset [speed x v] to ((Speed x) * (0.8))\nif <([abs v] of (Speed x) ) > [0.9]> then\n    Change player x by (round (Speed x))\nend\nif <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n    if <(Player: in air) < [4]> then\n        set [player: speed y v] to [16]\n    end\nend\nif <(Player: Speed y) > [-20]> then\n    change [player: speed y v] by (-2)\nend\nChange player y by (Player: Speed y)\nTest - Die\nset [scroll x v] to (x)\nif <(SCROLL X) < [0]> then\n    set [scroll x v] to [0]\nend\nif <(SCROLL X) > [5761]> then\n    set [scroll x v] to [5761]\nend\nchange [scroll y v] by (round (((Player: y) - (SCROLL Y)) / (10)))\nif <(SCROLL Y) < [0]> then\n    set [scroll y v] to [0]\nend\nPosition\nif <(Player: y) < [-178]> then\n    set [exit v] to [Die]\nend\nif <touching (danger v)?> then\n    set [exit v] to [Die]\nend\n\ndefine Change player y by (sy)\nchange [player: y v] by (sy)\nchange [player: in air v] by (1)\nPosition\nrepeat until <not <touching (platforms v)?>>\n    if <(sy) > [0]> then\n        change [player: y v] by (-1)\n    else\n        change [player: y v] by (1)\n        set [player: in air v] to [0]\n    end\n    Position\n    set [player: speed y v] to [0]\nend\n\ndefine Position\ngo to x: ((x) - (SCROLL X)) y: ((Player: y) - (SCROLL Y))\n\ndefine Change player x by (sx)\nchange [x v] by (sx)\nPosition\nif <touching (platforms v)?> then\n    repeat (12)\n        change [player: y v] by (1)\n        Position\n        if <not <touching (platforms v)?>> then\n            stop [this script v]\n        end\n    end\n    change [player: y v] by (-12)\n    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        if <(sx) > [0]> then\n            set [speed x v] to [-16]\n        else\n            set [speed x v] to [16]\n        end\n        set [player: in air v] to [0]\n    else\n        set [speed x 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 (5)\n    hide\n    wait (0.1) seconds\n    show\n    wait (0.1) seconds\nend\n\ndefine Game - Win\nrepeat (50)\n    point towards (exit v)\n    turn right (65) degrees\n    move ((distance to [exit v]) / (2)) steps\n    change size by (-0.25)\n    change [ghost v] effect by (2)\nend\nhide\nclear graphic effects\nchange [level v] by (1)\nwait (1) seconds\n\ndefine Test - Die\n\nwhen flag clicked\nif <(y position) = [-181]> then\n    broadcast (mou v)\nend\nforever\n\nwhen flag clicked\nforever\n    if <key (s v) pressed?> then\n        change [scroll x v] by (100)\n    end\nend\n\nwhen flag clicked\nforever\n    if <key (c v) pressed?> then\n        next costume\n        wait (.1) seconds\n    end\nend\n\n@Checkpoint \n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((Checkpoint : y) - (SCROLL Y))\nif <(costume [number v]) = [2]> then\n    if <touching (player v)?> then\n        change [checkpoint v] by (1)\n        switch costume to (green flag v)\n    end\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\ndefine Clone at x: (x) y: (y)\nset [x v] to (x)\nset [checkpoint : y v] to (y)\ncreate clone of (_myself_ v)\n\nwhen flag clicked\nset [checkpoint v] to [0]\nhide\nset [x v] to [0]\nset [checkpoint : y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (close flag v)\n    Clone at x: [2233] y: [144]\n    Clone at x: [4307] y: [-80]\nend\nset [x v] to [-99999]\n\n@Clouds\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((Clouds: y) - (SCROLL Y))\n\nwhen I receive [setip v]\nhide\nset [x v] to [0]\nset [clouds: y v] to [0]\nset [ghost v] effect to (30)\ngo to [back v] layer\nif <(LEVEL) = [1]> then\n    switch costume to (level 1-1 v)\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [0] y: [200]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [-100]\n    Clone at x: [480] y: [-100]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [0] y: [360]\n    Clone at x: [480] y: [0]\n    Clone at x: [0] y: [-360]\n    Clone at x: [480] 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 [clouds: y v] by (y)\nnext costume\n\n@Platforms\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((Platforms: y) - (SCROLL Y))\n\nwhen I receive [setip v]\nhide\nset [x v] to [0]\nset [platforms: y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1-1 v)\n    switch backdrop to (grassland v)\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [0] y: [360]\n    Clone at x: [480] y: [0]\n    Clone at x: [0] y: [-360]\n    Clone at x: [480] 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 [platforms: y v] by (y)\nnext costume\n\nClone at x: [1663] y: [557]\n\n@Danger\n\nwhen I receive [green flag v]\nhide\n\nwhen I receive [tick v]\nPosition ((x) - (SCROLL X)) ((Danger: y) - (SCROLL Y))\n\nwhen I receive [setip v]\nhide\nset [x v] to [0]\nset [danger: y v] to [0]\nif <(LEVEL) = [1]> then\n    switch costume to (level 1-1 v)\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [480] y: [0]\n    Clone at x: [0] y: [360]\n    Clone at x: [480] y: [0]\n    Clone at x: [0] y: [-360]\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 [danger: y v] by (y)\nnext costume\n\n@Intro\n\nwhen flag clicked\nset size to (100) %\ngo to x: (0) y: (0)\nswitch costume to (blank v)\nhide\nwait (2.5) seconds\nshow\nrepeat (13)\n    next costume\n    wait (.1) seconds\nend\nrepeat (3)\n    change size by (20)\n    wait (.8) seconds\n    change size by (-20)\n    wait (.8) seconds\nend\nwait (1) seconds\nswitch costume to (coolbeans_te v)\nwait (.1) seconds\nswitch costume to (coolbeans_t v)\nwait (.1) seconds\nswitch costume to (coolbeans_ v)\nwait (.1) seconds\nswitch costume to (coolbeans v)\nwait (.1) seconds\nswitch costume to (coolbean v)\nwait (.1) seconds\nswitch costume to (coolbea v)\nwait (.1) seconds\nswitch costume to (coolbe v)\nwait (.1) seconds\nswitch costume to (coolb v)\nwait (.1) seconds\nswitch costume to (cool v)\nwait (.1) seconds\nswitch costume to (coo v)\nwait (.1) seconds\nswitch costume to (co v)\nwait (.1) seconds\nswitch costume to (c v)\nwait (.1) seconds\nswitch costume to (blank v)\nwait (.1) seconds\nhide\n\n@Music\n\nwhen flag clicked\nforever\n    if <key (u v) pressed?> then\n        set volume to (100) %\n    end\nend\n\nwhen flag clicked\nforever\n    if <key (m v) pressed?> then\n        set volume to (0) %\n    end\nend\n\nwhen flag clicked\nforever\n    if <key (4 v) pressed?> then\n        change volume by (10)\n    end\nend\n\nwhen flag clicked\nforever\n    if <key (5 v) pressed?> then\n        change volume by (-10)\n    end\nend\n\n@Instructions\n\nwhen this sprite clicked\ngo to [front v] layer\nswitch costume to (costume2 v)\nforever\n    if <key (space v) pressed?> then\n        wait (.1) seconds\n        next costume\n        wait (1) seconds\n    end\nend\n\nwhen flag clicked\nhide\nswitch costume to (costume1 v)\nwait (12.5) seconds\nshow\n\n@Songs\n\ndefine Change song\nstop all sounds\nrepeat until <<key (2 v) pressed?> or <key (3 v) pressed?>>\n    start sound [Ikson - Last Summer2 v]\n    broadcast (Change song v)\nend\nforever\n    if <key (m v) pressed?> then\n        set volume to (0) %\n    end\n    if <key (u v) pressed?> then\n        set volume to (100) %\n    end\nend\n\ndefine Next Song\nstop all sounds\nrepeat until <<key (1 v) pressed?> or <key (3 v) pressed?>>\n    start sound [K-391 - Summertime v]\n    broadcast (Change song v)\nend\nforever\n    if <key (m v) pressed?> then\n        set volume to (0) %\n    end\n    if <key (u v) pressed?> then\n        set volume to (100) %\n    end\nend\n\ndefine next song\nstop all sounds\nrepeat until <<key (2 v) pressed?> or <key (1 v) pressed?>>\n    start sound [Shirk - Haunted v]\n    broadcast (Change song v)\nend\nforever\n    if <key (m v) pressed?> then\n        set volume to (0) %\n    end\n    if <key (u v) pressed?> then\n        set volume to (100) %\n    end\nend\n\nwhen flag clicked\nbroadcast (Change song v)\nset volume to (100) %\nstart sound [Ikson - Last Summer v]\nwait (12.5) seconds\nstop all sounds\nstart sound [Shirk - Haunted v]\nstart sound [Shirk - Haunted v]\nstart sound [Shirk - Haunted v]\nstart sound [Shirk - Haunted v]\nstart sound [Shirk - Haunted v]\nstart sound [Shirk - Haunted v]\nstart sound [Shirk - Haunted v]\nstart sound [Shirk - Haunted v]\nstart sound [Shirk - Haunted v]\nstart sound [Shirk - Haunted v]\nstart sound [Shirk - Haunted v]\nstart sound [Shirk - Haunted v]\nstart sound [Shirk - Haunted v]\nstart sound [Shirk - Haunted v]\nstart sound [Shirk - Haunted v]\nstart sound [Shirk - Haunted v]\nforever\n    if <key (m v) pressed?> then\n        set volume to (0) %\n    end\n    if <key (u v) pressed?> then\n        set volume to (100) %\n    end\nend\n\nwhen I receive [change song v]\nforever\n    if <key (1 v) pressed?> then\n        Change song\n    end\n    if <key (2 v) pressed?> then\n        Next Song\n    end\n    if <key (3 v) pressed?> then\n        next song\n    end\n    if <key (m v) pressed?> then\n        set volume to (0) %\n    end\n    if <key (u v) pressed?> then\n        set volume to (100) %\n    end\nend\n\n