Escape Room Platformer

Instructions: ~~~~~~~~~~~ ❓ HOW TO PLAY ❓ ~~~~~~~~~~~\nComputer: Use the arrow keys to walk and jump.\nPhone/Tablet: I am working on making it mobile friendly.\nYou can do walljumps!\n\n~~~~~~~~~~~~ ✔ OBJECTIVE ✔ ~~~~~~~~~~~~\nThe objective of the game is to make it through the labyrinth to the end. (Note: I will add a final level soon)\n\n~~~~~~~~ ℹ️ FULLSCREEN MODE ℹ️ ~~~~~~~~\nUse the fullscreen mode to play the game at its full potential but it's only recommended on a computer, due to its speed and animations display.

@Stage\n\nwhen flag clicked\nswitch backdrop to (title v)\nwait (0) seconds\nswitch backdrop to (background1 v)\n\nwhen I receive [right v]\nnext backdrop\n\nwhen flag clicked\nset [timer v] to [0]\nset [end v] to [0]\nwait (0) seconds\nrepeat until <(End) > [0]>\n    wait (1) seconds\n    change [timer v] by (1)\nend\nforever\n    if <(End) > [0]> then\n        stop [this script v]\n    end\nend\n\nwhen I receive [end v]\nforever\n    show variable [deaths v]\n    show variable [timer v]\n    hide variable [level v]\nend\n\nwhen I receive [end v]\nhide variable [deaths v]\nhide variable [timer v]\nstop [other scripts in stage v]\n\nwhen flag clicked\nforever\n    \n        change [end v] by (1)\n        broadcast (end v)\n        stop [this script v]\n    end\nend\n\nwhen flag clicked\nforever\n    \n        show variable [timer v]\n        show variable [deaths v]\n    else\n        hide variable [deaths v]\n        hide variable [timer v]\n    end\nend\n\n@Player\n\nwhen flag clicked\nforever\n    if <(x position) > [238]> then\n        broadcast (right v)\n        change [room x v] by (1)\n    end\n    if <(x position) < [-232]> then\n        broadcast (left v)\n        change [room x v] by (-1)\n    end\n    if <(y position) > [170]> then\n        broadcast (up v)\n        change [room y v] by (1)\n    end\n    if <(y position) < [-175]> then\n        broadcast (down v)\n        change [room y v] by (-1)\n    end\nend\n\nwhen flag clicked\nforever\n    if <key (r v) pressed?> then\n        set [grapplemode v] to [0]\n        set [xv v] to [0]\n        set [yv v] to [0]\n        go to x: (Respawn X) y: (Respawn Y)\n    end\nend\n\nwhen I start as a clone\nrepeat (5)\n    change [ghost v] effect by (20)\nend\ndelete this clone\n\nwhen flag clicked\nforever\n    play sound [TheFatRat - Unity \(Instrumental\) v] until done\nend\n\nwhen I receive [up v]\nbroadcast (next level v)\nset [respawn x v] to (x position)\nset [respawn y v] to [-160]\ngo to x: (Respawn X) y: (Respawn Y)\n\nwhen I receive [down v]\nbroadcast (next level v)\nset [respawn x v] to (x position)\nset [respawn y v] to [160]\ngo to x: (Respawn X) y: (Respawn Y)\n\ndefine Go to Grapple Position\npen up\nerase all\npoint towards (sprite2 v)\nturn right (180) degrees\ngo to (sprite2 v)\npen down\nmove (O) steps\npen up\n\nwhen flag clicked\ngo to x: (-180) y: (-109)\nset pen color to (#995900)\nerase all\npen up\n\ndefine Move Grapple X (x)\npoint towards (sprite2 v)\nturn right (90) degrees\nmove (x) steps\nGo to Grapple Position\n\nwhen I receive [right v]\nbroadcast (next level v)\nset [respawn x v] to [-220]\nset [respawn y v] to (y position)\ngo to x: (Respawn X) y: (Respawn Y)\n\nwhen flag clicked\nhide variable [deaths v]\nhide variable [timer v]\nshow variable [level v]\n\nwhen flag clicked\nrepeat until <(End) > [0]>\n    hide variable [timer v]\nend\n\nwhen flag clicked\nforever\n    if <touching color (#ff9400)?> then\n        set [grapplemode v] to [0]\n        change [deaths v] by (1)\n        set [xv v] to [0]\n        set [yv v] to [0]\n        go to x: (Respawn X) y: (Respawn Y)\n    end\nend\n\nwhen I receive [left v]\nbroadcast (next level v)\nset [respawn x v] to [230]\nset [respawn y v] to (y position)\ngo to x: (Respawn X) y: (Respawn Y)\n\nwhen flag clicked\nset [r v] to [100]\nset [acceleration v] to [0]\nset [o v] to [180]\nset [grapplemode v] to [0]\nset [xv v] to [0]\nset [yv v] to [0]\nset [deaths v] to [0]\nset [level v] to [1]\nset [playing v] to [1]\nset [xv v] to [0]\nset [yv v] to [0]\nset [deaths v] to [0]\nset [level v] to [1]\nset [direction v] to [0]\nhide\nshow\nforever\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        change [xv v] by (1)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change [xv v] by (-1)\n    end\n    set [xv v] to ((Xv) * (0.9))\n    Change X by (Xv)\n    if <touching color (#666666)?> then\n        Change Y by (1)\n        if <touching color (#666666)?> then\n            Change Y by (1)\n            if <touching color (#666666)?> then\n                Change Y by (1)\n                if <touching color (#666666)?> then\n                    Change Y by (1)\n                    if <touching color (#666666)?> then\n                        Change Y by (1)\n                        if <touching color (#666666)?> then\n                            Change X by ((Xv) * (-1))\n                            Change Y by (-5)\n                            if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                                if <(Xv) > [0]> then\n                                    set [xv v] to [-5]\n                                else\n                                    set [xv v] to [5]\n                                end\n                                set [yv v] to [10]\n                            else\n                                set [xv v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    if <touching color (#003fff)?> then\n        set [yv v] to [20]\n    end\n    change [yv v] by (-1)\n    Change Y by (Yv)\n    if <touching color (#666666)?> then\n        Change Y by ((Yv) * (-1))\n        set [yv v] to [0]\n    end\n    Change Y by (-1)\n    if <touching color (#666666)?> then\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            set [yv v] to [15]\n        end\n    end\n    Change Y by (1)\nend\n\nwhen flag clicked\nforever\n    if <touching color (#00ff55)?> then\n        set [direction v] to [0]\n    end\n    if <touching color (#00ffff)?> then\n        set [direction v] to [180]\n    end\n    if <touching color (#ff00bf)?> then\n        set [direction v] to [-90]\n    end\n    if <touching color (#7f00ff)?> then\n        set [direction v] to [90]\n    end\nend\n\ndefine Change X by (x)\npoint in direction ((Direction) + (90))\nmove (x) steps\npoint in direction (Direction)\n\ndefine Change Y by (y)\npoint in direction (Direction)\nmove (y) steps\n\nwhen flag clicked\nforever\n    if <touching color (#00ff55)?> then\n        set [direction v] to [0]\n    end\n    if <touching color (#00ffff)?> then\n        set [direction v] to [180]\n    end\n    if <touching color (#ff00bf)?> then\n        set [direction v] to [-90]\n    end\n    if <touching color (#7f00ff)?> then\n        set [direction v] to [90]\n    end\nend\n\nhide\nwait (0) seconds\nshow\nforever\n    if <(playing) = [1]> then\n        if <(GrappleMode) = [0]> then\n            pen up\n            if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n                change [xv v] by (1)\n            end\n            if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n                change [xv v] by (-1)\n            end\n            set [xv v] to ((Xv) * (0.9))\n            change x by (Xv)\n            if <touching color (#666666)?> then\n                change y by (1)\n                if <touching color (#666666)?> then\n                    change y by (1)\n                    if <touching color (#666666)?> then\n                        change y by (1)\n                        if <touching color (#666666)?> then\n                            change y by (1)\n                            if <touching color (#666666)?> then\n                                change y by (1)\n                                if <touching color (#666666)?> then\n                                    change x by ((Xv) * (-1))\n                                    change y by (-5)\n                                    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                                        if <(Xv) > [0]> then\n                                            set [xv v] to [-12]\n                                        else\n                                            set [xv v] to [12]\n                                        end\n                                        set [yv v] to [9]\n                                    else\n                                        set [xv v] to [0]\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n            if <touching color (#003fff)?> then\n                set [yv v] to [20]\n            end\n            change [yv v] by (-1)\n            change y by (Yv)\n            if <touching color (#666666)?> then\n                change y by ((Yv) * (-1))\n                set [yv v] to [0]\n            end\n            change y by (-1)\n            if <touching color (#666666)?> then\n                if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                    set [yv v] to [15]\n                end\n            end\n            change y by (1)\n        else\n            erase all\n            set [prevx v] to (x position)\n            set [prevy v] to (y position)\n            Go to Grapple Position\n            if <<key (down arrow v) pressed?> or <key (s v) pressed?>> then\n                change [o v] by (5)\n                Go to Grapple Position\n                if <touching color (#666666)?> then\n                    change [o v] by (-5)\n                end\n            end\n            if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                change [o v] by (-5)\n                Go to Grapple Position\n                if <touching color (#666666)?> then\n                    change [o v] by (5)\n                end\n            end\n            if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n                change [xv v] by (2)\n            end\n            if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n                change [xv v] by (-2)\n            end\n            change [xv v] by (([abs v] of (direction) ) / ((0) - (direction)))\n            if <(Xv) > [20]> then\n                set [xv v] to [20]\n            end\n            if <(Xv) < [-20]> then\n                set [xv v] to [-20]\n            end\n            Move Grapple X (Xv)\n            if <touching color (#666666)?> then\n                Move Grapple X (() - (Xv))\n                set [xv v] to [0]\n            end\n            set [xv v] to ((x position) - (PrevX))\n            set [yv v] to ((y position) - (PrevY))\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching color (#ff0000)?> then\n        go to x: (Respawn X) y: (Respawn Y)\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching color (#9059ff)?> then\n        say [Too Be Continued...]\n    end\nend\n\n@signs\n\nwhen flag clicked\nhide\nAdd Sign at area (1) (1) at position (75) (-127) with message [Welcome to Escape Room Platform Base]\nAdd Sign at area (3) (1) at position (150) (-127) with message [Going Up?]\nAdd Sign at area (2) (2) at position (90) (-120) with message [Can you make the jump?]\nAdd Sign at area (2) (2) at position (-80) (-120) with message [You made it!]\nAdd Sign at area (2) (1) at position (-180) (-127) with message [The Password is 4321]\n\ndefine Add Sign at area (room x) (room y) at position (x) (y) with message (message)\nset [roomx v] to (room x)\nset [roomy v] to (room y)\nset [message v] to (message)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nforever\n    go [backward v] (100) layers\n    if <<(Room X) = (roomx)> and <(Room Y) = (roomy)>> then\n        show\n        if <touching (player v)?> then\n            say (message)\n        else\n            say []\n        end\n    else\n        hide\n    end\nend\n\n@keys\n\nwhen flag clicked\ndelete (all) of [keys collected v]\nhide\nAdd Key at area (3) (1) at position (-40) (-50) with id (1)\nAdd Key at area (1) (3) at position (160) (-140) with id (2)\nAdd Key at area (1) (1) at position (-170) (10) with id (3)\nAdd Key at area (2) (1) at position (-20) (-30) with id (4)\n\ndefine None\nset [roomx v] to (room x)\nset [roomy v] to (room y)\nset [id v] to (id)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nforever\n    go [backward v] (100) layers\n    if <<not <[keys collected v] contains (id)?>> and <<(Room X) = (roomx)> and <(Room Y) = (roomy)>>> then\n        show\n        if <touching (player v)?> then\n            add (id) to [keys collected v]\n        end\n    else\n        hide\n    end\nend\n\n@doors\n\nwhen flag clicked\nhide\npoint in direction (90)\nAdd Door at area (3) (1) at position (85) (-122) with id (1)\nAdd Door at area (2) (3) at position (50) (90) with id (2)\nAdd Door at area (2) (3) at position (50) (20) with id (2)\nAdd Door at area (2) (1) at position (-146) (-120) with id (4)\npoint in direction (180)\nAdd Door at area (1) (1) at position (-75) (-115) with id (3)\n\ndefine None\nset [roomx v] to (room x)\nset [roomy v] to (room y)\nset [id v] to (id)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nforever\n    go [backward v] (100) layers\n    if <<not <[keys collected v] contains (id)?>> and <<(Room X) = (roomx)> and <(Room Y) = (roomy)>>> then\n        show\n    else\n        hide\n    end\nend\n\n@password doors\n\ndefine None\nset [roomx v] to (room x)\nset [roomy v] to (room y)\nset [id v] to (id)\nset [password v] to (password)\ngo to x: (x) y: (y)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nforever\n    go [backward v] (100) layers\n    if <<not <[password doors opened v] contains (id)?>> and <<(Room X) = (roomx)> and <(Room Y) = (roomy)>>> then\n        show\n        if <touching (player v)?> then\n            say [type <space> to enter password]\n            if <key (space v) pressed?> then\n                set [playing v] to [0]\n                ask [What is the password?] and wait\n                if <(answer) = (password)> then\n                    say [Correct] for (0.5) seconds\n                    add (id) to [password doors opened v]\n                else\n                    say [Incorrect] for (0.5) seconds\n                end\n                set [playing v] to [1]\n            end\n        else\n            say []\n        end\n    else\n        hide\n    end\nend\n\nwhen flag clicked\ndelete (all) of [password doors opened v]\nhide\nAdd Door at area (2) (1) at position (229) (-121) with id (1) and password [4321]\n\n@Sprite2\n\nwhen flag clicked\nhide\n\nwhen I receive [next level v]\nif <(GrappleMode) = [1]> then\n    set [grapplemode v] to [0]\n    set [xv v] to [0]\n    set [yv v] to [0]\nend\n\nwhen I receive [grappling hook collected v]\nshow\nset [grapplemode v] to [0]\nforever\n    if <(GrappleMode) = [0]> then\n        go to (mouse-pointer v)\n        if <<touching color (#666666)?> and <mouse down?>> then\n            set [grapplemode v] to [1]\n            set [o v] to (distance to [player v])\n            set [xv v] to [0]\n            wait until <not <mouse down?>>\n        end\n    else\n        if <mouse down?> then\n            go to (mouse-pointer v)\n            if <touching color (#666666)?> then\n                set [grapplemode v] to [1]\n                set [o v] to (distance to [player v])\n                set [xv v] to [0]\n            else\n                erase all\n                set [grapplemode v] to [0]\n                set [yv v] to [0]\n                set [xv v] to [0]\n            end\n            wait until <not <mouse down?>>\n        end\n    end\n    if <key (space v) pressed?> then\n        erase all\n        set [grapplemode v] to [0]\n    end\nend\n\n@Sprite3\n\nwhen flag clicked\nset size to (50) %\nforever\n    go to x: (-20) y: (150)\n    if  then\n        show\n        if <touching (player v)?> then\n            broadcast (Grappling Hook Collected v)\n            hide\n            stop [this script v]\n        end\n    else\n        hide\n    end\nend\n\n@Sprite5\n\nwhen flag clicked\nset size to (50) %\nforever\n    go to x: (-17) y: (-145)\n    if <<(Room X) = [3]> and <(Room Y) = [3]>> then\n        show\n        if <touching (player v)?> then\n            broadcast (Minigun Collected v)\n            hide\n            stop [this script v]\n        end\n    else\n        hide\n    end\nend\n\n@Sprite6\n\nwhen flag clicked\nset size to (50) %\nhide\n\nwhen I start as a clone\ngo to (player v)\npoint towards (mouse-pointer v)\nturn right (pick random (-5) to (5)) degrees\nshow\nrepeat until <<touching (sprite1 v)?> or <touching (_edge_ v)?>>\n    if <(direction) > [0]> then\n        turn right (3) degrees\n    else\n        turn left (3) degrees\n    end\n    move (10) steps\nend\nrepeat (4)\n    change [ghost v] effect by (20)\nend\ndelete this clone\n\nwhen I receive [minigun collected v]\nrepeat until \n    if <key (q v) pressed?> then\n        clear graphic effects\n        create clone of (_myself_ v)\n        wait (0..2) seconds\n    end\nend\n\n@Sprite4\n\nwhen I start as a clone\npen up\ngo to (player v)\npoint towards (mouse-pointer v)\nshow\nrepeat until <<touching (sprite1 v)?> or <touching (_edge_ v)?>>\n    if <(direction) > [0]> then\n        turn right (2) degrees\n    else\n        turn left (2) degrees\n    end\n    move (15) steps\nend\nrepeat (4)\n    change [ghost v] effect by (20)\nend\ndelete this clone\n\ndefine Aim\nerase all\nhide\npen up\ngo to (player v)\npoint towards (mouse-pointer v)\npen down\nrepeat until <<touching (sprite1 v)?> or <touching (_edge_ v)?>>\n    if <(direction) > [0]> then\n        turn right (2) degrees\n    else\n        turn left (2) degrees\n    end\n    move (15) steps\nend\n\nwhen flag clicked\nset size to (50) %\nhide\n\nwhen I receive [sniper collected v]\nrepeat until \n    if <key (e v) pressed?> then\n        erase all\n        clear graphic effects\n        create clone of (_myself_ v)\n        wait (0.6) seconds\n    else\n        Aim\n    end\nend\n\n@Sprite7\n\nwhen flag clicked\nset size to (50) %\nforever\n    go to x: (-17) y: (-70)\n    if <<(Room X) = [3]> and <(Room Y) = [3]>> then\n        show\n        if <touching (player v)?> then\n            broadcast (sniper collected v)\n            hide\n            stop [this script v]\n        end\n    else\n        hide\n    end\nend\n\n@Sprite1\n\nwhen flag clicked\nset [room x v] to [1]\nset [room y v] to [1]\nforever\n    go to x: (0) y: (0)\n    set [level v] to (join (Room X) (join [-] (Room Y)))\n    switch costume to (Level)\nend\n\n