Survive the Night a Platformer

Instructions: arrow keys to move\n\nthis uses a separate hidden sprite as the platform, which can be hidden with ghost effect, but can still be touched by other sprites.\n\nIf you liked the comedy in this game, you might also like this one:\nhttps://scratch.mit.edu/projects/92033369/\nplez check out that, and also if you like my games, why not check the collection of all the good ones! here: https://scratch.mit.edu/studios/3454332/\n\n\n\n\ndon't forget to love and fav!!!

@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\n\nwhen I receive [fold v]\nnext backdrop\n\n@Sprite2\n\nwhen flag clicked\nswitch costume to (costume 1 v)\nset size to (100) %\nset [# v] to [0]\ngo to x: (-225) y: (-100)\nshow\nsay (join (join [Hi my name is ] (username)) [ and I want to go on an adventure!])\nwait (2) seconds\nsay [Stand next to the signs to get advice, and touch the portal to advance!]\nwait (2) seconds\nsay []\nwait (2) seconds\nsay []\n\nwhen I start as a clone\nclear graphic effects\nrepeat (100)\n    change [ghost v] effect by (1)\nend\ndelete this clone\n\nwhen flag clicked\nforever\n    if <<touching color (#cc7700)?> and <<not <key (up arrow v) pressed?>> or <not <key (down arrow v) pressed?>>>> then\n        set [yv v] to [0.5]\n    end\n    if <<touching color (#cc7700)?> and <key (up arrow v) pressed?>> then\n        set [yv v] to [2.5]\n        switch costume to (costume5 v)\n    end\n    if <<touching color (#cc7700)?> and <key (down arrow v) pressed?>> then\n        set [yv v] to [-3]\n    end\nend\n\nwhen I receive [play music v]\nforever\n    start sound [Conker's Bad Fur Day Windy Overworld Theme, piano arrangement sheet music.mp3 v]\n    wait (114) seconds\nend\n\nwhen flag clicked\nforever\n    if <touching (sprite9 v)?> then\n        move (0.5) steps\n        point in direction (90)\n    end\nend\n\nwhen I receive [cheat v]\nwait (0.5) seconds\ngo to (sprite1 v)\n\nwhen flag clicked\nforever\n    if <touching color (#00ff55)?> then\n        set [yv v] to [15]\n    end\nend\n\nwhen [r v] key pressed\ngo to x: (-225) y: (-100)\n\nwhen flag clicked\nforever\n    if <touching color (#ffff00)?> then\n        set [yv v] to [20]\n    end\nend\n\nwhen flag clicked\nforever\n    go to [front v] layer\n    if <<<touching (spikes v)?> or <touching (spikes2 v)?>> or <touching (spikes 3 v)?>> then\n        repeat (10)\n            switch costume to (costume4 v)\n        end\n        go to x: (-225) y: (-100)\n        switch costume to (costume 1 v)\n    else\n        if <touching (sprite4 v)?> then\n            repeat (10)\n                switch costume to (costume4 v)\n            end\n            go to x: (-225) y: (-100)\n            switch costume to (costume 1 v)\n        else\n            if <touching (sprite1 v)?> then\n                repeat (75)\n                    change size by (-1)\n                    switch costume to (costume5 v)\n                    go to (sprite1 v)\n                    point in direction (0)\n                    move (10) steps\n                end\n                broadcast (fold v)\n            else\n                if <key (right arrow v) pressed?> then\n                    point in direction (90)\n                    switch costume to (costume2 v)\n                    wait (0.03) seconds\n                    switch costume to (costume3 v)\n                    wait (0.03) seconds\n                    switch costume to (costume1 v)\n                else\n                    if <key (left arrow v) pressed?> then\n                        point in direction (-90)\n                        switch costume to (costume2 v)\n                        wait (0.03) seconds\n                        switch costume to (costume3 v)\n                        wait (0.03) seconds\n                        switch costume to (costume1 v)\n                    else\n                        if <<key (down arrow v) pressed?> and <not <touching color (#cc7700)?>>> then\n                            repeat until <<<touching (sprite1 v)?> or <<touching color (#cc0000)?> or <<key (up arrow v) pressed?> or <<touching (spikes v)?> or <touching (spikes2 v)?>>>>> or <touching (spikes 3 v)?>>\n                                switch costume to (crouch v)\n                            end\n                            switch costume to (costume 1 v)\n                        else\n                            switch costume to (costume1 v)\n                            wait (0.1) seconds\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nset [xv v] to [0]\nset [yv v] to [0]\nwait until <(#) = [2]>\nrepeat until <(#) = [9]>\n    if <key (right arrow v) pressed?> then\n        change [xv v] by (1)\n    end\n    if <key (left arrow 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?> 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    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?> then\n            set [yv v] to [15]\n        end\n    end\n    change y by (1)\nend\nrepeat until <(#) = [12]>\n    if <key (right arrow v) pressed?> then\n        change [xv v] by (1)\n    end\n    if <key (left arrow v) pressed?> then\n        change [xv v] by (-1)\n    end\n    set [xv v] to ((Xv) * (0.9))\n    change x by (Xv)\nend\nrepeat until <(backdrop [name v]) = [backdrop4]>\n    if <key (right arrow v) pressed?> then\n        change [xv v] by (1)\n    end\n    if <key (left arrow 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    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?> then\n            set [yv v] to [15]\n        end\n    end\n    change y by (1)\nend\nrepeat until <(backdrop [name v]) = [backdrop5]>\n    if <key (right arrow v) pressed?> then\n        change [xv v] by (1)\n    end\n    if <key (left arrow 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                    end\n                end\n            end\n        end\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?> then\n            set [yv v] to [15]\n        end\n    end\n    change y by (1)\nend\nforever\n    if <key (right arrow v) pressed?> then\n        change [xv v] by (1)\n    end\n    if <key (left arrow 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?> 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    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?> then\n            set [yv v] to [15]\n        end\n    end\n    change y by (1)\nend\n\nwhen flag clicked\nchange size by (100)\nset [ghost v] effect to (0)\n\ndefine say []\nset [say v] to []\nrepeat (length of (string1))\n    set [say v] to (join (say) (letter ((length of (say)) + (1)) of (string1)))\n    say (say)\nend\nbroadcast (message1 v) and wait\nchange [# v] by (1)\n\nwhen I receive [fold v]\nswitch costume to (costume 1 v)\nchange [level v] by (1)\nchange size by (75)\nset [yv v] to [0]\nset [yv v] to [0]\ngo to x: (-225) y: (-100)\n\n@rightHitTest\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    hide\n    go to (sprite2 v)\n    if <touching color (#00ff52)?> then\n        set [hittest v] to [1]\n    else\n        set [hittest v] to [0]\n    end\nend\n\n@leftHitTest\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    go to (sprite2 v)\n    if <touching color (#00ff52)?> then\n        set [hittest v] to [1]\n    else\n        set [hittest v] to [0]\n    end\nend\n\n@Sprite1\n\nwhen flag clicked\nshow\nforever\n    next costume\n    wait (1) seconds\nend\n\nwhen flag clicked\ngo to x: (204) y: (-147)\n\nwhen backdrop switches to [backdrop2 v]\ngo to x: (204) y: (126)\n\nwhen backdrop switches to [backdrop4 v]\ngo to x: (194) y: (-107)\n\nwhen backdrop switches to [backdrop6 v]\ngo to x: (172) y: (-23)\n\nwhen backdrop switches to [backdrop7 v]\ngo to x: (179) y: (143)\n\nwhen backdrop switches to [backdrop8 v]\ngo to x: (156) y: (-87)\n\nwhen backdrop switches to [backdrop9 v]\ngo to x: (186) y: (137)\n\nwhen backdrop switches to [backdrop10 v]\ngo to x: (188) y: (131)\n\nwhen backdrop switches to [backdrop12 v]\ngo to x: (212) y: (-127)\n\nwhen [p v] key pressed\nask [Passcode please...] and wait\nif <(answer) = [bilbo]> then\n    say [Passcode acepted]\n    wait (0.5) seconds\n    say []\n    broadcast (Cheat v)\nelse\n    if <not <(answer) = [bilbo]>> then\n        say [error]\n        wait (0.5) seconds\n        say []\n    end\nend\n\nwhen backdrop switches to [backdrop5 v]\ngo to x: (-82) y: (100)\n\nwhen backdrop switches to [backdrop13 v]\ngo to x: (190) y: (-147)\n\nwhen backdrop switches to [backdrop14 v]\ngo to x: (156) y: (104)\n\nwhen backdrop switches to [backdrop15 v]\ngo to x: (199) y: (-127)\n\nwhen backdrop switches to [backdrop18 v]\ngo to x: (-204) y: (89)\n\nwhen backdrop switches to [backdrop20 v]\nhide\n\nwhen backdrop switches to [backdrop16 v]\ngo to x: (193) y: (116)\n\nwhen backdrop switches to [backdrop19 v]\ngo to x: (197) y: (-112)\n\nwhen I receive [portal show v]\ngo to x: (219) y: (-135)\nshow\n\nwhen backdrop switches to [backdrop21 v]\nhide\n\n@Sprite3\n\n@Sprite4\n\n@Sprite5\n\nwhen flag clicked\nshow variable [level v]\nset [level v] to [1]\n\nwhen flag clicked\nforever\n    if <(Level) = [1]> then\n        if <touching (sprite2 v)?> then\n            think [Use the arrow keys to move and read the project description for other controls]\n            wait until <not <touching (sprite2 v)?>>\n            say []\n        end\n    end\n    if <(Level) = [2]> then\n        if <touching (sprite2 v)?> then\n            think [Hold the arrow keys while touching a wall to wall jump!]\n            wait until <not <touching (sprite2 v)?>>\n            say []\n        end\n    end\n    if <(Level) = [3]> then\n        if <touching (sprite2 v)?> then\n            think [Press the up key while touching a rope to climb up it!]\n            wait until <not <touching (sprite2 v)?>>\n            say []\n        end\n    end\n    if <(Level) = [4]> then\n        if <touching (sprite2 v)?> then\n            think [Don't touch those spikes!]\n            wait until <not <touching (sprite2 v)?>>\n            say []\n        end\n    end\n    if <(Level) = [5]> then\n        if <touching (sprite2 v)?> then\n            think [Good Luck!]\n            wait until <not <touching (sprite2 v)?>>\n            say []\n        end\n    end\n    if <(Level) = [6]> then\n        if <touching (sprite2 v)?> then\n            think [Take this one nice and slow.]\n            wait until <not <touching (sprite2 v)?>>\n            say []\n        end\n    end\n    if <(Level) = [7]> then\n        if <touching (sprite2 v)?> then\n            think [Press the down arrow key while on a platform to "crouch"]\n            wait until <not <touching (sprite2 v)?>>\n            say []\n        end\n    end\n    if <(Level) = [8]> then\n        if <touching (sprite2 v)?> then\n            think [Both paths are possibe, one is a bit easier. My advice time it!]\n            wait until <not <touching (sprite2 v)?>>\n            say []\n        end\n    end\n    if <(Level) = [9]> then\n        if <touching (sprite2 v)?> then\n            think ["The wheel of DOOM!"]\n            wait until <not <touching (sprite2 v)?>>\n            say []\n        end\n    end\n    if <(Level) = [10]> then\n        if <touching (sprite2 v)?> then\n            think [Make sure to try platformer adventure2!]\n            wait until <not <touching (sprite2 v)?>>\n            say []\n        end\n    end\n    if <(Level) = [11]> then\n        if <touching (sprite2 v)?> then\n            think [Precision is key]\n            wait until <not <touching (sprite2 v)?>>\n            say []\n        end\n    end\n    if <(Level) = [12]> then\n        if <touching (sprite2 v)?> then\n            think [Although it doesn't seem like it this level is possible!]\n            wait until <not <touching (sprite2 v)?>>\n            say []\n        end\n    end\n    if <(Level) = [13]> then\n        if <touching (sprite2 v)?> then\n            think [Love This Project and make sure to try platformer adventure2!]\n            wait until <not <touching (sprite2 v)?>>\n            say []\n        end\n    end\n    if <(Level) = [14]> then\n        if <touching (sprite2 v)?> then\n            think [Without that jump pad this level would become imposible!]\n            wait until <not <touching (sprite2 v)?>>\n            say []\n        end\n    end\n    if <(Level) = [15]> then\n        if <touching (sprite2 v)?> then\n            think [Good luck!]\n            wait until <not <touching (sprite2 v)?>>\n            say []\n        end\n    end\n    if <(Level) = [16]> then\n        if <touching (sprite2 v)?> then\n            think [Jump circles! wow!]\n            wait until <not <touching (sprite2 v)?>>\n            say []\n        end\n    end\n    if <(Level) = [17]> then\n        if <touching (sprite2 v)?> then\n            think [Take your time on figuring this one out!]\n            wait until <not <touching (sprite2 v)?>>\n            say []\n        end\n    end\n    if <(Level) = [18]> then\n        if <touching (sprite2 v)?> then\n            think [Press down to "duck"]\n            wait until <not <touching (sprite2 v)?>>\n            say []\n        end\n    end\n    if <(Level) = [19]> then\n        if <touching (sprite2 v)?> then\n            think [Follow 2sad4me for more games like this and make sure to try platformer adventure2!]\n            wait until <not <touching (sprite2 v)?>>\n            say []\n        end\n    end\n    if <(Level) = [20]> then\n        if <touching (sprite2 v)?> then\n            think (join [Welcome home ] (username))\n            wait until <not <touching (sprite2 v)?>>\n            say []\n        end\n    end\n    if <(Level) = [21]> then\n        if <touching (sprite2 v)?> then\n            think [You win, make sure to try platformer adventure2!]\n            wait until <not <touching (sprite2 v)?>>\n            say []\n        end\n    end\nend\n\n@Spikes\n\nwhen backdrop switches to [backdrop4 v]\nshow\ngo to x: (13) y: (-70)\nswitch costume to (costume1 v)\n\nwhen backdrop switches to [backdrop1 v]\nhide\n\nwhen flag clicked\nhide\n\nwhen backdrop switches to [backdrop5 v]\nhide\n\nwhen backdrop switches to [backdrop6 v]\nswitch costume to (costume2 v)\nshow\n\nwhen backdrop switches to [backdrop7 v]\nhide\n\nwhen backdrop switches to [backdrop9 v]\nswitch costume to (costume3 v)\ngo to x: (0) y: (-27)\nshow\n\nwhen backdrop switches to [backdrop10 v]\nhide\n\nwhen backdrop switches to [backdrop12 v]\nswitch costume to (costume5 v)\nshow\n\nwhen backdrop switches to [backdrop13 v]\nhide\n\nwhen backdrop switches to [backdrop15 v]\ngo to x: (-2) y: (-64)\nswitch costume to (costume6 v)\nshow\n\nwhen backdrop switches to [backdrop16 v]\nhide\n\nwhen backdrop switches to [backdrop17 v]\nswitch costume to (costume7 v)\ngo to x: (-29) y: (-25)\nshow\n\nwhen backdrop switches to [backdrop18 v]\nhide\n\nwhen backdrop switches to [backdrop19 v]\nswitch costume to (costume8 v)\nshow\n\nwhen backdrop switches to [backdrop19 v]\ngo to x: (-88) y: (-18)\n\nwhen backdrop switches to [backdrop20 v]\nhide\n\nwhen backdrop switches to [backdrop11 v]\nhide\n\n@Sprite6\n\nwhen flag clicked\ngo to [front v] layer\nshow\nset [ghost v] effect to (10)\n\n@mute\n\nwhen flag clicked\nswitch costume to (mute v)\nbroadcast (play music v)\nforever\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        wait until <not <<touching (mouse-pointer v)?> and <mouse down?>>>\n        switch costume to (mute2 v)\n        repeat until <<touching (mouse-pointer v)?> and <mouse down?>>\n            stop all sounds\n        end\n        broadcast (play music v)\n        switch costume to (mute v)\n        wait (0.1) seconds\n    end\nend\n\n@Spikes2\n\nwhen flag clicked\nswitch costume to (costume1 v)\ngo to x: (-116) y: (7)\nhide\n\nwhen backdrop switches to [backdrop7 v]\nswitch costume to (costume1 v)\ngo to x: (-116) y: (7)\nshow\nrepeat until <(Level) = [8]>\n    repeat (40)\n        move (4) steps\n        point in direction (90)\n    end\n    repeat (40)\n        move (4) steps\n        point in direction (-90)\n    end\nend\n\nwhen backdrop switches to [backdrop1 v]\nhide\n\nwhen backdrop switches to [backdrop8 v]\nswitch costume to (costume2 v)\ngo to x: (60) y: (129)\nshow\nrepeat until <(Level) = [9]>\n    repeat (25)\n        point in direction (180)\n        move (9) steps\n    end\n    wait (1) seconds\n    go to x: (67) y: (131)\nend\nhide\n\n@Sprite7\n\nwhen flag clicked\nhide\n\nwhen backdrop switches to [backdrop9 v]\nshow\nrepeat until <(Level) = [10]>\n    go to x: (0) y: (0)\n    turn left (3) degrees\nend\nhide\n\nwhen backdrop switches to [backdrop10 v]\nhide\n\n@Sprite8\n\nwhen backdrop switches to [backdrop10 v]\nshow\ngo to x: (-27) y: (10)\nrepeat until <(Level) = [11]>\n    wait until <touching (sprite2 v)?>\n    hide\n    wait (1) seconds\n    wait until <not <touching (sprite2 v)?>>\n    show\n    wait (1) seconds\nend\nhide\n\nwhen flag clicked\nhide\n\nwhen backdrop switches to [backdrop1 v]\nhide\n\nwhen backdrop switches to [backdrop11 v]\nhide\n\n@Sprite10\n\nwhen flag clicked\nhide\n\nwhen backdrop switches to [backdrop12 v]\ngo to x: (-22) y: (21)\nshow\nforever\n    repeat until <touching (_edge_ v)?>\n        point in direction (90)\n        move (3) steps\n    end\n    move (-10) steps\n    wait (1) seconds\n    repeat until <touching (_edge_ v)?>\n        point in direction (-90)\n        move (3) steps\n    end\n    move (-10) steps\nend\n\nwhen backdrop switches to [backdrop1 v]\nhide\n\nwhen backdrop switches to [backdrop13 v]\nhide\n\n@Sprite11\n\nwhen flag clicked\nforever\n    if <(Level) = [12]> then\n        show\n        if <touching (sprite2 v)?> then\n            think [That was a bit rage inducing, was it not?]\n            wait until <not <touching (sprite2 v)?>>\n            say []\n        end\n    else\n        hide\n    end\nend\n\n@Sprite12\n\nwhen backdrop switches to [backdrop20 v]\nshow\n\nwhen flag clicked\nhide\n\nwhen backdrop switches to [backdrop21 v]\nhide\n\n@Sprite13\n\nwhen flag clicked\nhide\n\nwhen backdrop switches to [backdrop20 v]\nwait (5) seconds\nshow\nwait (1) seconds\nbroadcast (portal show v)\nrepeat until <(Level) = [21]>\n    create clone of (spikes 3 v)\n    wait (0.25) seconds\nend\nhide\n\nwhen backdrop switches to [backdrop21 v]\nhide\n\n@spikes 3\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\ngo to (sprite13 v)\npoint towards (sprite2 v)\nshow\nrepeat until <touching (_edge_ v)?>\n    move (10) steps\nend\ndelete this clone\n\n@Sprite9\n\nwhen flag clicked\nhide\n\n