Platformer - a platformer Part 1

Instructions: arrow keys to move Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah z to skip x to go back a level  blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah

@Stage\n\nwhen I receive [next level v]\nnext backdrop\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\n\nwhen flag clicked\nforever\n    play sound [Dubstep v] until done\n    play sound [Dubstep v] until done\nend\n\nwhen [space v] key pressed\nstop all sounds\nclear sound effects\n\nwhen flag clicked\nhide variable [crack v]\nhide variable [level v]\nwait (3) seconds\nshow variable [level v]\n\nwhen flag clicked\nset [level v] to [1]\n\nwhen flag clicked\nforever\n    if <key (x v) pressed?> then\n        wait (.1) seconds\n        switch backdrop to (previous backdrop v)\n        change [level v] by (-1)\n        broadcast (go back v)\n        wait until <not <key (x v) pressed?>>\n    end\nend\n\nwhen flag clicked\nforever\n    if <key (z v) pressed?> then\n        broadcast (next level v)\n        wait until <not <key (z v) pressed?>>\n    end\nend\n\nwhen flag clicked\nset [level v] to [1]\n\n@Player\n\ndefine Gravity\nchange [change in y v] by (-1)\nchange y by (change in y)\nif <touching color (#000000)?> then\n    change y by ((-1) * (change in y))\n    set [change in y v] to [0]\nend\nchange y by (-1)\nif <touching color (#000000)?> then\n    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        set [change in y v] to [15]\n    end\nend\nchange y by (1)\n\ndefine Side Collsion\nif <touching color (#000000)?> then\n    change y by (1)\n    if <touching color (#000000)?> then\n        change y by (1)\n        if <touching color (#000000)?> then\n            change y by (1)\n            if <touching color (#000000)?> then\n                change y by (1)\n                if <touching color (#000000)?> then\n                    change y by (1)\n                    if <touching color (#000000)?> then\n                        change x by ((Change in x) * (-1))\n                        change y by (-5)\n                        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                            if <(Change in x) > [0]> then\n                                set [change in x v] to [-5]\n                            else\n                                set [change in x v] to [5]\n                            end\n                            set [change in y v] to [10]\n                        else\n                            set [change in x v] to [0]\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nswitch costume to (costume1 v)\nshow\ngo to x: (-216) y: (-74)\nset [change in y v] to [0]\nset [change in x v] to [0]\nforever\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        change [change in x v] by (1)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change [change in x v] by (-1)\n    end\n    set [change in x v] to ((Change in x) * (0.9))\n    change x by (Change in x)\n    Side Collsion\n    Gravity\n    if <(x position) > [235]> then\n        broadcast (next level v)\n    end\n    if  then\n        broadcast (restart v)\n    end\n    if <<touching color (#002699)?> or <touching color (#4a6cd4)?>> then\n        set [change in y v] to [70]\n        set [change in x v] to [0]\n        change [change in y v] by (20)\n    end\nend\n\nhide\n\nwait (1) seconds\n\nwhen this sprite clicked\n\nwhen I receive [costume2 v]\n\nwhen flag clicked\nset [change in x v] to [0]\n\nset [damage v] to [-5]\n\nswitch costume to (download v)\n\nwhen [z v] key pressed\n\nwhen flag clicked\nset [level v] to [1]\nforever\n    if <[235] < (x position)> then\n        broadcast (next level v)\n    end\nend\n\nwhen I receive [next level v]\ngo to x: (-216) y: (-74)\nset [change in y v] to [0]\nset [change in x v] to [0]\nset [costume v] to [1]\nchange [level v] by (1)\n\nset [change in x v] to [0]\n\nwhen I receive [restart v]\ngo to x: (-216) y: (-74)\nset [change in y v] to [0]\nset [change in x v] to [0]\n\nwhen [r v] key pressed\nbroadcast (restart v)\n\nswitch costume to (costume2 v)\nwait (2) seconds\nswitch costume to (costume1 v)\nwait (1) seconds\n\nwait (2) seconds\n\nwhen flag clicked\nwait until <(level) = [4]>\nrepeat until <not <(level) = [4]>>\n    if <touching (sprite1 v)?> then\n        wait (2) seconds\n        if <touching (sprite1 v)?> then\n            go to (sprite2 v)\n        end\n    end\nend\nwait until <(level) = [6]>\nrepeat until <not <(level) = [6]>>\n    if <touching (sprite1 v)?> then\n        wait (2) seconds\n        if <touching (sprite1 v)?> then\n            go to (sprite2 v)\n        end\n    end\nend\nwait until <(level) = [8]>\nrepeat until <not <(level) = [8]>>\n    if <touching (sprite1 v)?> then\n        wait (2) seconds\n        if <touching (sprite1 v)?> then\n            go to (sprite2 v)\n        end\n    end\nend\n\nwhen flag clicked\nset rotation style [left-right v]\n\nwhen I receive [go back v]\ngo to x: (-216) y: (-74)\nset [change in y v] to [0]\nset [change in x v] to [0]\n\nwhen flag clicked\ngo to [front v] layer\n\n@Sprite1\n\nwhen flag clicked\nhide\nforever\n    if <(level) = [4]> then\n        show\n        go to x: (-11) y: (-67)\n        wait until <not <(level) = [4]>>\n        hide\n    end\n    if <(level) = [6]> then\n        show\n        go to x: (81) y: (-62)\n        wait until <not <(level) = [6]>>\n        hide\n    end\n    if <(level) = [8]> then\n        show\n        go to x: (58) y: (-12)\n        wait until <not <(level) = [8]>>\n        hide\n    end\nend\n\n@Sprite2\n\nwhen flag clicked\nhide\nforever\n    if <(level) = [4]> then\n        show\n        go to x: (136) y: (102)\n        wait until <not <(level) = [4]>>\n        hide\n    end\n    if <(level) = [6]> then\n        show\n        go to x: (-34) y: (77)\n        wait until <not <(level) = [6]>>\n        hide\n    end\n    if <(level) = [8]> then\n        show\n        go to x: (215) y: (117)\n        wait until <not <(level) = [8]>>\n        hide\n    end\n    if <(level) = [9]> then\n        show\n        go to x: (215) y: (117)\n        wait until <not <(level) = [9]>>\n        hide\n    end\nend\n\n@Sprite3\n\nwhen flag clicked\ngo to x: (-11) y: (5)\nhide\nhide\nhide\nwait until <(level) = [8]>\nrepeat until <not <(level) = [8]>>\n    show\n    wait (4) seconds\n    hide\n    wait (4) seconds\nend\n\n@Sprite5\n\nwhen [space v] key pressed\nif <(level) > [19]> then\n    show\n    repeat (2)\n        switch costume to (costume2 v)\n        wait (.1) seconds\n        next costume\n        wait (.5) seconds\n        next costume\n        wait (.4) seconds\n    end\n    switch costume to (costume2 v)\n    hide\nend\n\nwhen flag clicked\ngo to [back v] layer\n\nwhen flag clicked\nset rotation style [left-right v]\nforever\n    if <key (right arrow v) pressed?> then\n        go to (player v)\n        point in direction (90)\n    end\n    if <key (left arrow v) pressed?> then\n        go to (player v)\n        point in direction (-90)\n    end\nend\n\nturn left (15) degrees\n\nturn right (15) degrees\n\npoint in direction ([direction v] of [player v])\n\nwhen flag clicked\nforever\n    go to (player v)\nend\n\n@win gem\n\nwhen this sprite clicked\nif <(level) = [13]> then\n\nwhen flag clicked\nforever\n    hide\n    if <<(level) = [12]> or <(level) = [13]>> then\n        show\n    end\nend\n\n@win gem cage\n\nwhen flag clicked\nforever\n    hide\n    if <(level) = [13]> then\n        show\n    end\nend\n\nwhen flag clicked\nforever\n    if <(level) = [13]> then\n        point in direction (180)\n        glide (2) secs to x: (-56) y: (28)\n    end\nend\n\nwhen flag clicked\ngo to x: (-66) y: (109)\n\nwhen flag clicked\nforever\n    if <touching (win gem v)?> then\n        go to [front v] layer\n        say [MWAHAH!!!!! I CAPTURED THE WIN GEM SO YOU CANNOT WIN!!!!!!!] for (2) seconds\n    end\nend\n\nwhen I receive [restart v]\ngo to x: (-66) y: (109)\n\n@thumbnail\n\nwhen flag clicked\nshow\nwait (1) seconds\nrepeat (10)\n    wait (.1) seconds\n    change [ghost v] effect by (10)\nend\nhide\n\nwhen flag clicked\nforever\n    go to [front v] layer\nend\n\nwhen I receive [end v]\nshow\n\nshow\n\nwhen I receive [or is it? v]\nhide\nset [time v] to [0]\nshow variable [time v]\nforever\n    if <(Time) = [100]> then\n        show\n        stop [all v]\n    end\nend\n\nwhen flag clicked\nhide variable [time v]\nset [time v] to [0]\nforever\n    wait (1) seconds\n    change [time v] by (1)\nend\n\n@moving platform\n\nwhen flag clicked\nforever\n    if <(level) = [18]> then\n        show\n    else\n        hide\n    end\nend\n\nwhen flag clicked\ngo to x: (180) y: (-3)\npoint in direction (90)\n\nwhen flag clicked\nforever\n    wait until <(level) = [18]>\n    repeat until <not <(level) = [18]>>\n        glide (1.9) secs to x: (-235) y: (2)\n        if on edge, bounce\n        glide (1.9) secs to x: (185) y: (-9)\n    end\nend\n\n