R.O.B.O.T (Platformer)

Instructions: Space Bar to Shoot\nClick the Grenade for a Grenade\nClick the Shield for a Shield\nDefeat all Robots to Finish the level                \nUnlock More Power Ups along the way!\nHold "R" if you get stuck 

@Stage\n\n@Sprite1\n\nwhen flag clicked\nhide\n\nshow\ngo to [front v] layer\n\nwhen I receive [next lvl v]\nerase all\n\n@Sprite6\n\nwhen I receive [gamestart v]\nset [ghost v] effect to (100)\nswitch costume to (stand v)\nset rotation style [left-right v]\ngo to x: (-200) y: (-85)\nshow\nset [x vel v] to [0]\nset [y vel v] to [0]\nforever\n    change [y vel v] by (-1)\n    if <key (left arrow v) pressed?> then\n        if <(Wave?) = [1]> then\n            change [x vel v] by (-0.3)\n        else\n            change [x vel v] by (-1)\n        end\n    end\n    if <key (right arrow v) pressed?> then\n        if <(Wave?) = [1]> then\n            change [x vel v] by (0.3)\n        else\n            change [x vel v] by (1)\n        end\n    end\n    set [x vel v] to ((X vel) * (0.9))\n    change x by (X vel)\n    if <touching color (#000000)?> then\n        change y by (1)\n    end\n    if <touching color (#000000)?> then\n        change y by (1)\n    end\n    if <touching color (#000000)?> then\n        change y by (1)\n    end\n    if <touching color (#000000)?> then\n        change y by (1)\n    end\n    if <touching color (#000000)?> then\n        change y by (-4)\n        change x by ((X vel) * (-1))\n        if <key (up arrow v) pressed?> then\n            set [y vel v] to [10]\n            if <([abs v] of (X vel) ) = (X vel)> then\n                set [x vel v] to [-10]\n            else\n                set [x vel v] to [10]\n            end\n        else\n            set [x vel v] to [0]\n        end\n    end\n    change y by (Y vel)\n    if <touching color (#000000)?> then\n        change y by ((Y vel) - ((Y vel) * (2)))\n        set [y vel v] to [0]\n    end\n    change y by (-1)\n    if <<key (up arrow v) pressed?> and <touching color (#000000)?>> then\n        set [y vel v] to [10]\n    end\n    change y by (1)\n    if <touching color (#8731c2)?> then\n        broadcast (portal v)\n    end\n    if <<touching (sprite12 v)?> and <([costume # v] of [sprite12 v]) = [7]>> then\n        set [y vel v] to [20]\n        set [tground v] to [0]\n    end\n    if <<touching (sprite9 v)?> and <([costume # v] of [sprite9 v]) = [4]>> then\n        set [wave? v] to [1]\n        broadcast (Slow v)\n    end\nend\n\nif <touching (edge v)?> then\n    broadcast (next lvl v)\n    go to x: (-200) y: (-85)\nend\n\ngo to x: (-200) y: (200)\nset [y vel v] to [0]\n\nset [tground v] to [1]\n\ndefine Shoot ( (1/2) )\nif <(1/2) = [1]> then\n    switch costume to (shoot2 v)\n    wait (0) seconds\n    switch costume to (shoot3 v)\n    wait (0.1) seconds\n    switch costume to (shoot2 v)\nelse\n    switch costume to (shoot11 v)\nend\nwait (0) seconds\nswitch costume to (shoot12 v)\nwait (0.1) seconds\nswitch costume to (shoot11 v)\n\nwhen I receive [respawn v]\nset [y vel v] to [0]\ngo to x: (-171) y: (90)\n\nwhen flag clicked\nforever\n    if <[237] < (x position)> then\n        if <not <<([costume # v] of [ground v]) = [16]> or <([costume # v] of [ground v]) = [22]>>> then\n            go to x: (-171) y: (90)\n            broadcast (next lvl v)\n        end\n    end\n    go to [front v] layer\n    show\n    set [ghost v] effect to (100)\nend\n\nwhen I receive [game start v]\n\nif <key (a v) pressed?> then\n    set [x vel v] to [0]\n    set [y vel v] to [0]\nend\n\nwhen backdrop switches to [backdrop1 v]\n\nwhen I receive [fight1 v]\ngo to x: (-171) y: (90)\n\nif <key (up arrow v) pressed?> then\n    set [y vel v] to [10]\nend\n\nwhen flag clicked\nforever\n    if <not <touching color (#000000)?>> then\nend\n\nwhen flag clicked\nforever\n    if <not <touching color (#000000)?>> then\n        set [tground v] to [0]\n    end\nend\n\ngo to x: (-171) y: (-90)\n\nwhen flag clicked\nforever\n    if <key (r v) pressed?> then\n        if <touching color (#5b5b5b)?> then\n            if <<touching (sprite3 v)?> and <not <color (#e5e5e5) is touching (#000000)?>>> then\n                change x by (-5)\n                set [x vel v] to [0]\n            end\n            change y by (10)\n            set [y vel v] to [0]\n        end\n    end\nend\n\nwhen I receive [cancel sink v]\nif <<touching (sprite12 v)?> or <touching (sprite16 v)?>> then\n    reset timer\n    repeat until <(letter (3) of (timer)) = [3]>\n        set [y vel v] to [0.6]\n    end\nend\n\nwhen I receive [boss1 v]\nwait (4.2) seconds\nset [y vel v] to [0]\nset [x vel v] to [0]\ngo to x: (-196) y: (-71)\n\nwhen flag clicked\nforever\n    if <<touching (sprite9 v)?> or <<touching (sprite3 v)?> or <touching (sprite16 v)?>>> then\n        change [phealth v] by (1)\n        wait (0.5) seconds\n    end\nend\n\nwhen I receive [back v]\nhide\n\nwhen I receive [b1 defeat v]\nwait (2) seconds\nset [y vel v] to [0]\nset [x vel v] to [0]\ngo to x: (-196) y: (100)\n\nwhen [a v] key pressed\nwait (1) seconds\ngo to x: (-171) y: (90)\n\nwhen I receive [slow v]\nwait (4) seconds\nset [wave? v] to [0]\n\nbroadcast (portal v)\n\n@Player\n\ndefine Run ( (1/2) )\nif <(TGround) = [1]> then\n    if <(1/2) = [1]> then\n        switch costume to (run v)\n        wait (0.1) seconds\n        repeat (2)\n            next costume\n            wait (0.1) seconds\n        end\n    else\n        switch costume to (run v)\n        wait (0.1) seconds\n        repeat (2)\n            next costume\n            wait (0.1) seconds\n        end\n    end\nend\n\nwhen flag clicked\nset [y vel v] to [0]\ngo to [front v] layer\nforever\n    go to (sprite6 v)\nend\n\nwhen flag clicked\nshow\n\nwhen I receive [gamestart v]\nforever\n    go to [front v] layer\nend\n\nwhen I receive [respawn v]\nshow\n\nwhen I receive [portal v]\nhide\n\nwhen I receive [gamestart v]\n\ngo to [front v] layer\n\nbroadcast (respawn v)\n\nif <(costume [number v]) = [12]> then\n    Shoot ( (4) )\nend\n\nturn left (360) degrees\n\ndefine Shoot ( (1/2) )\nif <(1/2) = [1]> then\n    switch costume to (shoot v)\n    wait (0) seconds\n    switch costume to (shoot2 v)\n    wait (0.1) seconds\n    switch costume to (shoot v)\nend\nif <(1/2) = [2]> then\n    switch costume to (shoot v)\n    wait (0) seconds\n    switch costume to (shoot2 v)\n    wait (0.1) seconds\n    switch costume to (shoot v)\nend\n\ndefine Jump\nswitch costume to (jump v)\nwait (0.1) seconds\nswitch costume to (jump2 v)\nwait (0.3) seconds\nrepeat until <(TGround) = [1]>\n    switch costume to (fall v)\nend\n\nif <(costume [number v]) = [12]> then\n    Shoot ( (3) )\nend\n\nif <[] = [0]> then\n    switch costume to (fall v)\nend\n\nwhen flag clicked\nforever\n\nwhen I receive [game start v]\nwait (0) seconds\nforever\n    if <key (right arrow v) pressed?> then\n        Run ( (1) )\n    end\n    if <key (left arrow v) pressed?> then\n        Run ( (2) )\n    end\n    if <key (up arrow v) pressed?> then\n        if <(TGround) = [1]> then\n            Jump\n        end\n    end\n    if <(TGround) = [1]> then\n        if <key (space v) pressed?> then\n            Shoot ( (1) )\n        end\n    end\n    if <<(TGround) = [1]> and <not <key (any v) pressed?>>> then\n        switch costume to (stand v)\n    end\n    if <(TGround) = [0]> then\n        switch costume to (fall v)\n    end\nend\n\nwhen flag clicked\nforever\n    if <color (#e5e5e5) is touching (#000000)?> then\n        set [tground v] to [1]\n    else\n        set [tground v] to [0]\n    end\nend\n\nwhen I receive [boss1 v]\n\ngo [backward v] (1) layers\n\nwhen I receive [boss1 v]\nhide\nwait (3) seconds\nshow\n\nwhen I receive [back v]\nhide\nswitch costume to (dead v)\ngo [backward v] (1) layers\n\nwhen I receive [gamestart v]\nshow\n\nwhen I receive [b1 defeat v]\nhide\nwait (1.5) seconds\nshow\n\nshow\n\nwhen I receive [game start v]\nwait (0) seconds\nforever\n    if <key (right arrow v) pressed?> then\n        set rotation style [left-right v]\n        point in direction (90)\n    end\n    if <key (left arrow v) pressed?> then\n        set rotation style [left-right v]\n        point in direction (-90)\n    end\nend\n\nwhen I receive [game finished v]\nhide\nset [eshoot? v] to [0]\n\n@Sprite8\n\nwhen I receive [portal v]\nswitch costume to (costume2 v)\ngo to [front v] layer\nset [ghost v] effect to (100)\ngo to x: (0) y: (0)\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (1) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\n    broadcast (respawn v)\nend\nhide\n\nwhen flag clicked\nhide\n\nwhen I receive [boss1 v]\nswitch costume to (costume2 v)\ngo to [front v] layer\nset [ghost v] effect to (100)\ngo to x: (0) y: (0)\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (3) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\n    broadcast (Fight1 v)\nend\nhide\nbroadcast (next lvl v)\n\nwhen flag clicked\nset [phealth v] to [1]\nhide\nwait until <(PHealth) = [41]>\nbroadcast (Back v)\nswitch costume to (costume1 v)\ngo to [front v] layer\nset [ghost v] effect to (100)\ngo to x: (0) y: (0)\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\n    go to [front v] layer\nend\nstop [all v]\n\nwhen I receive [back v]\nhide\n\nwhen I receive [b1 defeat v]\nswitch costume to (costume2 v)\ngo to [front v] layer\nset [ghost v] effect to (100)\ngo to x: (0) y: (0)\nshow\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\nwait (1) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nhide\n\nbroadcast (Fight1 v)\n\n@Ground\n\nwhen I receive [gamestart v]\nswitch costume to (costume1 v)\n\nwhen I receive [respawn v]\nswitch costume to (costume2 v)\n\nwhen flag clicked\nswitch costume to (costume1 v)\nforever\n    go to x: (0) y: (0)\nend\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    go [backward v] (1) layers\nend\n\nwhen I receive [next lvl v]\nnext costume\n\nwhen I receive [b1 defeat v]\n\nwhen I receive [b1 defeat v]\nwait (1) seconds\nrepeat (10)\n    switch costume to (costume17 v)\n    wait (0.1) seconds\n    switch costume to (costume17 v)\nend\n\nwait (0.4) seconds\nnext costume\n\nwhen flag clicked\nwait until <(costume [number v]) = [22]>\nbroadcast (Boss2 v)\n\n@Sprite3\n\ndefine Load Animation\nforever\n    if <(Eshoot?) = [1]> then\n        if <(E) = [1]> then\n            show\n            switch costume to (r1s v)\n            wait (1) seconds\n            switch costume to (r1 v)\n            wait (1) seconds\n            switch costume to (r1s v)\n            broadcast (eshoot v)\n        end\n        if <(E) = [2]> then\n            show\n            switch costume to (r3 v)\n            wait (2) seconds\n            broadcast (eshoot v)\n            switch costume to (r3s v)\n            wait (2) seconds\n            switch costume to (r3 v)\n        end\n        if <(E) = [3]> then\n            show\n            broadcast (eshoot v) and wait\n        end\n        if <(E) = [4]> then\n            show\n            switch costume to (r5s v)\n            wait (1) seconds\n            switch costume to (r5 v)\n            wait (1) seconds\n            switch costume to (r5s v)\n            broadcast (eshoot v)\n        end\n        if <(E) = [5]> then\n            show\n            switch costume to (r6 v)\n            wait (2) seconds\n            broadcast (eshoot v)\n            switch costume to (r6s v)\n            wait (2) seconds\n            switch costume to (r6 v)\n        end\n        if <(E) = [6]> then\n            show\n            switch costume to (r7 v)\n            wait (2) seconds\n            switch costume to (r7s v)\n            set [rsheild v] to [1]\n            wait (4) seconds\n            switch costume to (r7 v)\n            broadcast (eshoot v)\n        end\n    else\n        hide\n    end\nend\n\nbroadcast (eshoot v)\n\nif <(E) = [4]> then\nwait (2) seconds\n\nhide\n\nwhen flag clicked\nwait (0.1) seconds\nLvl ([costume # v] of [ground v])\n\nshow\ngo to [front v] layer\n\nwhen flag clicked\nLoad Animation\nLoad\nforever\n    go to [front v] layer\nend\n\nwhen I receive [next lvl v]\nwait (0.2) seconds\nLvl ([costume # v] of [ground v])\n\nwhen I start as a clone\nif <<(costume [number v]) = [3]> or <(costume [number v]) = [4]>> then\n    forever\n        set rotation style [left-right v]\n        repeat until <touching color (#000000)?>\n            point in direction (-90)\n            change x by (3)\n        end\n        point in direction (90)\n        change x by (-10)\n        repeat until <touching color (#000000)?>\n            point in direction (90)\n            change x by (-3)\n        end\n        point in direction (-90)\n        change x by (10)\n    end\nend\n\ndefine Lvl (#)\nif <(#) = [1]> then\n    Robot Type [0] How Many [] x [] y []\nend\nif <(#) = [2]> then\n    Robot Type [0] How Many [] x [] y []\nend\nif <(#) = [3]> then\n    Robot Type [1] How Many [1] x [150] y [-66]\nend\nif <(#) = [4]> then\n    Robot Type [1] How Many [1] x [168] y [32]\nend\nif <(#) = [5]> then\n    Robot Type [2] How Many [2] x [-84] y [-87]\n    Robot Type [2] How Many [2] x [84] y [-87]\nend\nif <(#) = [6]> then\n    Robot Type [2] How Many [2] x [-84] y [-87]\n    Robot Type [2] How Many [2] x [84] y [-87]\nend\nif <(#) = [7]> then\n    Robot Type [3] How Many [1] x [156] y [36]\nend\nif <(#) = [8]> then\n    Robot Type [2] How Many [3] x [-84] y [-87]\n    Robot Type [2] How Many [3] x [84] y [-87]\n    Robot Type [3] How Many [3] x [156] y [36]\nend\nif <(#) = [9]> then\n    Robot Type [4] How Many [1] x [-35] y [123]\nend\nif <(#) = [10]> then\n    Robot Type [2] How Many [3] x [-96] y [-46]\n    Robot Type [2] How Many [3] x [109] y [-46]\n    Robot Type [4] How Many [3] x [-35] y [123]\nend\nif <(#) = [11]> then\n    Robot Type [0] How Many [0] x [0] y [0]\nend\nif <(#) = [12]> then\n    Robot Type [1] How Many [1] x [179] y [35]\nend\nif <(#) = [13]> then\n    Robot Type [3] How Many [1] x [179] y [35]\nend\nif <(#) = [14]> then\n    Robot Type [0] How Many [0] x [0] y [0]\nend\nif <(#) = [15]> then\n    Robot Type [0] How Many [1] x [0] y [0]\nend\nif <(#) = [16]> then\n    Robot Type [0] How Many [1] x [0] y [0]\nend\nif <(#) = [17]> then\nif <(#) = [18]> then\n    Robot Type [2] How Many [2] x [25] y [-59]\n    Robot Type [2] How Many [2] x [-25] y [-59]\nend\nif <(#) = [19]> then\n    Robot Type [6] How Many [1] x [150] y [35]\nend\nif <(#) = [20]> then\n    Robot Type [7] How Many [1] x [150] y [35]\nend\n\nshow\n\nwhen flag clicked\n\nwhen I start as a clone\nif <<(costume [number v]) = [3]> or <(costume [number v]) = [4]>> then\n    forever\n        switch costume to (r2 v)\n        wait (0.1) seconds\n        switch costume to (r2s v)\n        wait (0.1) seconds\n        if <<touching (sprite12 v)?> and <([costume # v] of [sprite12 v]) = [3]>> then\n            repeat (2)\n                switch costume to (r2s2 v)\n                wait (0.1) seconds\n                switch costume to (r2s3 v)\n                wait (0.1) seconds\n            end\n            repeat (10)\n                change [ghost v] effect by (10)\n            end\n            change [#robots v] by (-1)\n            delete this clone\n        end\n    end\nend\nif <(costume [number v]) = [10]> then\n    set rotation style [left-right v]\n    point in direction (90)\n    repeat until <(#Robots) = [0]>\n        switch costume to (r5 v)\n        wait (0.1) seconds\n        switch costume to (r5s v)\n        wait (0.1) seconds\n        switch costume to (r5s1 v)\n        wait (1) seconds\n    end\nend\n\ndefine Health (#)\nset [health v] to (#)\nclear graphic effects\nrepeat until <[1] > (Health)>\n    if <<touching (sprite5 v)?> and <(RSheild) = [0]>> then\n        clear graphic effects\n        set [brightness v] effect to (0)\n        repeat (5)\n            change [brightness v] effect by (2)\n        end\n        change [health v] by (-1)\n        repeat (5)\n            change [brightness v] effect by (-2)\n        end\n    end\nend\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nset [brightness v] effect to (0)\nhide\nset [eshoot? v] to [0]\nchange [#robots v] by (-1)\n\ngo to x: (86) y: (88)\n\nswitch costume to (r3s v)\nwait (2) seconds\nswitch costume to (r3 v)\n\ndefine Drone\nrepeat until <(Eshoot?) = [0]>\n    switch costume to (r4 v)\n    repeat until <<touching (_edge_ v)?> or <touching color (#666666)?>>\n        go to [front v] layer\n        change x by (10)\n    end\n    change x by (-25)\n    repeat until <<touching (_edge_ v)?> or <touching color (#666666)?>>\n        go to [front v] layer\n        change x by (-10)\n    end\n    change x by (25)\nend\n\nhide\n\nbroadcast (eshoot v)\n\nwhen I receive [shoot cycle v]\nrepeat until <(Eshoot?) = [0]>\n    wait (1.5) seconds\n    broadcast (eshoot v)\nend\n\nwhen flag clicked\nforever\n    if <(costume [number v]) = [9]> then\n        if <<([costume # v] of [sprite12 v]) = [3]> and <touching (sprite12 v)?>> then\n            repeat (10)\n                change [ghost v] effect by (10)\n                set [eshoot? v] to [0]\n            end\n            change [#robots v] by (-1)\n        end\n    end\nend\n\nforever\n    switch costume to (r5 v)\nend\n\nwhen flag clicked\nforever\n\nwhen I receive [boss1 v]\ngo [backward v] (1) layers\n\ndefine Load\n\nforever\n\nif <[] = [1]> then\n    if <(E) = [1]> then\n    if <(E) = [2]> then\n        wait (2) seconds\n        wait (2) seconds\n    end\n    if <(E) = [3]> then\n        show\n        broadcast (eshoot v) and wait\n    end\n    if <(E) = [4]> then\nelse\n    hide\nend\n\nshow\n\nwait (1) seconds\n\nwhen flag clicked\nLoad\n\nwhen [a v] key pressed\n\nwhen I receive [b1 defeat v]\nwait (1) seconds\nLvl ([costume # v] of [ground v])\n\ndefine Robot Type (r) How Many (#) x (x) y (y)\nif <(r) = [0]> then\n    hide\n    set [eshoot? v] to [0]\n    set [#robots v] to (#)\n    set [e v] to [0]\nend\nif <(r) = [1]> then\n    switch costume to (r1 v)\n    set size to (100) %\n    show\n    go to [front v] layer\n    go to x: (x) y: (y)\n    set [eshoot? v] to [1]\n    set [#robots v] to (#)\n    set [e v] to [1]\n    Health [5]\nend\nif <(r) = [2]> then\n    set [e v] to [0]\n    set [eshoot? v] to [0]\n    set [#robots v] to (#)\n    set size to (100) %\n    show\n    clear graphic effects\n    switch costume to (r2 v)\n    go to x: (x) y: (y)\n    create clone of (_myself_ v)\n    hide\nend\nif <(r) = [3]> then\n    set [e v] to [2]\n    set [#robots v] to (#)\n    set [eshoot? v] to [1]\n    go to x: (x) y: (y)\n    set size to (100) %\n    show\n    switch costume to (r3 v)\n    Health [5]\nend\nif <(r) = [4]> then\n    set [#robots v] to (#)\n    set [eshoot? v] to [1]\n    set [e v] to [3]\n    clear graphic effects\n    switch costume to (r4 v)\n    set size to (200) %\n    go to x: (x) y: (y)\n    broadcast (Shoot Cycle v)\n    Drone\nend\nif <(r) = [5]> then\n    set [eshoot? v] to [1]\n    set [#robots v] to (#)\n    set [e v] to [4]\n    set size to (100) %\n    switch costume to (r5s v)\n    show\n    go to [front v] layer\n    go to x: (x) y: (y)\n    Health [10]\nend\nif <(r) = [6]> then\n    set [eshoot? v] to [1]\n    set [#robots v] to (#)\n    set [e v] to [5]\n    set size to (100) %\n    switch costume to (r6 v)\n    show\n    go to [front v] layer\n    go to x: (x) y: (y)\n    Health [10]\nend\nif <(r) = [7]> then\n    set [eshoot? v] to [1]\n    set [#robots v] to (#)\n    set [e v] to [6]\n    set size to (100) %\n    switch costume to (r7 v)\n    show\n    go to [front v] layer\n    go to x: (x) y: (y)\n    Health [10]\nend\n\nwhen I receive [next lvl v]\nset [rsheild v] to [0]\n\nwhen I receive [b1 defeat v]\nwait (4) seconds\nRobot Type [5] How Many [1] x [150] y [35]\n\n@Sprite5\n\nwhen flag clicked\n\nwhen I receive [gamestart v]\nwait (1) seconds\nforever\n    if <<key (space v) pressed?> and <(TGround) = [1]>> then\n        Shoot\n    end\nend\n\ndefine Shoot\nshow\ngo to (player v)\nif <([direction v] of [player v]) = [90]> then\n    repeat until < or <touching (_edge_ v)?>>\n        point in direction (90)\n        switch costume to (costume2 v)\n        show\n        change x by (30)\n        go to [front v] layer\n    end\n    if <touching (sprite3 v)?> then\n        switch costume to (costume3 v)\n        create clone of (_myself_ v)\n    end\n    go to (player v)\n    hide\nelse\n    repeat until < or <touching (_edge_ v)?>>\n        point in direction (90)\n        switch costume to (costume2 v)\n        show\n        change x by (-30)\n        go to [front v] layer\n    end\n    if <touching (sprite3 v)?> then\n        switch costume to (costume3 v)\n        create clone of (_myself_ v)\n        point in direction (pick random (0) to (360))\n    end\n    go to (player v)\n    hide\nend\n\nhide\n\ngo to [front v] layer\n\nwhen I receive [boss1 v]\ngo [backward v] (1) layers\n\nwhen I start as a clone\npoint in direction (pick random (0) to (360))\nwait (0.2) seconds\nrepeat (10)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\n@Sprite9\n\nwhen I receive [eshoot v]\ngo to (sprite3 v)\nif <(Eshoot?) = [1 ]> then\n    if <(E) = [1]> then\n        set size to (100) %\n        go to (sprite3 v)\n        switch costume to (shoot v)\n        show\n        repeat until <<<touching (_edge_ v)?> or <touching (sprite6 v)?>> or <touching (sprite11 v)?>>\n            go to [front v] layer\n            change x by (-20)\n        end\n        wait (0.1) seconds\n        hide\n    end\n    if <(E) = [2]> then\n        set [del lazer v] to [0]\n        clear graphic effects\n        set size to (100) %\n        go to x: ([x position v] of [sprite3 v]) y: (([y position v] of [sprite3 v]) + (4))\n        show\n        switch costume to (shoot2 v)\n        show\n        create clone of (_myself_ v)\n        show\n        repeat until <<touching (_edge_ v)?> or <touching (sprite11 v)?>>\n            change x by (-35)\n            show\n            create clone of (_myself_ v)\n        end\n        wait (2) seconds\n        set [del lazer v] to [1]\n        hide\n        wait (4) seconds\n    end\n    if <(E) = [3]> then\n        go to (sprite3 v)\n        show\n        set size to (100) %\n        switch costume to (shoot3 v)\n        show\n        repeat until <touching color (#000000)?>\n            change y by (-9)\n        end\n    end\n    if <(E) = [4]> then\n        clear graphic effects\n        set size to (100) %\n        go to (sprite3 v)\n        show\n        switch costume to (shoot4 v)\n        show\n        repeat until <<touching (_edge_ v)?> or <touching (sprite11 v)?>>\n            change x by (-9)\n            change size by (10)\n            change [ghost v] effect by (2)\n        end\n        wait (0.1) seconds\n        hide\n    end\n    if <(E) = [5]> then\n        set [del lazer v] to [0]\n        clear graphic effects\n        set size to (100) %\n        go to x: ([x position v] of [sprite3 v]) y: (([y position v] of [sprite3 v]) + (4))\n        show\n        switch costume to (shoot5a v)\n        show\n        create clone of (_myself_ v)\n        show\n        repeat until <<touching (_edge_ v)?> or <touching (sprite11 v)?>>\n            change x by (-35)\n            create clone of (_myself_ v)\n        end\n        wait (2) seconds\n        set [del lazer v] to [1]\n        hide\n        wait (2) seconds\n    end\n    if <(E) = [6]> then\n        hide\n        if <(costume [number v]) = [15]> then\n            set [rsheild v] to [1]\n        else\n            set [rsheild v] to [0]\n        end\n    end\nelse\n    hide\nend\n\nwhen flag clicked\nhide\nforever\n    if <(Eshoot?) = [0]> then\n        set [ghost v] effect to (100)\n        hide\n    else\n        set [ghost v] effect to (0)\n    end\nend\n\n\n\nrepeat until <<<touching (_edge_ v)?> or <touching (player v)?>> or <touching (sprite11 v)?>>\n    go to [front v] layer\n    change x by (-20)\nend\nwait (0.1) seconds\nhide\n\nhide\nwait (2) seconds\n\nset size to (100) %\n\nset size to (100) %\n\nset size to (100) %\n\nset size to (100) %\n\nset size to (100) %\n\nhide\n\nchange y by (-9)\n\nhide\n\nwhen I start as a clone\nif <(costume [number v]) = [5]> then\n    forever\n        if <(Del Lazer) = [0]> then\n            switch costume to (shoot5a v)\n            wait (0.05) seconds\n            switch costume to (shoot5b v)\n            wait (0.05) seconds\n        else\n            delete this clone\n        end\n    end\nend\nif <(costume [number v]) = [2]> then\n    forever\n        if <(Del Lazer) = [0]> then\n            show\n        else\n            delete this clone\n        end\n    end\nend\n\ngo to (sprite3 v)\n\ngo to (sprite3 v)\nshow\nset size to (500) %\nswitch costume to (shoot2 v)\nwait (2) seconds\nhide\nwait (2) seconds\n\n@Sprite11\n\nwhen I receive [sheild v]\nAnimation\nif <(Ground) = [1]> then\n\ndefine Animation\nswitch costume to (costume5 v)\nclear graphic effects\ngo to (sprite6 v)\nset [ghost v] effect to (100)\nrepeat (4)\n    change [ghost v] effect by (-25)\nend\nswitch costume to (costume5 v)\ngo to (sprite6 v)\nshow\ncreate clone of (_myself_ v)\nhide\nrepeat (4)\n    change [ghost v] effect by (25)\nend\n\nwhen I start as a clone\nswitch costume to (costume5 v)\nrepeat (4)\n    next costume\nend\nwait (5) seconds\nswitch costume to (costume2 v)\nrepeat (6)\n    change [brightness v] effect by (15)\n    change [ghost v] effect by (10)\nend\nrepeat (4)\n    change [brightness v] effect by (15)\n    change [ghost v] effect by (10)\n    switch costume to ((costume [number v]) - (1))\n    delete this clone\nend\n\nwhen I receive [boss1 v]\ngo [backward v] (1) layers\n\nshow\n\n@Extra\n\n@Sprite12\n\nwhen I receive [grenade aim v]\nswitch costume to (aim v)\nshow\nwait (0.2) seconds\nrepeat until <mouse down?>\n    go to [front v] layer\n    go to (mouse-pointer v)\nend\nswitch costume to (grenade v)\nset y to (200)\nrepeat until <<touching color (#000000)?> or <touching color (#666666)?>>\n    change y by (-20)\nend\nrepeat (2)\n    set y to (0)\n    show\n    switch costume to (explosion v)\n    broadcast (Cancel Sink v)\n    wait (0.3) seconds\n    hide\nend\n\nwhen I receive [brick aim v]\nswitch costume to (aim2 v)\nshow\nwait (0.2) seconds\nrepeat until <mouse down?>\n    go to [front v] layer\n    go to (mouse-pointer v)\nend\nswitch costume to (brick v)\nstamp\n\nwhen flag clicked\nerase all\nhide\n\nwhen I receive [next lvl v]\nhide\n\nwhen I receive [trampoline aim v]\nswitch costume to (aim3 v)\nshow\nwait (0.2) seconds\nrepeat until <mouse down?>\n    go to [front v] layer\n    go to (mouse-pointer v)\nend\nswitch costume to (trampoline v)\nstamp\n\n@Sprite7\n\nwhen flag clicked\nwait (0.1) seconds\ngo to x: (0) y: (0)\nshow\ngo to [front v] layer\nswitch costume to (costume1 v)\ngo to [front v] layer\nrepeat (4)\n    wait (1) seconds\n    wait until <key (space v) pressed?>\n    next costume\nend\nwait (1) seconds\nwait until <key (space v) pressed?>\nhide\nbroadcast (gamestart v)\nbroadcast (gamestart v)\nbroadcast (game start v)\nstop [other scripts in sprite v]\nwait (1) seconds\nbroadcast (game start v)\n\nwhen flag clicked\nwait until <key (s v) pressed?>\nhide\nbroadcast (gamestart v)\nbroadcast (game start v)\nstop [other scripts in sprite v]\nwait (1) seconds\nbroadcast (game start v)\n\n\n\nwhen I receive [game finished v]\nset [ghost v] effect to (100)\nshow\nswitch costume to (costume6 v)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\ngo to [front v] layer\nwait (1.5) seconds\nwait until <key (space v) pressed?>\nnext costume\n\nwait (1) seconds\n\n@Sprite10\n\nwhen I start as a clone\nforever\n    go to [front v] layer\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        if <(costume [number v]) = [2]> then\n            if <(TGround) = [1]> then\n                broadcast (grenade aim v)\n                set [brightness v] effect to (-30)\n                wait (7) seconds\n                set [brightness v] effect to (0)\n            end\n        end\n        if <(costume [number v]) = [3]> then\n            if <(TGround) = [1]> then\n                broadcast (sheild v)\n                set [brightness v] effect to (-30)\n                wait (7) seconds\n                set [brightness v] effect to (0)\n            end\n        end\n        if <(costume [number v]) = [4]> then\n            if <(TGround) = [1]> then\n                broadcast (Brick Aim v)\n                set [brightness v] effect to (-30)\n                wait (7) seconds\n                set [brightness v] effect to (0)\n            end\n        end\n        if <(costume [number v]) = [5]> then\n            broadcast (Trampoline Aim v)\n            set [brightness v] effect to (-30)\n            wait (7) seconds\n            set [brightness v] effect to (0)\n        end\n    end\nend\n\nwhen I receive [gamestart v]\n\nwhen flag clicked\nhide\nwait until <([costume # v] of [ground v]) = [3]>\nshow\ngo to x: (210) y: (152)\nswitch costume to (sheild v)\ncreate clone of (_myself_ v)\ngo to x: (160) y: (152)\nswitch costume to (grenade v)\ncreate clone of (_myself_ v)\nhide\n\nwhen flag clicked\nwait until <([costume # v] of [ground v]) = [11]>\nshow\ngo to x: (110) y: (152)\nswitch costume to (brick v)\ncreate clone of (_myself_ v)\nwait until <([costume # v] of [ground v]) = [12]>\nshow\ngo to x: (60) y: (152)\nswitch costume to (trampoline v)\ncreate clone of (_myself_ v)\nhide\n\nwhen I receive [boss1 v]\ngo [backward v] (1) layers\n\nforever\n\nwhen I start as a clone\nwait until <(Game Ended) = [1]>\ndelete this clone\n\nwhen flag clicked\nset [game ended v] to [0]\n\nwhen I receive [game finished v]\nset [game ended v] to [1]\n\n@Sprite4\n\nwhen I receive [next lvl v]\ngo to x: (0) y: (0)\ngo to [front v] layer\nshow\nclear graphic effects\nwait (0.5) seconds\nset [ghost v] effect to (0)\ngo to [front v] layer\nwait until <(#Robots) < [1]>\nrepeat (20)\n    change [ghost v] effect by (5)\nend\n\nwhen flag clicked\nforever\n    switch costume to ([costume # v] of [ground v])\nend\n\nwhen flag clicked\nwait (0.1) seconds\nswitch costume to ([costume # v] of [ground v])\n\n@Sprite13\n\nwhen flag clicked\nforever\n    next costume\n    wait (0.1) seconds\nend\n\nwhen flag clicked\nforever\n    hide\n    if <([costume # v] of [ground v]) = [11]> then\n        show\n    end\nend\n\n@Sprite2\n\nwhen flag clicked\nwait until <([costume # v] of [ground v]) = [2]>\nswitch costume to (glass v)\nhide\ngo to [front v] layer\nwait until <([costume # v] of [ground v]) = [15]>\nshow\nforever\n    if <touching (sprite5 v)?> then\n        go to [front v] layer\n        next costume\n        wait (0.3) seconds\n    end\nend\n\nwhen flag clicked\nswitch costume to (glass v)\nhide\ngo to x: (-14) y: (56)\nwait until <(costume [number v]) = [6]>\nbroadcast (Boss1 v)\n\nwhen I receive [boss1 v]\nstop [other scripts in sprite v]\nhide\n\nset [#robots v] to [0]\n\nwhen flag clicked\n\n@Sprite15\n\nwhen I receive [boss1 v]\nwait (3) seconds\nshow\ngo to x: (96) y: (58)\nrepeat until <(Health) = [0]>\n    set [r v] to (pick random (7) to (9))\n    if <(R) = [7]> then\n        switch costume to (glass6 v)\n        set rotation style [left-right v]\n        set [r v] to (pick random (1) to (6))\n        if <(R) = [1]> then\n            Animation\n            go to x: (96) y: (58)\n            point in direction (90)\n            Animation2\n        end\n        if <(R) = [2]> then\n            Animation\n            go to x: (-96) y: (58)\n            point in direction (-90)\n            Animation2\n        end\n        if <(R) = [3]> then\n            Animation\n            go to x: (-169) y: (152)\n            point in direction (-90)\n            Animation2\n        end\n        if <(R) = [4]> then\n            Animation\n            go to x: (169) y: (152)\n            point in direction (90)\n            Animation2\n        end\n        if <(R) = [5]> then\n            Animation\n            go to x: (-169) y: (-97)\n            point in direction (-90)\n            Animation2\n        end\n        if <(R) = [6]> then\n            Animation\n            go to x: (169) y: (-97)\n            point in direction (90)\n            Animation2\n        end\n    end\n    if <<(R) = [8]> or <(R) = [9]>> then\n        switch costume to (glass2 v)\n        broadcast (B Shoot v)\n        set [r v] to [0]\n    end\n    wait (1.3) seconds\nend\n\ndefine Animation\nrepeat (10)\n    change [brightness v] effect by (10)\n    change [ghost v] effect by (10)\nend\n\nwait (1) seconds\n\ndefine Animation2\nrepeat (10)\n    change [brightness v] effect by (-10)\n    change [ghost v] effect by (-10)\nend\nclear graphic effects\n\nclear graphic effects\n\nwhen flag clicked\nhide\n\ndefine Health (#)\nset [health v] to (#)\nclear graphic effects\nrepeat until <(Health) = [0]>\n    if <touching (sprite5 v)?> then\n        clear graphic effects\n        set [brightness v] effect to (0)\n        repeat (5)\n            change [brightness v] effect by (2)\n        end\n        change [health v] by (-1)\n        repeat (5)\n            change [brightness v] effect by (-2)\n        end\n    end\nend\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nset [brightness v] effect to (0)\nhide\nif <([costume # v] of [ground v]) = [22]> then\n    broadcast (Game finished v)\nelse\n    broadcast (B1 Defeat v)\nend\n\nwhen I receive [boss1 v]\nHealth [15]\n\nwhen I receive [boss2 v]\nset rotation style [left-right v]\nwait (3) seconds\nshow\npoint in direction (-90)\ngo to x: (96) y: (58)\ngo to x: (-169) y: (-97)\nrepeat until <(Health) = [0]>\n    set [r v] to (pick random (7) to (9))\n    if <(R) = [7]> then\n        switch costume to (glass6 v)\n        set rotation style [left-right v]\n        set [r v] to (pick random (1) to (6))\n        if <(R) = [1]> then\n            Animation\n            go to x: (-169) y: (-97)\n            point in direction (90)\n            Animation2\n        end\n        if <(R) = [2]> then\n            Animation\n            go to x: (169) y: (-97)\n            point in direction (-90)\n            Animation2\n        end\n        if <(R) = [3]> then\n            Animation\n            go to x: (-13) y: (127)\n            point in direction (-90)\n            Animation2\n        end\n        if <(R) = [4]> then\n            Animation\n            go to x: (-169) y: (-97)\n            point in direction (-90)\n            Animation2\n        end\n        if <(R) = [5]> then\n            Animation\n            go to x: (169) y: (-97)\n            point in direction (90)\n            Animation2\n        end\n        if <(R) = [6]> then\n            Animation\n            go to x: (-16) y: (-27)\n            point in direction (90)\n            Animation2\n        end\n    end\n    if <<(R) = [8]> or <(R) = [9]>> then\n        switch costume to (glass2 v)\n        broadcast (B Shoot v)\n        set [r v] to [0]\n    end\n    wait (1.3) seconds\nend\n\nwhen I receive [boss2 v]\nHealth [15]\n\n@Sprite16\n\nwhen I receive [b shoot v]\nif <<([costume # v] of [ground v]) = [16]> or <([costume # v] of [ground v]) = [22]>> then\n    show\n    go to x: (pick random (-200) to (200)) y: (0)\n    if <touching (sprite15 v)?> then\n        repeat until <not <touching (sprite15 v)?>>\n            change x by (10)\n        end\n    end\n    Animation\nend\n\ndefine Animation\ngo to [front v] layer\nrepeat (2)\n    set [ghost v] effect to (100)\n    repeat (5)\n        change [ghost v] effect by (-20)\n        broadcast (Cancel Sink v)\n    end\n    wait (1) seconds\n    repeat (5)\n        change [ghost v] effect by (20)\n        broadcast (Cancel Sink v)\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [b1 defeat v]\nwait (1) seconds\nstop [other scripts in sprite v]\nhide\n\n\n@Sprite17\n\ndefine Animation\nswitch costume to (costume1 v)\nwait (1) seconds\nrepeat (10)\n    next costume\nend\n\nchange y by (1)\n\n@Sprite18\n\nwhen flag clicked\n\ngo to (player v)\n\nwhen I receive [gamestart v]\nhide\nset [phealth v] to [1]\nwait (0.5) seconds\ngo to [front v] layer\nforever\n    switch costume to (PHealth)\n    go to x: (([x position v] of [player v]) - (3)) y: (([y position v] of [player v]) + (10))\n    set size to (60) %\n    show\nend\n\nwhen [h v] key pressed\nset [phealth v] to [1]\n\n@Sprite14\n\nwhen flag clicked\nclear graphic effects\nhide\nwait until <([costume # v] of [ground v]) = [14]>\nshow\ngo to x: (-14) y: (63)\nwait until <touching (player v)?>\nrepeat (10)\n    change [brightness v] effect by (15)\n    change [ghost v] effect by (10)\nend\nrepeat until <(PHealth) = [1]>\n    change [phealth v] by (-1)\nend\nset [phealth v] to [1]\nhide\n\nset [phealth v] to [40]\n\n