rift - platformer

Instructions: rift - platformer    WASD or ARROW KEYS\n\nstory - pirates have invaded your magical land to steal the Rift. Go to the mountain to protect the Rift. be careful though because the pirates set up spikes.\nGood luck hero.\n\nplease scroll down on notes and credits and read everything before you make a comment. thx :)  

@Stage\n\nwhen flag clicked\nswitch backdrop to (start screen v)\n\nwhen I receive [start v]\nset volume to (50) %\nswitch backdrop to (main v)\nforever\n    play sound [LFZ - Echoes \[NCS Release\] v] until done\nend\n\n@Player\n\nwhen flag clicked\nhide\nset size to (100) %\n\nwhen I receive [start v]\nswitch costume to (1 v)\ngo to x: (-212) y: (-45)\nshow\ngo to x: (-212) y: (-45)\nset [yv v] to [0]\nset [xv v] to [0]\nforever\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        change [xv v] by (1)\n        point in direction (90)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change [xv v] by (-1)\n        point in direction (-90)\n    end\n    set [xv v] to ((Xv) * (0.9))\n    change x by (Xv)\n    if <touching (level v)?> then\n        change y by (1)\n        if <touching (level v)?> then\n            change y by (1)\n            if <touching (level v)?> then\n                change y by (1)\n                if <touching (level v)?> then\n                    change y by (1)\n                    if <touching (level v)?> then\n                        change y by (1)\n                        if <touching (level v)?> 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 [yv v] to [-10]\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 (level v)?> then\n        change y by ((Yv) * (-1))\n        set [yv v] to [0]\n    end\n    change y by (-1)\n    if <touching (level v)?> then\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            set [yv v] to [13]\n        end\n    end\n    change y by (1)\n    hide variable [yv v]\n    hide variable [xv v]\nend\n\nwhen flag clicked\nforever\n    if <touching (next level v)?> then\n        go to x: (-212) y: (-45)\n        change [level v] by (1)\n    end\n    if <touching (spikes v)?> then\n        go to x: (-212) y: (-45)\n        play sound [pop v] until done\n    end\nend\n\nwhen flag clicked\nforever\n    if <(level) = [10]> then\n        hide\n    end\nend\n\nwhen flag clicked\nforever\n    if <key (1 v) pressed?> then\n        switch costume to (1 v)\n    end\n    if <key (2 v) pressed?> then\n        switch costume to (2 v)\n    end\n    if <key (3 v) pressed?> then\n        switch costume to (3 v)\n    end\n    if <key (4 v) pressed?> then\n        switch costume to (4 v)\n    end\nend\n\n@level\n\nwhen flag clicked\nhide\nset [level v] to [1]\ngo to x: (0) y: (0)\ngo to [front v] layer\nforever\n    switch costume to (level)\nend\n\nwhen I receive [start v]\nshow\n\nwhen flag clicked\nforever\n    if <(level) = [10]> then\n        hide\n    end\nend\n\n@spikes\n\nwhen I receive [start v]\nshow\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen flag clicked\nforever\n    switch costume to (level)\nend\n\n@Start\n\nwhen flag clicked\nclear graphic effects\ngo to x: (0) y: (0)\nhide\nwait (1.65) seconds\nset [ghost v] effect to (100)\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\nwhen this sprite clicked\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\nclear graphic effects\nbroadcast (start v)\n\n@Thumbnail\n\nwhen flag clicked\nclear graphic effects\ngo to x: (0) y: (0)\nshow\nwait (1) seconds\nrepeat (20)\n    change [ghost v] effect by (5)\nend\nhide\nclear graphic effects\n\nhide\n\nshow\n\n@Next Level\n\nwhen flag clicked\ngo to x: (0) y: (0)\nhide\n\nwhen I receive [start v]\nshow\nswitch costume to (2 v)\n\n@clouds\n\nwhen flag clicked\ngo to x: (0) y: (0)\ngo to [front v] layer\nclear graphic effects\nhide\nset size to (120) %\n\nwhen I receive [start v]\ngo to x: (-432) y: (-34)\nset [ghost v] effect to (75)\nshow\nwait (0.1) seconds\nglide (12) secs to x: (480) y: (-34)\nwait (0.1) seconds\nrepeat until <(level) = [100]>\n    go to x: (-432) y: (-34)\n    glide (10) secs to x: (480) y: (-34)\nend\n\n@rift \n\nwhen flag clicked\nswitch costume to (1 v)\ngo to x: (0) y: (0)\nhide\n\nwhen flag clicked\nforever\n    if <(level) = [10]> then\n        show\n        repeat (28)\n            wait (0.2) seconds\n            next costume\n        end\n        wait (9999) seconds\n        stop [this script v]\n    end\nend\n\nshow\n\nhide\n\nnext costume\n\n