Time -A Platformer-

Instructions: Time -A Platformer-\n\nIn this platformer, your goal is to finish the level without the time running out or touching spikes/lava. Arrow keys to move, press the restart button to restart the level.\n\nPlease heart and star!

@Stage\n\nwhen flag clicked\nset [pitch v] effect to (0)\nbroadcast (start v)\n\nstart sound [Mystery v]\nwait (2.5) seconds\n\nwhen I receive [start v]\nset [pitch v] effect to (0)\nforever\n    play sound [Mystery v] until done\nend\n\nwhen I receive [oof v]\nrepeat (30)\n    change [pitch v] effect by (-1.5)\nend\nstop all sounds\nstop [other scripts in sprite v]\nbroadcast (dead v)\nset [pitch v] effect to (-45)\nplay sound [Reverse Sound Effect - Copyright free sound effects v] until done\nset [pitch v] effect to (0)\nbroadcast (start v)\nset [game v] to [1]\n\nwhen I receive [start v]\nset [pitch v] effect to (0)\nforever\n    if <(timer) = [0]> then\n        stop all sounds\n        broadcast (oof v)\n        set [game v] to [0]\n        repeat (30)\n            change [pitch v] effect by (-1.5)\n        end\n        stop all sounds\n        stop [other scripts in sprite v]\n        broadcast (dead v)\n        set [pitch v] effect to (-45)\n        play sound [Reverse Sound Effect - Copyright free sound effects v] until done\n        set [pitch v] effect to (0)\n        broadcast (start v)\n        set [game v] to [1]\n    end\nend\n\nstop all sounds\n\nset [pitch v] effect to (0)\n\nrepeat (30)\n    change [pitch v] effect by (-1.5)\nend\n\nbroadcast (oof v)\n\n@Sprite4\n\nwhen flag clicked\nset [game v] to [1]\nset [ghost v] effect to (0)\nshow\ngo to x: (-200) y: (-108)\nset [x v] to [0]\nset [y v] to [0]\nforever\n    if <(game) = [1]> then\n        if <key (right arrow v) pressed?> then\n            change [x v] by (0.6)\n        end\n        if <key (left arrow v) pressed?> then\n            change [x v] by (-0.6)\n        end\n        change x by (X)\n        set [x v] to ((X) * (0.9))\n        if <touching (sprite3 v)?> then\n            change y by (0.5)\n            if <touching (sprite3 v)?> then\n                change y by (0.5)\n                if <touching (sprite3 v)?> then\n                    change y by (0.5)\n                    if <touching (sprite3 v)?> then\n                        change y by (0.5)\n                        if <touching (sprite3 v)?> then\n                            change y by (0.5)\n                            if <touching (sprite3 v)?> then\n                                change y by (0.5)\n                                if <touching (sprite3 v)?> then\n                                    change y by (0.5)\n                                    if <touching (sprite3 v)?> then\n                                        change y by (0.5)\n                                        if <key (up arrow v) pressed?> then\n                                            if <[0] < (X)> then\n                                                set [x v] to [-7]\n                                            else\n                                                set [x v] to [7]\n                                            end\n                                            set [y v] to [10]\n                                        else\n                                            set [x v] to ((X) * (-1.3))\n                                            change x by (X)\n                                            set [x v] to [0]\n                                            change x by ((X) / (5))\n                                        end\n                                        change y by (-4)\n                                    end\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        change [y v] by (-0.5)\n        change y by (Y)\n        if <touching (sprite3 v)?> then\n            set [y v] to ((Y) * (-0.25))\n            change y by (Y)\n            if <touching (sprite3 v)?> then\n                change y by (Y)\n                if <touching (sprite3 v)?> then\n                    change y by (Y)\n                    if <touching (sprite3 v)?> then\n                        change y by (Y)\n                    end\n                end\n            end\n        end\n        change y by (-1)\n        if <<key (up arrow v) pressed?> and <touching (sprite3 v)?>> then\n            set [y v] to [10]\n        end\n        change y by (1)\n        if <key (down arrow v) pressed?> then\n            switch costume to (costume1 v)\n        else\n            switch costume to (costume v)\n        end\n        if <touching (sprite1 v)?> then\n            set [game v] to [0]\n            repeat (10)\n                change [ghost v] effect by (10)\n            end\n            go to x: (-200) y: (-108)\n            broadcast (oof v)\n        end\n    end\nend\n\nwhen I receive [next v]\nset [x v] to [0]\nset [y v] to [0]\nwait (0.01) seconds\ngo to x: (-179) y: (-108)\n\nwhen I receive [dead v]\nset [x v] to [0]\nset [y v] to [0]\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\ngo to x: (-200) y: (-108)\n\nbroadcast (start2 v)\n\nwhen I receive [oof v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\ngo to x: (-200) y: (-108)\n\n@Sprite3\n\nwhen I receive [next v]\nwait (0.01) seconds\nnext costume\n\nwhen flag clicked\nswitch costume to (costume1 v)\n\n@Sprite1\n\nwhen I receive [next v]\nwait (0.01) seconds\nnext costume\n\nwhen flag clicked\nswitch costume to (costume2 v)\n\n@Sprite5\n\n@Sprite6\n\nwhen flag clicked\nset [ghost v] effect to (100)\nforever\n    if <touching (sprite4 v)?> then\n        broadcast (next v)\n        wait (0.1) seconds\n    end\nend\n\n@Sprite2\n\nwhen flag clicked\nset [counter v] to [1]\n\nwhen I receive [dead v]\nstop [other scripts in sprite v]\nwait (2) seconds\nbroadcast (start2 v)\n\nwhen I receive [start2 v]\nset [counter v] to [1]\nset [timer v] to [5]\nforever\n    repeat (5)\n        wait (1.2) seconds\n        change [timer v] by (-1)\n        next costume\n    end\n    stop [this script v]\nend\n\nwhen I receive [oof v]\n\nwhen I receive [next v]\nswitch costume to (5 v)\nstop [other scripts in sprite v]\nset [timer v] to [5]\nbroadcast (start2 v)\n\nwhen I receive [start2 v]\nswitch costume to (5 v)\nset [timer v] to [5]\nforever\n    set [brightness v] effect to (80)\nend\n\nwhen I receive [start v]\nbroadcast (start2 v)\n\nwhen I receive [start v]\nswitch costume to (5 v)\n\n@Sprite7\n\nwhen I receive [dead v]\nshow\nset [ghost v] effect to (100)\nrepeat (30)\n    change [ghost v] effect by (-3)\nend\nrepeat (35)\n    change [ghost v] effect by (3)\nend\nhide\n\nwhen flag clicked\nhide\nset [ghost v] effect to (100)\n\n@Sprite8\n\nwhen I receive [start v]\nset [brightness v] effect to (60)\nforever\n    if <touching (mouse-pointer v)?> then\n        set size to (11) %\n        if <mouse down?> then\n            broadcast (oof v)\n            stop [this script v]\n        end\n    else\n        set size to (10) %\n    end\nend\n\n@effect\n\nwhen flag clicked\ngo to [back v] layer\nswitch costume to (effect v)\ngo to x: (0) y: (0)\nset [ghost v] effect to (0)\nset [x v] to [0]\nset [y v] to [0]\nforever\n    change [x v] by (-2.5)\n    change [y v] by (2)\n    set x to (x)\n    set y to (y)\n    if <(x) = [-40]> then\n        set [x v] to [0]\n        set [y v] to [0]\n    end\nend\n\nhide\n\nerase all\n\nstamp\n\nwhen flag clicked\nforever\n    go to [back v] layer\nend\n\n@Sprite9\n\nwhen flag clicked\nhide\n\n