Rescue 2 -Cave- || A platformer || 

Instructions: New Game! https://scratch.mit.edu/projects/406527472 [Orbit || A 360* Platformer]

@Stage\n\nwhen flag clicked\nbroadcast (Start v)\nforever\n    play sound [Alan Walker - Force v] until done\nend\n\nwhen flag clicked\nforever\n    if <(volume) = [2]> then\n        set volume to (50) %\n    else\n        set volume to (0) %\n    end\nend\n\n@Blank\n\n@Player\n\ndefine Game On\nset [sx v] to [0]\nset [x v] to [-222]\nset [y v] to [-125]\nset [sy v] to [0]\nset [in air v] to [0]\nset [finish v] to []\nshow\n\ndefine Movement\nif <<<key (a v) pressed?> or <key (left arrow v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n    change [sx v] by (-1.5)\nend\nif <<<key (d v) pressed?> or <key (right arrow v) pressed?>> or <<mouse down?> and <(x position) < (mouse x)>>> then\n    change [sx v] by (1.5)\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 (w v) pressed?> or <key (up arrow v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> then\n    if <(in air) < [4]> then\n        set [sy v] to [14]\n    end\nend\nif <(sy) > [-20]> then\n    change [sy v] by (-2)\nend\nChange Player y by (sy)\nDie\nPosition\nif <<touching (flag v)?> and <not <(Level) = [21]>>> then\n    start sound [Connect v]\n    set [finish v] to [Yes]\nend\n\nwhen I receive [start v]\ngo to [front v] layer\nset [level v] to [1]\nforever\n    broadcast (Reset v) and wait\n    broadcast (Setup v) and wait\n    Game On\n    repeat until <(Finish) > []>\n        Movement\n    end\n    if <(Finish) = [Yes]> then\n        Game Con\n    else\n        Game End\n    end\nend\n\ndefine Change Player y by (sy)\nchange [y v] by (sy)\nchange [in air v] by (1)\nPosition\nrepeat until <not <touching (platform 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) y: (y)\n\ndefine Change Player x by (sx)\nchange [x v] by (sx)\nPosition\nif <touching (platform v)?> then\n    repeat (12)\n        change [y v] by (1)\n        Position\n        if <not <touching (platform v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-12)\n    if <<<key (w v) pressed?> or <key (up arrow v) pressed?>> or <<mouse down?> and <(mouse y) > (y position)>>> then\n        if <(sx) > [0]> then\n            if <(volume) = [2]> then\n                start sound [Wall Jump v]\n            end\n            set [sx v] to [-15]\n        else\n            if <(volume) = [2]> then\n                start sound [Wall Jump v]\n            end\n            set [sx v] to [15]\n        end\n        set [in air v] to [0]\n    else\n        set [sx v] to [0]\n    end\n    repeat until <not <touching (platform 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 End\nset [finish v] to []\ncreate clone of (_myself_ v)\n\ndefine Die\nif <<touching (danger v)?> or <<touching (spikes v)?> or <touching (enemy v)?>>> then\n    set [finish v] to [No]\nend\n\ndefine Game Con\nchange [level v] by (1)\n\nwhen flag clicked\nforever\n    if <(Level) = [21]> then\n        switch costume to (2 v)\n    else\n        switch costume to (1 v)\n    end\nend\n\nwhen I start as a clone\nif <(volume) = [2]> then\n    start sound [Die v]\nend\ngo to [front v] layer\nset [sx v] to [0]\nset [sy v] to [8]\nrepeat (12)\n    turn right (15) degrees\n    change y by (sy)\n    change [sy v] by (-1)\nend\nrepeat until <[-180] > (y position)>\n    change y by (sy)\n    change [sy v] by (-1)\nend\ndelete this clone\n\nwhen I receive [next v]\nGame Con\nGame On\nbroadcast (Reset v) and wait\nbroadcast (Setup v) and wait\nGame On\n\nwhen flag clicked\nforever\n    if <(x) < [-225]> then\n        set [x v] to [-225]\n    end\n    if <(x) > [228]> then\n        set [x v] to [228]\n    end\nend\n\n@Platform\n\nwhen I receive [start v]\nshow\nforever\n    go to x: (0) y: (0)\n    switch costume to (Level)\nend\n\nwhen flag clicked\nhide\n\n@Flag\n\nwhen I receive [start v]\nforever\n    if <(Level) = [1]> then\n        go to x: (214) y: (-105)\n    end\n    if <(Level) = [2]> then\n        go to x: (214) y: (-30)\n    end\n    if <(Level) = [3]> then\n        go to x: (214) y: (-33)\n    end\n    if <(Level) = [4]> then\n        go to x: (214) y: (128)\n    end\n    if <(Level) = [5]> then\n        go to x: (214) y: (-107)\n    end\n    if <(Level) = [6]> then\n        go to x: (214) y: (101)\n    end\n    if <(Level) = [7]> then\n        go to x: (214) y: (-70)\n    end\n    if <(Level) = [8]> then\n        go to x: (214) y: (-107)\n    end\n    if <(Level) = [9]> then\n        go to x: (214) y: (-107)\n    end\n    if <(Level) = [10]> then\n        go to x: (214) y: (-107)\n    end\n    if <(Level) = [11]> then\n        go to x: (214) y: (74)\n    end\n    if <(Level) = [12]> then\n        go to x: (214) y: (-107)\n    end\n    if <(Level) = [13]> then\n        go to x: (214) y: (-17)\n    end\n    if <(Level) = [14]> then\n        go to x: (214) y: (102)\n    end\n    if <(Level) = [15]> then\n        go to x: (214) y: (-55)\n    end\n    if <(Level) = [16]> then\n        go to x: (214) y: (128)\n    end\n    if <(Level) = [17]> then\n        go to x: (214) y: (-107)\n    end\nend\n\nwhen I receive [start v]\nshow\nforever\n    if <not <(Level) = [21]>> then\n        switch costume to (green flag v)\n        set size to (90) %\n    else\n        switch costume to (text v)\n        set size to (110) %\n        go to x: (0) y: (0)\n    end\nend\n\nwhen flag clicked\nhide\n\n@Danger\n\nwhen I receive [start v]\nshow\nforever\n    switch costume to (Level)\n    go to [back v] layer\n    go to x: (-1) y: (-21)\nend\n\nwhen flag clicked\nhide\n\n@Enemy\n\nwhen I start as a clone\nset [x v] to [0]\nset [y v] to [0]\ngo to [front v] layer\nset size to (55) %\nshow\nforever\n    change [y v] by (-1)\n    if <([x position v] of [player v]) < ((x position) - (10))> then\n        change [x v] by (-.5)\n        point in direction (-90)\n    end\n    if <((x position) - (-10)) < ([x position v] of [player v])> then\n        change [x v] by (.5)\n        point in direction (90)\n    end\n    set [x v] to ((x) * (0.9))\n    change x by (x)\n    if <touching (platform v)?> then\n        change y by (1)\n        if <touching (platform v)?> then\n            change y by (1)\n            if <touching (platform v)?> then\n                change y by (1)\n                if <touching (platform v)?> then\n                    change y by (1)\n                    if <touching (platform v)?> then\n                        change y by (-3)\n                        change x by ((x) * (-1))\n                        if <(y position) < ([x position v] of [player v])> then\n                            if <(x) > [0]> then\n                                set [x v] to [-5]\n                            else\n                                set [x v] to [5]\n                            end\n                            set [y v] to [12]\n                        else\n                            set [x v] to [0]\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (y)\n    if <touching (platform v)?> then\n        change y by ((y) - ((y) * (2)))\n        set [y v] to [0]\n    end\n    change y by (-1)\nend\n\nwhen flag clicked\nhide\n\ndefine Create A Clone at x: (x) y: (y)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\n\nwhen I receive [reset v]\ndelete this clone\n\nwhen I receive [setup v]\nif <(Level) = [8]> then\n    Create A Clone at x: [207] y: [-130]\nend\nif <(Level) = [9]> then\n    Create A Clone at x: [-7] y: [-130]\nend\nif <(Level) = [10]> then\n    Create A Clone at x: [87] y: [-130]\nend\nif <(Level) = [14]> then\n    Create A Clone at x: [-16] y: [32]\n    Create A Clone at x: [217] y: [-36]\nend\nif <(Level) = [15]> then\n    Create A Clone at x: [134] y: [-77]\nend\nif <(Level) = [16]> then\n    Create A Clone at x: [-210] y: [15]\n    Create A Clone at x: [47] y: [-62]\n    Create A Clone at x: [187] y: [53]\nend\nif <(Level) = [20]> then\n    Create A Clone at x: [173] y: [-128]\nend\n\nwhen I start as a clone\nforever\n    if <touching (danger v)?> then\n        wait (0.05) seconds\n        delete this clone\n    end\nend\n\n@Deco\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nshow\nforever\n    go to x: (0) y: (0)\n    switch costume to (Level)\nend\n\n@Thumbnail\n\nwhen flag clicked\nforever\n    go to [front v] layer\n    set [ghost v] effect to (100)\n    go to x: (0) y: (0)\n    show\nend\n\n@Volume\n\nwhen flag clicked\nset [volume v] to [2]\nset size to (60) %\nforever\n    go to x: (-215) y: (158)\n    if <(volume) = [0]> then\n        switch costume to (2 v)\n    end\n    if <(volume) = [2]> then\n        switch costume to (1 v)\n    end\n    if <touching (mouse-pointer v)?> then\n        if <(size) < [70]> then\n            change size by (2)\n        end\n        if <<mouse down?> and <(volume) = [0]>> then\n            set [volume v] to [2]\n            wait until <not <mouse down?>>\n        end\n        if <<mouse down?> and <(volume) = [2]>> then\n            set [volume v] to [0]\n            wait until <not <mouse down?>>\n        end\n    else\n        if <(size) > [60]> then\n            change size by (-2)\n        end\n    end\nend\n\n@Skip\n\nwhen flag clicked\nset [volume v] to [2]\nset size to (60) %\nforever\n    go to x: (195) y: (-158)\n    if <touching (mouse-pointer v)?> then\n        if <(size) < [64]> then\n            change size by (2)\n        end\n        if <mouse down?> then\n            broadcast (Next v)\n            wait until <not <mouse down?>>\n        end\n    else\n        if <(size) > [60]> then\n            change size by (-2)\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <not <(Level) = [21]>> then\n        show\n    else\n        hide\n        stop [other scripts in sprite v]\n        stop [this script v]\n    end\nend\n\n