-Alone- [Platformer]- The Caves
@Stage\n\nwhen flag clicked\nswitch backdrop to (intro v)\n\nwhen I receive [play2 v]\nforever\n    switch backdrop to (lvl)\nend\n\nwhen I receive [instructions v]\nswitch backdrop to (last v)\n\nwhen I receive [i done v]\nswitch backdrop to (intro v)\n\n@player\n\nwhen flag clicked\nset [lvl v] to [0]\nhide\n\nwhen I receive [play2 v]\nwait (1) seconds\nset [death\(s\): v] to [0]\nset [g/b v] to [g]\ngo to x: (-224) y: (-50)\npoint in direction (90)\nset [level v] to [1]\nshow\nforever\n    go to [front v] layer\n    switch costume to (hitbox v)\n    if <<key (d v) pressed?> or <key (right arrow v) pressed?>> then\n        change [x vel v] by (0.7)\n    end\n    if <<key (a v) pressed?> or <key (left arrow v) pressed?>> then\n        change [x vel v] by (-0.7)\n    end\n    if <key (z v) pressed?> then\n        show variable [death\(s\): v]\n    else\n        hide variable [death\(s\): v]\n    end\n    set [x vel v] to ((X vel) * (0.9))\n    change x by (X vel)\n    Main\n    change y by (Y vel)\n    if <touching color (#25001e)?> then\n        change y by ((Y vel) * (-1))\n        set [y vel v] to [0]\n    end\n    change y by (-1)\n    lever\n    if <touching color (#388fff)?> then\n        if <<<key (space v) pressed?> or <key (w v) pressed?>> or <key (up arrow v) pressed?>> then\n            set [y vel v] to [3]\n        else\n            set [y vel v] to [-1]\n        end\n    end\n    retry\n    if <<touching color (#1f001b)?> or <<touching color (#ff1c0d)?> or <<touching (gear v)?> or <touching (falling spikes v)?>>>> then\n        change [death\(s\): v] by (1)\n        set [y vel v] to [0]\n        set [g/b v] to [g]\n        point in direction (90)\n        if <(lvl) = [2]> then\n            go to x: (-225) y: (-85)\n        end\n        if <(lvl) = [3]> then\n            go to x: (-223) y: (-100)\n        end\n        if <(lvl) = [4]> then\n            go to x: (-218) y: (-101)\n        end\n        if <(lvl) = [5]> then\n            go to x: (-222) y: (-109)\n        end\n        if <(lvl) = [6]> then\n            go to x: (-202) y: (-93)\n        end\n        if <(lvl) = [7]> then\n            go to x: (-223) y: (35)\n        end\n        if <(lvl) = [8]> then\n            go to x: (-223) y: (19)\n        end\n        if <(lvl) = [9]> then\n            go to x: (46) y: (166)\n        end\n        if <(lvl) = [10]> then\n            go to x: (-144) y: (163)\n        end\n        if <(lvl) = [11]> then\n            go to x: (-176) y: (-163)\n        end\n        if <(lvl) = [12]> then\n            go to x: (-55) y: (-165)\n        end\n        if <(lvl) = [13]> then\n            go to x: (-225) y: (-7)\n        end\n        if <(lvl) = [14]> then\n            go to x: (-224) y: (-132)\n        end\n        if <(lvl) = [15]> then\n            go to x: (-224) y: (-122)\n        end\n    end\n    GREEN/BLUE\n    end\n    switch costume to (player v)\nend\n\ndefine Main\nif <touching color (#25001e)?> then\n    change y by (1)\n    if <touching color (#25001e)?> then\n        change y by (1)\n        if <touching color (#25001e)?> then\n            change y by (1)\n            if <touching color (#25001e)?> then\n                change y by (1)\n                if <touching color (#25001e)?> then\n                    change y by (1)\n                    if <touching color (#25001e)?> then\n                        change x by ((X vel) * (-1))\n                        change x by (-1)\n                        change y by (-5)\n                        change x by (1)\n                        if <<<key (w v) pressed?> or <key (space v) pressed?>> or <key (up arrow v) pressed?>> then\n                            if <(X vel) > [0]> then\n                                set [x vel v] to [-8]\n                            else\n                                set [x vel v] to [8]\n                            end\n                            set [y vel v] to [8]\n                        else\n                            set [x vel v] to [0]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I receive [play v]\nset [lvl v] to [1]\nif <(lvl) = [1]> then\n    go to x: (-220) y: (-30)\nend\nforever\n    if <<(y position) = [-180]> and <(lvl) = [5]>> then\n        change [lvl v] by (1)\n        broadcast (new lvl v)\n        go to x: (-212) y: (155)\n    end\n    if <<(x position) > [236]> or <touching (next lvl v)?>> then\n        change [lvl v] by (1)\n        broadcast (new lvl v)\n        if <(lvl) = [2]> then\n            go to x: (-225) y: (-85)\n        end\n        if <(lvl) = [3]> then\n            go to x: (-223) y: (-100)\n        end\n        if <(lvl) = [4]> then\n            go to x: (-218) y: (-101)\n        end\n        if <(lvl) = [5]> then\n            go to x: (-222) y: (-109)\n        end\n        if <(lvl) = [6]> then\n            go to x: (-202) y: (-93)\n        end\n        if <(lvl) = [7]> then\n            go to x: (-223) y: (35)\n        end\n        if <(lvl) = [8]> then\n            go to x: (-223) y: (19)\n        end\n        if <(lvl) = [9]> then\n            go to x: (46) y: (166)\n        end\n        if <(lvl) = [10]> then\n            go to x: (-144) y: (163)\n        end\n        if <(lvl) = [11]> then\n            go to x: (-176) y: (-163)\n        end\n        if <(lvl) = [12]> then\n            go to x: (-55) y: (-165)\n        end\n        if <(lvl) = [13]> then\n            go to x: (-225) y: (-7)\n        end\n        if <(lvl) = [14]> then\n            go to x: (-224) y: (-132)\n        end\n        if <(lvl) = [15]> then\n            go to x: (-224) y: (-122)\n        end\n        if <(lvl) = [16]> then\n            hide\n            broadcast (white out v)\n            go to x: (-224) y: (-122)\n        end\n    else\n        change [lvl v] by (0)\n    end\nend\n\ndefine GREEN/BLUE\nif <<touching color (#25001e)?> or <touching color (#34002e)?>> then\n    if <<<key (w v) pressed?> or <key (space v) pressed?>> or <key (up arrow v) pressed?>> then\n        if <(g/b) = [b]> then\n            set [y vel v] to [-6]\n        else\n            set [y vel v] to [8]\n        end\n    end\nend\nif <touching color (#2e89ff)?> then\n    set [g/b v] to [b]\n    point in direction (-90)\nelse\n    if <touching color (#8bdb24)?> then\n        set [g/b v] to [g]\n        point in direction (90)\n    end\nend\nif <(g/b) = [b]> then\n    change [y vel v] by (0.5)\nelse\n    change [y vel v] by (-0.5)\nend\n\ndefine lever\nif <<touching (lever v)?> and <key (e v) pressed?>> then\n    set [lever v] to [1]\nend\n\ndefine retry\nif <key (r v) pressed?> then\n    point in direction (90)\n    set [y vel v] to [0]\n    set [g/b v] to [g]\n    if <(lvl) = [2]> then\n        go to x: (-225) y: (-85)\n    end\n    if <(lvl) = [3]> then\n        go to x: (-223) y: (-100)\n    end\n    if <(lvl) = [4]> then\n        go to x: (-218) y: (-101)\n    end\n    if <(lvl) = [5]> then\n        go to x: (-222) y: (-109)\n    end\n    if <(lvl) = [6]> then\n        go to x: (-202) y: (-93)\n    end\n    if <(lvl) = [7]> then\n        go to x: (-223) y: (35)\n    end\n    if <(lvl) = [8]> then\n        go to x: (-223) y: (19)\n    end\n    if <(lvl) = [9]> then\n        go to x: (46) y: (166)\n    end\n    if <(lvl) = [10]> then\n        go to x: (-144) y: (163)\n    end\n    if <(lvl) = [11]> then\n        go to x: (-176) y: (-163)\n    end\n    if <(lvl) = [12]> then\n        go to x: (-55) y: (-165)\n    end\n    if <(lvl) = [13]> then\n        go to x: (-225) y: (-7)\n    end\n    if <(lvl) = [14]> then\n        go to x: (-224) y: (-132)\n    end\n    if <(lvl) = [15]> then\n        go to x: (-224) y: (-122)\n    end\nend\n\ndefine end\n\nset [lvl v] to [15]\n\nif <(lvl) = [16]> then\n    end\nend\n\n@intro\n\nwhen flag clicked\nforever\n    change y by (y)\nend\n\nwhen I receive [i done v]\nshow\n\nwhen I receive [instructions v]\nhide\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset volume to (100) %\nstart sound [Avicii - Levels v]\nset [y v] to [0]\nshow\nwait (2) seconds\nrepeat (5)\n    wait (3) seconds\n    change [y v] by (1.1)\nend\nrepeat until <(y) = [0]>\n    change [y v] by (-1.1)\nend\nbroadcast (intro done v)\n\nwhen I receive [play2 v]\nrepeat (10)\n    change volume by (10)\nend\nhide\nstop all sounds\nplay sound [Vexento - Pixel Party.mp3 v] until done\nstop all sounds\nplay sound [Vexento - Pollen v] until done\nstop all sounds\n\nwhen I receive [play v]\nrepeat (20)\n    change volume by (-10)\nend\nstop all sounds\nwait (1) seconds\nhide\n\nwhen I receive [cutscene v]\nstop all sounds\nstart sound [Shards_Bit_Tildo v]\nrepeat (20)\n    change volume by (10)\nend\n\nwhen I receive [white out v]\nrepeat (20)\n    change volume by (-10)\nend\nstop all sounds\n\n@intro text\n\nwhen flag clicked\ngo to [front v] layer\nswitch costume to (welcome to v)\nshow\nset [ghost v] effect to (100)\nwait (8) seconds\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\nswitch costume to (welcome to v)\nwait (3) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nswitch costume to (ap v)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (3) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nswitch costume to (da caves v)\nwait (2) seconds\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (4) seconds\n\nwhen I receive [instructions v]\nhide\n\nwhen I receive [i done v]\nswitch costume to (main v)\nshow\n\nwhen I receive [play v]\nwait (1) seconds\nhide\n\n@i\n\nwhen flag clicked\ngo to x: (0) y: (-5)\nswitch costume to (wasd v)\nset [costume v] to [1]\ngo to x: (0) y: (0)\nhide\nforever\n    switch costume to (costume)\n    if <key (space v) pressed?> then\n        change [costume v] by (1)\n        wait (0.3) seconds\n    end\n    if <(costume) = [6]> then\n        set [tutorial? v] to [nope]\n        hide\n        broadcast (i done v)\n        stop [this script v]\n    end\nend\n\nwhen I receive [instructions v]\nshow\nrepeat until <not <(tutorial?) = [yes]>>\n    repeat until <(y position) = [10]>\n        change y by (0.5)\n    end\n    repeat until <(y position) = [-10]>\n        change y by (-0.5)\n    end\nend\n\nwhen flag clicked\nforever\n    repeat (40)\n        change y by (0.1)\n    end\n    wait (0.25) seconds\n    repeat (40)\n        change y by (-0.1)\n    end\n    wait (0.25) seconds\nend\n\n@start button\n\nwhen flag clicked\ngo to x: (0) y: (-110)\nshow\nset [ghost v] effect to (100)\n\nwhen I receive [intro done v]\ngo to [front v] layer\nshow\nswitch costume to (1 v)\nwait (3) seconds\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\nforever\n    if <touching (mouse-pointer v)?> then\n        repeat until <(size) = [115]>\n            change size by (5)\n        end\n        if <mouse down?> then\n            repeat (0)\n                change [ghost v] effect by (10)\n            end\n            broadcast (instructions v)\n            switch costume to (2 v)\n            set [tutorial? v] to [yes]\n            hide\n            stop [this script v]\n        end\n    else\n        repeat until <(size) = [100]>\n            change size by (-5)\n        end\n    end\nend\n\nwhen I receive [i done v]\nset [tutorial? v] to [no]\nshow\nset [ghost v] effect to (0)\nforever\n    if <touching (mouse-pointer v)?> then\n        repeat until <(size) = [115]>\n            change size by (5)\n        end\n        if <mouse down?> then\n            repeat (0)\n                change [ghost v] effect by (10)\n            end\n            broadcast (play v)\n            hide\n            stop [this script v]\n        end\n    else\n        repeat until <(size) = [100]>\n            change size by (-5)\n        end\n    end\nend\n\n@Sprite1\n\nwhen flag clicked\ngo to x: (0) y: (0)\nshow\ngo to [front v] layer\ngo [backward v] (1) layers\n\nwhen I receive [instructions v]\nhide\n\nwhen I receive [i done v]\nshow\n\nwhen I receive [play2 v]\nhide\n\n@level\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [play2 v]\nshow\nswitch costume to (1 v)\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (2) seconds\nrepeat (5)\n    change [ghost v] effect by (20)\nend\n\nwhen I receive [new lvl v]\ngo to [front v] layer\nswitch costume to (lvl)\nset [ghost v] effect to (100)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (2) seconds\nrepeat (5)\n    change [ghost v] effect by (20)\nend\n\nwhen I receive [white out v]\nhide\n\n@falling spikes\n\nwhen I start as a clone\ngo to [front v] layer\nshow\nrepeat until <touching (void v)?>\n    change y by (-8)\nend\ndelete this clone\n\nwhen flag clicked\nhide\n\nwhen I receive [play v]\nforever\n    if <(lvl) = [3]> then\n        wait (0.2) seconds\n        go to x: (pick random (-211) to (211)) y: (118)\n        create clone of (_myself_ v)\n    else\n        if <(lvl) = [4]> then\n            wait (0.5) seconds\n            go to x: (pick random (-211) to (108)) y: (118)\n            create clone of (_myself_ v)\n        end\n        if <(lvl) = [5]> then\n            wait (0.5) seconds\n            go to x: (pick random (-211) to (80)) y: (118)\n            create clone of (_myself_ v)\n        end\n    end\nend\n\nwhen I receive [new lvl v]\ndelete this clone\n\n@lvl5 falling ground\n\nwhen flag clicked\nforever\n    if <(lvl) = [5]> then\n        show\n        if <touching (player v)?> then\n            wait (0.4) seconds\n            repeat (4)\n                change y by (1)\n                wait (0.1) seconds\n                change y by (-1)\n                wait (0.1) seconds\n            end\n            hide\n            stop [this script v]\n        end\n    else\n        hide\n    end\nend\n\n@flame particles 1\n\nwhen flag clicked\nhide\nset [ghost v] effect to (70)\nforever\n    if <(lvl) = [6]> then\n        wait (0.3) seconds\n        go to x: (pick random (-146) to (-44)) y: (-148)\n        switch costume to (pick random (1) to (2))\n        create clone of (_myself_ v)\n    else\n        if <(lvl) = [7]> then\n            wait (0.2) seconds\n            go to x: (pick random (-160) to (115)) y: (-148)\n            switch costume to (pick random (1) to (2))\n            create clone of (_myself_ v)\n        end\n    end\nend\n\nwhen I start as a clone\nshow\nrepeat (30)\n    change y by (1)\n    change [ghost v] effect by (1)\nend\ndelete this clone\n\n@flame particles 2\n\nwhen flag clicked\nset [ghost v] effect to (70)\nhide\nforever\n    if <(lvl) = [6]> then\n        wait (0.3) seconds\n        go to x: (pick random (88) to (189)) y: (-148)\n        switch costume to (pick random (1) to (2))\n        create clone of (_myself_ v)\n    else\n    end\nend\n\nwhen I start as a clone\nshow\nrepeat (30)\n    change y by (1)\n    change [ghost v] effect by (1)\nend\ndelete this clone\n\n@wall (lvl 8)1\n\nwhen flag clicked\ngo to x: (111) y: (60)\nforever\n    if <(lvl) = [8]> then\n        show\n    else\n        if <(lvl) = [12]> then\n            show\n            wait (1) seconds\n            repeat until <(y position) = [116]>\n                change y by (0.5)\n            end\n        else\n            hide\n        end\n    end\nend\n\n@wall (lvl 8)2\n\nwhen flag clicked\ngo to x: (113) y: (64)\nforever\n    if <(lvl) = [8]> then\n        show\n    else\n        if <(lvl) = [12]> then\n            show\n            wait (1) seconds\n            repeat until <(y position) = [17]>\n                change y by (-0.5)\n            end\n        else\n            hide\n        end\n    end\nend\n\n@next lvl\n\nwhen flag clicked\ngo to x: (0) y: (0)\nset [ghost v] effect to (98)\nhide\nforever\n    if <(lvl) = [8]> then\n        switch costume to (8 v)\n        show\n    else\n        if <(lvl) = [9]> then\n            switch costume to (9 v)\n            show\n        else\n            if <<(lvl) = [10]> and <(gates open?) = [y]>> then\n                switch costume to (10 v)\n                show\n            else\n                if <(lvl) = [11]> then\n                    switch costume to (11 v)\n                    show\n                else\n                    hide\n                end\n            end\n        end\n    end\nend\n\n@blackout\n\nwhen flag clicked\nhide\nset [ghost v] effect to (100)\ngo to x: (0) y: (0)\n\nwhen I receive [play v]\ngo to [front v] layer\nshow\nwait (0.5) seconds\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (2) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nbroadcast (play2 v)\n\n@lever\n\nwhen flag clicked\nset [lever v] to [0]\nforever\n    repeat until <not <(lvl) = [10]>>\n        point in direction (90)\n        go to x: (210) y: (-17)\n        show\n        if <(lever) = [1]> then\n            set [gates open? v] to [y]\n            switch costume to (1 v)\n        else\n            switch costume to (2 v)\n        end\n    end\n    if <(lvl) = [12]> then\n        set [lever v] to [0]\n    end\n    repeat until <not <(lvl) = [14]>>\n        point in direction (0)\n        go to x: (-21) y: (97)\n        show\n        if <(lever) = [1]> then\n            set [g.o2? v] to [y]\n            switch costume to (1 v)\n        else\n            switch costume to (2 v)\n        end\n    end\n    hide\nend\n\n@gear\n\nwhen flag clicked\nhide\n\nwhen I receive [play2 v]\nforever\n    repeat until <not <(lvl) = [14]>>\n        show\n        switch costume to (costume1 v)\n        repeat (360)\n            turn right (-1) degrees\n        end\n    end\n    hide\nend\n\nwhen flag clicked\nforever\n    if <(lvl) = [15]> then\n        hide\n        stop [other scripts in sprite v]\n    end\nend\n\n@wall (lvl 14)1\n\nwhen flag clicked\ngo to x: (162) y: (-44)\nforever\n    if <(lvl) = [14]> then\n        show\n        if <(g.o2?) = [y]> then\n            repeat until <(lvl) = [15]>\n                wait (1) seconds\n                repeat until <(y position) = [34]>\n                    change y by (2)\n                end\n            end\n        end\n    else\n        hide\n    end\nend\n\n@wall (lvl 14)2\n\nwhen flag clicked\nset [g.o2? v] to [1]\ngo to x: (165) y: (-42)\nforever\n    if <(lvl) = [14]> then\n        show\n        if <(g.o2?) = [y]> then\n            repeat until <(lvl) = [15]>\n                wait (1) seconds\n                repeat until <(y position) = [-120]>\n                    change y by (-2)\n                end\n            end\n        end\n    else\n        hide\n    end\nend\n\n@whiteout\n\nwhen flag clicked\nhide\nset [ghost v] effect to (100)\ngo to x: (0) y: (0)\n\nwhen I receive [white out v]\ngo to [front v] layer\nshow\nwait (0.5) seconds\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (2) seconds\nbroadcast (cutscene v)\nrepeat (10)\n    change [ghost v] effect by (10)\nend\ngo to [front v] layer\n\n@cutscene\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [cutscene v]\nshow\n\n@player(cutscene)\n\nwhen I receive [cutscene v]\ngo to x: (-230) y: (-75)\nstart sound [Shards_Bit_Tildo v]\nshow\nrepeat (350)\n    change x by (0.4)\n    change y by (0.2)\nend\n\nwhen flag clicked\nhide\n\n@Sprite2\n\nwhen flag clicked\ngo to x: (0) y: (118)\nhide\n\nwhen I receive [cutscene v]\nset [ghost v] effect to (100)\ngo to [front v] layer\nshow\nwait (2) seconds\nrepeat (20)\n    change [ghost v] effect by (-5)\nend\n\n@thumbnail\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nshow\n\n@stars\n\nwhen flag clicked\nhide\n\nwhen I receive [cutscene v]\nforever\n    wait (1) seconds\n    go to x: (pick random (-231) to (236)) y: (pick random (177) to (66))\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nclear graphic effects\nshow\nwait (1) seconds\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\ndelete this clone\n\n
✔If you haven't played the first part yet, check it out then come back! you would understand the story better!\nLINK: https://scratch.mit.edu/projects/172926374/\n\n✔[HEADPHONES / EARPHONES RECOMMENDED] \n\n✔Some objects from prev. level take a few seconds to disappear so kindly wait..\n\n✔Instructions are inside the game\n\n✔Hope you enjoy! took like 2 weeks of real hard work!\n(worked 4-5 hours a day)