Cave Escape - Platformer

Instructions: \n

@Stage\n\nwhen flag clicked\nforever\n    switch backdrop to (Level)\nend\n\nwhen flag clicked\nclear graphic effects\nforever\n    if <(backdrop [number v]) = [9]> then\n        repeat (10)\n            change [brightness v] effect by (5)\n        end\n        repeat (10)\n            change [brightness v] effect by (-5)\n        end\n    else\n        clear graphic effects\n    end\nend\n\nwhen I receive [escaped v]\nstop [other scripts in stage v]\nswitch backdrop to (backdrop1 v)\n\n@Blob\n\nwhen flag clicked\nset [level v] to [1]\nset [yv v] to [0]\nset [xv v] to [0]\nset [startx v] to [-202]\nset [starty v] to [-55]\ngo to x: (StartX) y: (StartY)\nshow\nswitch costume to (right v)\nset size to (110) %\nforever\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        switch costume to (right v)\n        change [xv v] by (0.7)\n    else\n        if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n            switch costume to (left v)\n            change [xv v] by (-0.7)\n        end\n    end\n    set [xv v] to ((Xv) * (0.9))\n    change x by (Xv)\n    if <touching color (#330066)?> then\n        change y by (1)\n        if <touching color (#330066)?> then\n            change y by (1)\n            if <touching color (#330066)?> then\n                change y by (1)\n                if <touching color (#330066)?> then\n                    change y by (1)\n                end\n                if <touching color (#330066)?> then\n                    change x by ((Xv) * (-1))\n                    change y by (-4)\n                    set [xv v] to [0]\n                end\n            end\n        end\n    end\n    change [yv v] by (-1)\n    change y by (Yv)\n    if <touching color (#330066)?> then\n        change y by ((Yv) * (-1))\n        set [yv v] to [0]\n    end\n    change y by (-1)\n    if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> and <touching color (#330066)?>> then\n        set [yv v] to [10]\n    end\n    change y by (1)\n    if <<(x position) > [239]> and <not <(Level) = [8]>>> then\n        change [level v] by (1)\n        wait (0.001) seconds\n        go to x: (StartX) y: (StartY)\n    end\n    if <<<<<<<touching (spikes v)?> or <touching (spikes2 v)?>> or <key (r v) pressed?>> or <touching (fan v)?>> or <touching (fan2 v)?>> or <touching (fan3 v)?>> or <touching (fan4 v)?>> then\n        set [ghost v] effect to (0)\n        set [xv v] to [0]\n        repeat (10)\n            change size by ((25) - ((size) / (-5)))\n            change [ghost v] effect by (25)\n        end\n        go to x: (StartX) y: (StartY)\n        set [ghost v] effect to (0)\n        set size to (110) %\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [1]> then\n        set [startx v] to [-202]\n        set [starty v] to [-55]\n    else\n        if <(Level) = [2]> then\n            set [startx v] to [-202]\n            set [starty v] to [-55]\n        else\n            if <(Level) = [3]> then\n                set [startx v] to [-188]\n                set [starty v] to [-161]\n            else\n                if <(Level) = [4]> then\n                    set [startx v] to [-188]\n                    set [starty v] to [-161]\n                else\n                    if <(Level) = [5]> then\n                        set [startx v] to [-227]\n                        set [starty v] to [44]\n                    else\n                        if <(Level) = [8]> then\n                            set [startx v] to [-199]\n                            set [starty v] to [-65]\n                        else\n                        end\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    start sound [OMFG - Hello \[NCS 2.0 Release\].mp3 v]\n    wait (230) seconds\nend\n\nwhen flag clicked\nforever\n    wait until <touching (boss missiles v)?>\n    set [boss fight timer v] to [0]\nend\n\nwhen flag clicked\nforever\n    if <(Level) = [8]> then\n        repeat until <touching (boss missiles v)?>\n            change [boss fight timer v] by (1)\n            wait (1) seconds\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Boss Fight Timer) > [59]> then\n        switch backdrop to (backdrop1 v)\n        wait (0.2) seconds\n        broadcast (Escaped v)\n        hide\n    end\nend\n\nwhen flag clicked\nwait until <(Level) = [8]>\ngo to x: (-199) y: (-65)\n\n@Dust\n\nwhen flag clicked\nforever\n    Dust\nend\n\ndefine Dust\nhide\ngo to (blob v)\nchange y by (-5)\nif <<<key (right arrow v) pressed?> or <key (d v) pressed?>> and <(Xv) > [2]>> then\n    move (-1) steps\n    set [ghost v] effect to (0)\n    show\n    switch costume to (pick random (3) to (4))\n    repeat (10)\n        move (-1) steps\n        change y by (1.5)\n        change [ghost v] effect by (15)\n    end\n    hide\n    wait (0.1) seconds\nelse\n    if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> and <(Xv) < [-2]>> then\n        move (1) steps\n        set [ghost v] effect to (0)\n        show\n        switch costume to (pick random (1) to (2))\n        repeat (10)\n            move (2) steps\n            change y by (1.5)\n            change [ghost v] effect by (15)\n        end\n        hide\n        wait (0.1) seconds\n    else\n    end\nend\n\n@Spikes\n\nwhen flag clicked\npoint in direction (90)\nhide\nwait until <(Level) = [2]>\ncreate clone of (_myself_ v)\nswitch costume to (slanted v)\nshow\nforever\n    if <(Level) = [2]> then\n        go to x: (-29) y: (-36)\n    end\n    if <(Level) = [3]> then\n        switch costume to (costume2 v)\n        go to x: (15) y: (-36)\n    end\n    if <(Level) = [4]> then\n        switch costume to (costume2 v)\n        go to x: (-117) y: (-38)\n    end\n    if <(Level) = [5]> then\n        show\n        go to x: (-47) y: (-37)\n    end\n    if <(Level) = [6]> then\n        switch costume to (costume2 v)\n        show\n        go to x: (5) y: (137)\n    end\n    if <(Level) = [7]> then\n        go to x: (-50) y: (-36)\n        switch costume to (costume2 v)\n        show\n    end\n    if <(Level) = [8]> then\n        go to x: (-50) y: (-36)\n        switch costume to (costume2 v)\n        hide\n    end\nend\n\nwhen I start as a clone\nforever\n    repeat (3)\n        change [brightness v] effect by (25)\n    end\n    wait (1) seconds\n    repeat (3)\n        change [brightness v] effect by (-25)\n    end\nend\n\nwhen I start as a clone\nforever\n    if <(Level) = [3]> then\n        switch costume to (costume2 v)\n        go to x: (-29) y: (-36)\n    end\n    if <(Level) = [4]> then\n        show\n        go to x: (-19) y: (-37)\n    end\n    if <(Level) = [5]> then\n        show\n        go to x: (-203) y: (-36)\n    end\n    if <(Level) = [6]> then\n        show\n        go to x: (44) y: (137)\n    end\n    if <(Level) = [7]> then\n        show\n        go to x: (-8) y: (-36)\n    end\n    if <(Level) = [8]> then\n        hide\n    end\nend\n\nwhen I start as a clone\nshow\nif <(Level) = [2]> then\n    switch costume to (slanted v)\n    go to x: (34) y: (-22)\n    turn left (10) degrees\nend\nif <(Level) = [3]> then\n    switch costume to (costume2 v)\n    go to x: (-29) y: (-36)\nend\nif <(Level) = [4]> then\n    switch costume to (costume2 v)\n    go to x: (-19) y: (-37)\nend\nif <(Level) = [5]> then\n    switch costume to (costume2 v)\n    go to x: (-47) y: (-37)\nend\n\nwhen I start as a clone\nforever\n    if <(Level) = [3]> then\n        turn right (10) degrees\n        stop [this script v]\n    end\nend\n\nwhen flag clicked\nforever\n    repeat (3)\n        change [brightness v] effect by (25)\n    end\n    wait (1) seconds\n    repeat (3)\n        change [brightness v] effect by (-25)\n    end\nend\n\n@Spikes2\n\nwhen I start as a clone\nhide\nif <(Level) = [2]> then\n    show\n    switch costume to (slanted v)\n    go to x: (34) y: (-22)\n    turn left (10) degrees\nend\nif <(Level) = [3]> then\n    show\n    switch costume to (costume2 v)\n    turn right (10) degrees\n    go to x: (-29) y: (-36)\nend\nforever\n    if <(Level) = [4]> then\n        show\n        go to x: (118) y: (-36)\n    end\n    if <(Level) = [5]> then\n        show\n        point in direction (-90)\n        go to x: (-48) y: (-16)\n    end\n    if <(Level) = [6]> then\n        hide\n    end\n    if <(Level) = [7]> then\n        show\n        point in direction (90)\n        go to x: (90) y: (-37)\n    end\n    if <(Level) = [8]> then\n        hide\n    end\nend\n\nwhen flag clicked\npoint in direction (90)\nhide\ncreate clone of (_myself_ v)\nforever\n    if <(Level) = [3]> then\n        show\n        switch costume to (costume2 v)\n        go to x: (120) y: (-36)\n    end\n    if <(Level) = [5]> then\n        hide\n    end\n    if <(Level) = [7]> then\n        show\n        go to x: (170) y: (-37)\n    end\n    if <(Level) = [8]> then\n        hide\n        go to x: (170) y: (-37)\n    end\nend\n\nwhen flag clicked\nforever\n    repeat (3)\n        change [brightness v] effect by (25)\n    end\n    wait (1) seconds\n    repeat (3)\n        change [brightness v] effect by (-25)\n    end\nend\n\nwhen I start as a clone\nforever\n    repeat (3)\n        change [brightness v] effect by (25)\n    end\n    wait (1) seconds\n    repeat (3)\n        change [brightness v] effect by (-25)\n    end\nend\n\n@Water Drop\n\nwhen flag clicked\ngo [backward v] (100) layers\nhide\nset [clone id v] to [0]\nforever\n    create clone of (_myself_ v)\n    wait (0.5) seconds\nend\n\nwhen I start as a clone\ngo [backward v] (100) layers\nif <(Clone ID) = [1]> then\n    show\n    go to x: (15) y: (6)\n    Water Fall\nend\nif <(Clone ID) = [2]> then\n    show\n    go to x: (124) y: (41)\n    Water Fall\nend\nif <(Clone ID) = [3]> then\n    show\n    go to x: (217) y: (69)\n    Water Fall\nend\nif <(Clone ID) = [4]> then\n    show\n    go to x: (-126) y: (17)\n    Water Fall\nend\nif <(Clone ID) = [5]> then\n    show\n    go to x: (-196) y: (45)\n    Water Fall\nend\n\ndefine Water Fall\nrepeat until <touching color (#330066)?>\n    change y by (-5)\n    change [ghost v] effect by (2)\nend\ndelete this clone\n\nwhen flag clicked\nforever\n    change [clone id v] by (1)\n    if <(Clone ID) = [6]> then\n        set [clone id v] to [0]\n    end\nend\n\n@Fire Particle\n\nwhen flag clicked\ngo to x: (5) y: (-97)\nhide\nrepeat until <(Level) = [2]>\n    create clone of (_myself_ v)\nend\nhide\nwait until <(Level) = [3]>\ngo to x: (-53) y: (-42)\nrepeat until <(Level) = [4]>\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nshow\nrepeat (20)\n    change x by (pick random (-4) to (4))\n    change y by (pick random (1) to (4))\n    change [ghost v] effect by (5)\nend\ndelete this clone\n\n@Fire Particle2\n\nwhen flag clicked\ngo to x: (77) y: (-97)\nhide\nrepeat until <(Level) = [2]>\n    create clone of (_myself_ v)\nend\nhide\nwait until <(Level) = [3]>\ngo to x: (15) y: (-24)\nrepeat until <(Level) = [4]>\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nshow\nrepeat (20)\n    change x by (pick random (-4) to (4))\n    change y by (pick random (1) to (4))\n    change [ghost v] effect by (5)\nend\ndelete this clone\n\n@Fan\n\nwhen flag clicked\nhide\nwait until <(Level) = [5]>\ngo to x: (84) y: (-59)\nshow\nrepeat until <(Level) = [6]>\n    change [brightness v] effect by (10)\n    turn right (15) degrees\n    change [brightness v] effect by (-10)\nend\ngo to x: (155) y: (28)\nrepeat until <(Level) = [7]>\n    turn right (15) degrees\nend\nhide\n\nwhen flag clicked\nforever\n    change [brightness v] effect by (20)\n    wait (0.1) seconds\n    change [brightness v] effect by (-20)\nend\n\n@Fan2\n\nwhen flag clicked\nhide\nwait until <(Level) = [5]>\ngo to x: (153) y: (-61)\nshow\nrepeat until <(Level) = [6]>\n    change [brightness v] effect by (10)\n    turn right (15) degrees\n    change [brightness v] effect by (-10)\nend\nhide\n\n@wind\n\nwhen flag clicked\nhide\nforever\n    if <not <(Level) = [8]>> then\n        create clone of (_myself_ v)\n        wait (pick random (0.1) to (0.3)) seconds\n    end\nend\n\nwhen I start as a clone\ngo to x: (240) y: (pick random (-180) to (180))\nshow\nglide (3) secs to x: (-240) y: (pick random (-180) to (180))\ndelete this clone\n\n@Sprite1\n\nwhen flag clicked\nforever\n    hide\nend\n\n@Blob2\n\nwhen flag clicked\nforever\n    hide\nend\n\n@Fan3\n\nwhen flag clicked\nhide\nwait until <(Level) = [5]>\ngo to x: (-139) y: (-155)\nshow\nrepeat until <(Level) = [6]>\n    change [brightness v] effect by (10)\n    turn right (15) degrees\n    change [brightness v] effect by (-10)\nend\nhide\n\n@Fan4\n\nwhen flag clicked\nhide\nwait until <(Level) = [5]>\ngo to x: (-91) y: (-155)\nshow\nrepeat until <(Level) = [6]>\n    change [brightness v] effect by (10)\n    turn right (15) degrees\n    change [brightness v] effect by (-10)\nend\nhide\n\n@Boss Missiles\n\nwhen flag clicked\nhide\nwait until <(Level) = [8]>\nforever\n    create clone of (_myself_ v)\n    wait (pick random (0.3) to (0.4)) seconds\nend\n\nwhen I start as a clone\nforever\n    turn right (15) degrees\nend\n\nwhen I start as a clone\nset size to (pick random (90) to (110)) %\nset [brightness v] effect to (pick random (10) to (50))\nset [color v] effect to (pick random (10) to (100))\ngo to x: (pick random (-220) to (220)) y: (180)\nshow\nglide (1) secs to x: (pick random (-220) to (220)) y: (-180)\ndelete this clone\n\n@Tens\n\nwhen flag clicked\nhide\nwait until <(Level) = [8]>\nshow\ngo to x: (-15) y: (74)\nforever\n    if <<(Boss Fight Timer) > [10]> or <(Boss Fight Timer) = [10]>> then\n        switch costume to ((((Boss Fight Timer) - ((Boss Fight Timer) mod (10))) / (10)) + (2))\n    else\n        switch costume to (0-pixel v)\n    end\nend\n\nwhen I receive [escaped v]\nhide\n\n@Ones\n\nwhen flag clicked\nset [boss fight timer v] to [0]\nhide\nwait until <(Level) = [8]>\nshow\ngo to x: (15) y: (76)\nforever\n    if <<(Boss Fight Timer) > [10]> or <(Boss Fight Timer) = [10]>> then\n        switch costume to (((Boss Fight Timer) mod (10)) + (2))\n    else\n        switch costume to ((Boss Fight Timer) + (2))\n    end\nend\n\nwhen I receive [escaped v]\nhide\n\n