The Troll platformer

Instructions: You're a simple looking troll (as all of them), and you are on a mission to get out of a random grassland you stumbled into when pressing on this project. Get out.\n\n.Arrow keys to move\n.blue is bouncy\n.red will kill you\n.have fun

@Stage\n\nwhen flag clicked\nshow variable [lives v]\n\nwhen flag clicked\nshow variable [deaths v]\n\nwhen backdrop switches to [backdrop11 v]\n\n@The Troll\n\nwhen flag clicked\nset [yv v] to [0]\nforever\n    change [yv v] by (-1)\n    change y by (yv)\n    touching floor <(yv) > [0]>\n    if <touching color (#000000)?> then\n        set [yv v] to [0]\n        change y by (1)\n    end\nend\n\ndefine touching floor <up>\nchange [falling v] by (1)\nrepeat until <not <touching color (#000000)?>>\n    if <up> then\n        change y by (-1)\n    else\n        change y by (1)\n        set [falling v] to [0]\n    end\n    set [yv v] to [0]\nend\n\ndefine walk (direction) (speed)\npoint in direction (direction)\nchange x by (speed)\nset [slope v] to [0]\nrepeat until <<(slope) = [8]> or <not <touching color (#000000)?>>>\n    change y by (1)\n    change [slope v] by (1)\nend\nif <(slope) = [8]> then\n    change x by ((0) - (speed))\n    change y by ((0) - (slope))\nend\n\nwhen flag clicked\nset rotation style [left-right v]\nforever\n    if <key (right arrow v) pressed?> then\n        walk (90) (4)\n    end\n    if <key (left arrow v) pressed?> then\n        walk (-90) (-4)\n    end\n    if <<(x position) = [-230]> or <(x position) = [230]>> then\n        if <key (right arrow v) pressed?> then\n            walk (-90) (-4)\n        end\n        if <key (left arrow v) pressed?> then\n            walk (90) (4)\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <<key (up arrow v) pressed?> and <(falling) < [3]>> then\n        set [yv v] to [12]\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (portal v)?> then\n        go to x: (-210) y: (-113)\n        switch backdrop to (next backdrop v)\n    end\nend\n\nwhen flag clicked\ngo to x: (-210) y: (-113)\n\nwhen flag clicked\nforever\n    if <touching color (#003fff)?> then\n        set [yv v] to [20]\n    end\nend\n\nwhen flag clicked\nforever\n    if <key (r v) pressed?> then\n        go to x: (-210) y: (-113)\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching color (#ff0000)?> then\n        go to x: (-210) y: (-113)\n        broadcast (dead v)\n        set [yv v] to [5]\n    end\n    if <key (l v) pressed?> then\n        stop [this script v]\n    end\nend\n\nwhen flag clicked\nforever\n    if <touching (sting v)?> then\n        go to x: (-210) y: (-113)\n    end\nend\n\nwhen backdrop switches to [backdrop21 v]\nhide\n\nwhen flag clicked\nshow\n\nwhen flag clicked\nset [deaths v] to [0]\n\nwhen flag clicked\nset [lives v] to [0]\nforever\n    if <(Lives) = [0]> then\n        set [lives v] to [5]\n        switch backdrop to (backdrop1 v)\n    end\nend\n\nwalk (90) (4)\n\nwhen flag clicked\nwait until <key (l v) pressed?>\nforever\n    if <touching color (#ff0000)?> then\n        change [lives v] by (-1)\n        change [deaths v] by (1)\n        go to x: (-210) y: (-113)\n    end\nend\n\nwhen flag clicked\nforever\n    play sound [theme tune v] until done\nend\n\n@Portal\n\nwhen flag clicked\nset [quit moving v] to [0]\nset size to (10) %\nforever\n    turn right (7) degrees\n    if <key (l v) pressed?> then\n        stop [this script v]\n    end\nend\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\n\nwhen backdrop switches to [backdrop1 v]\ngo to x: (212) y: (-106)\n\nwhen backdrop switches to [backdrop2 v]\ngo to x: (214) y: (132)\n\nwhen backdrop switches to [backdrop3 v]\ngo to x: (218) y: (155)\n\nwhen backdrop switches to [backdrop4 v]\ngo to x: (229) y: (-106)\n\nwhen backdrop switches to [backdrop5 v]\ngo to x: (209) y: (-66)\n\nwhen backdrop switches to [backdrop6 v]\ngo to x: (216) y: (148)\n\nwhen backdrop switches to [backdrop7 v]\ngo to x: (-66) y: (-106)\n\nwhen backdrop switches to [backdrop8 v]\ngo to x: (214) y: (-101)\n\nwhen backdrop switches to [backdrop9 v]\ngo to x: (218) y: (153)\n\nwhen backdrop switches to [backdrop10 v]\ngo to x: (128) y: (154)\n\nwhen backdrop switches to [backdrop12 v]\ngo to x: (94) y: (138)\n\nwhen backdrop switches to [backdrop13 v]\ngo to x: (-84) y: (-106)\n\nwhen backdrop switches to [backdrop21 v]\nhide\n\nwhen flag clicked\nshow\n\nwhen backdrop switches to [backdrop11 v]\ngo to x: (-200) y: (164)\n\nwhen backdrop switches to [backdrop14 v]\ngo to x: (218) y: (-104)\n\nwhen backdrop switches to [backdrop15 v]\ngo to x: (218) y: (-104)\n\nwhen backdrop switches to [backdrop16 v]\ngo to x: (218) y: (-104)\n\nwhen backdrop switches to [backdrop18 v]\ngo to x: (162) y: (35)\n\nwhen backdrop switches to [backdrop19 v]\ngo to x: (218) y: (-104)\n\nwhen backdrop switches to [backdrop20 v]\ngo to x: (209) y: (141)\n\nwhen backdrop switches to [backdrop17 v]\ngo to x: (218) y: (-104)\n\n@Sting shooter\n\nwhen flag clicked\nhide\nset size to (50) %\nforever\n    point towards (the troll v)\nend\n\nwhen backdrop switches to [backdrop10 v]\nshow\n\nwhen backdrop switches to [backdrop11 v]\nhide\n\n@Sting\n\nwhen backdrop switches to [backdrop10 v]\nforever\n    wait (1) seconds\n    create clone of (_myself_ v)\nend\n\nwhen flag clicked\nset size to (50) %\nhide\nforever\n    go to (sting shooter v)\n    point towards (sting shooter v)\nend\n\nwhen I start as a clone\nshow\npoint towards (the troll v)\nforever\n    move (10) steps\nend\n\nwhen I start as a clone\nforever\n    if <touching (_edge_ v)?> then\n        delete this clone\n    end\n    if <touching (the troll v)?> then\n        wait (0.01) seconds\n        delete this clone\n    end\nend\n\nwhen backdrop switches to [backdrop11 v]\nhide\nstop [other scripts in sprite v]\n\n@The Boss\n\nwhen flag clicked\nhide\ngo to x: (-3) y: (58)\nset size to (50) %\n\nwhen backdrop switches to [backdrop21 v]\nhide\n\nwhen backdrop switches to [backdrop20 v]\nshow\nforever\n    glide (5) secs to x: ([x position v] of [the troll v]) y: ([y position v] of [the troll v])\nend\n\nwhen flag clicked\nforever\n    if <touching (the troll v)?> then\n        wait (0.01) seconds\n        go to x: (-3) y: (58)\n    end\nend\n\n@Sprite1\n\nwhen I receive [dead v]\nshow\nset [ghost v] effect to (100)\nrepeat (5)\n    change [ghost v] effect by (-10)\nend\nchange [lives v] by (-1)\nchange [deaths v] by (1)\nrepeat (5)\n    change [ghost v] effect by (10)\nend\nhide\nclear graphic effects\nstop [this script v]\n\n