roblox doors platformer


@Stage\n\nwhen flag clicked\nforever\n    play sound [doors-roblox-ost-elevator-jam-By-Tuna v] until done\nend\n\nwhen I receive [play game v]\nstop [other scripts in sprite v]\nforever\n    play sound [doors-roblox-ost-dawn-of-the-doors-By-Tuna v] until done\nend\n\nwhen I receive [the end v]\nstop [other scripts in sprite v]\nforever\n    play sound [doors-roblox-ost-elevator-jam-By-Tuna v] until done\nend\n\nset [level v] to [7]\n\nwhen I receive [start v]\nstop [other scripts in sprite v]\nforever\n    play sound [doors-roblox-ost-dawn-of-the-doors-By-Tuna v] until done\nend\n\n@Player\n\ndefine reset  X (x) Y (y)\ngo to x: (x) y: (y)\nset [y v] to [0]\nset [x v] to [0]\nset rotation style [left-right v]\npoint in direction (90)\nclear graphic effects\n\ndefine Speed (speed) Friction (friction) Gravity (gravity) Jump height (jump height)\nchange [y v] by (gravity)\nif <<key (right arrow v) pressed?> or <<key (d v) pressed?> or <<mouse down?> and <(x position) < (mouse x)>>>> then\n    change [x v] by (speed)\n    point in direction (90)\nend\nif <<key (left arrow v) pressed?> or <<key (a v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>>> then\n    change [x v] by ((speed) * (-1))\n    point in direction (-90)\nend\nset [x v] to ((X) * (friction))\nchange x by (X)\nrepeat (8)\n    change y by <touching (platform v)?>\nend\nif <touching (platform v)?> then\n    change x by (() - (X))\n    change y by (-8)\n    if <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(y position) < (mouse y)>>>> then\n        set [y v] to ((jump height) - (3))\n        set [x v] to ((5) - ((14) * <[0] < (X)>))\n    end\nend\nchange y by (Y)\nif <touching (platform v)?> then\n    change y by ((Y) * (-1))\n    set [y v] to [0]\nend\nchange y by (-1)\nif <<key (up arrow v) pressed?> or <<key (w v) pressed?> or <<mouse down?> and <(y position) < (mouse y)>>>> then\n    if <touching (platform v)?> then\n        start sound [RXQHWYP-jump v]\n        set [y v] to (jump height)\n    end\nend\nchange y by (1)\nif <<key (down arrow v) pressed?> or <<key (s v) pressed?> or <<mouse down?> and <(mouse y) < (y position)>>>> then\n    switch costume to (player2 v)\nelse\n    switch costume to (player v)\nend\n\nwhen I receive [play game v]\nshow\nif <(entered closet) = [0]> then\n    reset  X [-200] Y [0]\nend\nif <(entered closet) = [1]> then\n    reset  X [100] Y [0]\nend\nset [ok v] to [0]\nforever\n    go to [front v] layer\n    if <(ok) = [0]> then\n        Speed [1] Friction [0.88] Gravity [-1] Jump height [13]\n        if <<<touching (spikes v)?> or <touching (monster v)?>> or <touching (screech v)?>> then\n            set [ok v] to [1]\n            set rotation style [all around v]\n            set [y v] to [10]\n            start sound [Voicy_Oof! - Roblox Death Sound  v]\n            broadcast (death v)\n            repeat (20)\n                change [y v] by (-1)\n                change [ghost v] effect by (5)\n                turn right (8) degrees\n                change y by (Y)\n            end\n            set [ok v] to [0]\n            reset  X [-200] Y [0]\n        end\n    end\n    if <not <(level) = [12]>> then\n        if <[240] < (x position)> then\n            change [level v] by (1)\n            reset  X [-200] Y [0]\n        end\n    else\n        if <touching (door v)?> then\n            if <(blue key) = [1]> then\n                change [level v] by (1)\n                reset  X [-200] Y [0]\n            end\n        end\n    end\nend\n\nwhen I receive [death v]\nforever\n    if <touching (closet v)?> then\n        stop [other scripts in sprite v]\n        go to x: (100) y: (-78)\n        broadcast (closet v)\n        stop [this script v]\n    end\nend\n\nwhen I receive [start v]\nshow\nif <(entered closet) = [0]> then\n    reset  X [-200] Y [0]\nend\nif <(entered closet) = [1]> then\n    reset  X [100] Y [0]\nend\nset [ok v] to [0]\nforever\n    go to [front v] layer\n    if <(ok) = [0]> then\n        Speed [1] Friction [0.88] Gravity [-1] Jump height [13]\n        if <<<touching (spikes v)?> or <touching (monster v)?>> or <touching (screech v)?>> then\n            set [ok v] to [1]\n            set rotation style [all around v]\n            set [y v] to [10]\n            start sound [Voicy_Oof! - Roblox Death Sound  v]\n            broadcast (death v)\n            repeat (20)\n                change [y v] by (-1)\n                change [ghost v] effect by (5)\n                turn right (8) degrees\n                change y by (Y)\n            end\n            set [ok v] to [0]\n            reset  X [-200] Y [0]\n        end\n    end\n    if <not <(level) = [12]>> then\n        if <[240] < (x position)> then\n            change [level v] by (1)\n            reset  X [-200] Y [0]\n        end\n    else\n        if <touching (door v)?> then\n            if <(blue key) = [1]> then\n                change [level v] by (1)\n                reset  X [-200] Y [0]\n            end\n        end\n    end\nend\n\n@Platform\n\nwhen flag clicked\ngo to [front v] layer\nforever\n    switch costume to (level)\n    go to x: (0) y: (0)\nend\n\n@spikes\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    switch costume to (level)\nend\n\nset size to (100) %\n\n@background\n\nwhen flag clicked\nswitch costume to (level1 v)\nforever\n    go to [back v] layer\n    go to x: (0) y: (0)\n    switch costume to (level)\nend\n\nwhen flag clicked\nforever\n    if <(costume [name v]) = [done]> then\n        broadcast (the end v)\n        stop [this script v]\n    end\nend\n\n@　\n\nwhen flag clicked\nhide\ngo to [front v] layer\n\n@remember\n\nwhen I receive [game start v]\nforever\n    hide\n    go to x: (-91) y: (-190)\n    wait (60) seconds\n    show\n    go to [front v] layer\n    glide (1) secs to x: (-91) y: (-149)\n    wait (2) seconds\n    glide (1) secs to x: (-90) y: (-190)\nend\n\n@effect\n\nwhen flag clicked\ngo to x: (0) y: (0)\nclear graphic effects\ngo to [back v] layer\nchange [ghost v] effect by (40)\nrepeat (2)\n    show\nend\n\nwhen I receive [the end v]\nhide\n\n@lobby\n\nwhen flag clicked\nshow\nwait (.01) seconds\ngo to [front v] layer\n\nwhen I receive [play game v]\nhide\n\nwhen I receive [start v]\nhide\n\n@play\n\nwhen flag clicked\nshow\nwait until <<key (space v) pressed?> or <mouse down?>>\nforever\n    go to [front v] layer\n    if <touching (mouse-pointer v)?> then\n        set size to (120) %\n    end\n    if <not <touching (mouse-pointer v)?>> then\n        set size to (100) %\n    end\nend\n\nwhen this sprite clicked\nbroadcast (play game v)\nhide\n\nwhen I receive [start v]\nhide\n\nwhen I receive [play game v]\nhide\n\n@door number\n\nwhen flag clicked\nhide\n\nwhen I receive [game start v]\nshow\ngo to [front v] layer\nforever\n    switch costume to (level)\nend\n\nwhen I receive [play game v]\nshow\ngo to [front v] layer\nforever\n    switch costume to (level)\nend\n\n@monster\n\nwhen flag clicked\nset [level v] to [1]\nhide\ngo to x: (-187) y: (92)\nbroadcast (death v)\n\nwhen flag clicked\nforever\n    go to [front v] layer\nend\n\nwhen I receive [death v]\nhide\ngo to x: (-187) y: (92)\nforever\n    if <(level) = [8]> then\n        show\n        wait (1.1) seconds\n        glide (1) secs to x: (-187) y: (-49)\n        glide (1) secs to x: (200) y: (-49)\n        hide\n        broadcast (play game v)\n        stop [this script v]\n    end\nend\n\n@closet\n\ngo to [front v] layer\n\nwhen I receive [closet v]\nchange [ghost v] effect by (50)\ngo to [front v] layer\nswitch costume to (costume2 v)\nset [entered closet v] to [1]\n\nwhen I receive [play game v]\nclear graphic effects\nhide\nforever\n    if <(level) = [8]> then\n        show\n    else\n        hide\n    end\nend\n\nwhen flag clicked\nswitch costume to (costume1 v)\nset [entered closet v] to [0]\n\n@run\n\nwhen I receive [closet v]\nhide\nstop [other scripts in sprite v]\n\nset [entered closet v] to [1]\n\nwhen flag clicked\nclear graphic effects\nhide\nforever\n    if <(level) = [8]> then\n        show\n    else\n        hide\n    end\nend\n\n@door\n\nwhen flag clicked\nforever\n    if <(level) = [12]> then\n        show\n        switch costume to (costume2 v)\n        go to x: (192) y: (-36)\n        if <touching (player v)?> then\n            if <(blue key) = [1]> then\n                switch costume to (costume1 v)\n            end\n            if <(blue key) = [0]> then\n                switch costume to (costume2 v)\n            end\n        end\n    else\n        hide\n    end\nend\n\n@key\n\nwhen flag clicked\nset [blue key v] to [0]\nforever\n    if <(level) = [12]> then\n        show\n        switch costume to (costume1 v)\n        go to x: (-156) y: (76)\n        if <touching (player v)?> then\n            set [blue key v] to [1]\n            go to x: (10) y: (-133)\n            switch costume to (costume2 v)\n            stop [this script v]\n        end\n    else\n        hide\n    end\nend\n\nwhen flag clicked\nforever\n    go to [front v] layer\n    if <(level) = [12]> then\n        show\n    else\n        hide\n    end\nend\n\n@screech\n\nwhen flag clicked\nforever\n    if <(level) = [7]> then\n        show\n        switch costume to (costume1 v)\n        go to x: (-119) y: (55)\n        glide (1) secs to x: (-119) y: (67)\n        glide (1) secs to x: (-119) y: (55)\n    end\n    if <(level) = [11]> then\n        show\n        switch costume to (costume1 v)\n        go to x: (160) y: (109)\n        glide (1) secs to x: (160) y: (83)\n        glide (1) secs to x: (160) y: (109)\n    end\n    if <(level) = [19]> then\n        show\n        switch costume to (costume1 v)\n        go to x: (0) y: (114)\n        glide (1) secs to x: (89) y: (0)\n        glide (1) secs to x: (0) y: (114)\n        glide (1) secs to x: (-50) y: (-3)\n        glide (1) secs to x: (0) y: (114)\n    end\nend\n\nwhen flag clicked\nforever\n    if <not <<<(level) = [19]> or <(level) = [7]>> or <(level) = [11]>>> then\n        hide\n    end\nend\n\n@help\n\nset size to (100) %\n\nwhen I receive [play game v]\ngo to x: (0) y: (0)\nforever\n    go to [front v] layer\n    switch costume to (level)\nend\n\n@Sprite1\n\nwhen flag clicked\nforever\n    show\n    go to [front v] layer\n    if <<mouse down?> or <key (space v) pressed?>> then\n        hide\n        stop [this script v]\n    end\nend\n\n@Sprite2\n\nwhen flag clicked\nswitch costume to (costume2 v)\nset size to (150) %\nswitch costume to (costume1 v)\n\nwhen I receive [play game v]\nforever\n    go to (player v)\n    go to [front v] layer\n    if <<(level) = [7]> or <<(level) = [10]> or <(level) = [14]>>> then\n        show\n    else\n        hide\n    end\nend\n\n