The Red Plumber || A platformer WORLD 2

Instructions: WORLD 1:\nhttps://scratch.mit.edu/projects/403120685\nWORLD 3:\nhttps://scratch.mit.edu/projects/403890228/\nWORLD 4:\nhttps://scratch.mit.edu/projects/408087656/\nWORLD 5:\nhttps://scratch.mit.edu/projects/412302168/\nWORLD 6:\nhttps://scratch.mit.edu/projects/435867365/\n\nPrincess Peach has been kidnapped by Bowser again! It's up to you, Mario, with the help of Yellow Toad to get her back! Now that you've gotten past the grasslands, it's time to conquer the hot sands of the desert!\n=====Info=====\nTHIS PROJECT IS INSPIRED BY THE RED NINJA. IT'S LIKE  A "DLC" IF YOU WILL.\nThe Red Ninja: https://scratch.mit.edu/projects/401255085/\nThe Red Ninja 2: https://scratch.mit.edu/projects/402521703/\nThe Red Ninja 3:\nhttps://scratch.mit.edu/projects/402980379\n=====Controls=====\nMove and Swim || Arrow keys or mobile tap\nShoot || Space or “Use weapon” button\nSwitch Weapon || Z or “Switch weapon” button\nAll levels are possible!

@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\nclear graphic effects\nwait until <([costume # v] of [level v]) = [12]>\nset [brightness v] effect to (10)\nwait until <([costume # v] of [level v]) = [13]>\nclear graphic effects\nswitch backdrop to (costume1 v)\n\nwhen I receive [huh v]\nrepeat (10)\n    change [ghost v] effect by (10)\nend\nbroadcast (Next level v)\nrepeat (10)\n    change [ghost v] effect by (-10)\nend\n\n@Blank\n\n@Player\n\nwhen flag clicked\nswitch costume to (hitbox v)\nshow\nforever\n    if <<(x position) > [240]> and <touching (_edge_ v)?>> then\n        broadcast (Next level v)\n    end\n    if <<<(y position) < [-170]> and <touching (_edge_ v)?>> or <touching (lava v)?>> then\n        broadcast (Restart v)\n        create clone of (_myself_ v)\n    end\n    if <touching (bounce v)?> then\n        set [y v] to [20]\n    end\nend\n\nwhen [r v] key pressed\nbroadcast (Restart v)\n\nwhen I receive [restart v]\ngo to x: (-220) y: (-30)\npoint in direction (90)\nset [y v] to [0]\nset [x v] to [0]\nbroadcast (Setup Enemies v)\n\nwhen I start as a clone\nclear graphic effects\nset rotation style [all around v]\nrepeat (20)\n    turn right (15) degrees\n    change y by (10)\n    change [ghost v] effect by (5)\nend\ndelete this clone\n\nwhen flag clicked\nforever\n    if <touching (water v)?> then\n        change [y v] by (0.7)\n        if <<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> then\n            change [y v] by (1)\n        end\n        if <<key (down arrow v) pressed?> or <<mouse down?> and <(y position) > (mouse y)>>> then\n            change [y v] by (-1)\n        end\n    end\nend\n\nwhen flag clicked\nbroadcast (Restart v)\nswitch costume to (costume1 v)\nshow\nset [x v] to [0]\nset [y v] to [0]\nforever\n    switch costume to (a0 v)\n    go to [front v] layer\n    if <not <touching (water v)?>> then\n        change [y v] by (-1)\n    end\n    if <<key (left arrow v) pressed?> or <<mouse down?> and <(mouse x) < (x position)>>> then\n        change [x v] by (-1)\n        point in direction (-90)\n    end\n    if <<key (right arrow v) pressed?> or <<mouse down?> and <(x position) < (mouse x)>>> then\n        change [x v] by (1)\n        point in direction (90)\n    end\n    set [x v] to ((x) * (0.9))\n    change x by (x)\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (1)\n    end\n    if <touching (level v)?> then\n        change y by (-4)\n        change x by ((x) * (-1))\n        if <<<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> and <not <touching (water v)?>>> then\n            set [y v] to [15]\n            if <([abs v] of (x) ) = (x)> then\n                set [x v] to [-10]\n            else\n                set [x v] to [10]\n            end\n        else\n            set [x v] to [0]\n        end\n    end\n    change y by (y)\n    if <touching (level v)?> then\n        change y by ((y) - ((y) * (2)))\n        set [y v] to [0]\n    end\n    change y by (-1)\n    if <<<key (up arrow v) pressed?> or <<mouse down?> and <(mouse y) > (y position)>>> and <touching (level v)?>> then\n        set [y v] to [15]\n    end\n    change y by (1)\n    switch costume to (join [A] (Weapon Number))\nend\n\nclear graphic effects\nset rotation style [all around v]\nrepeat (20)\n    turn right (15) degrees\n    change y by (10)\n    change [ghost v] effect by (5)\nend\ndelete this clone\n\nwhen flag clicked\nset [weapon number v] to [1]\nset [weapon max v] to [3]\nbroadcast (W1 v)\nbroadcast (W2 v)\nbroadcast (W3 v)\nforever\n    if <key (z v) pressed?> then\n        if <not <(Weapon MAX) = [0]>> then\n            if <(Weapon Number) = (Weapon MAX)> then\n                set [weapon number v] to [1]\n            else\n                change [weapon number v] by (1)\n            end\n        end\n    end\n    wait until <not <key (z v) pressed?>>\nend\n\nwhen I receive [switch costume v]\nswitch costume to (a0 v)\n\nwait until <not <key (space v) pressed?>>\n\n\n    change [y v] by (-1.5)\nend\n\nwhen I receive [switch weapon v]\nif <not <(Weapon MAX) = [0]>> then\n    if <(Weapon Number) = (Weapon MAX)> then\n        set [weapon number v] to [1]\n    else\n        change [weapon number v] by (1)\n    end\nend\n\nwhen flag clicked\nforever\n    play sound [NSMB Desert v] until done\nend\n\nwhen I receive [switch to normal v]\nswitch costume to (a0 v)\n\n@Level\n\nwhen I receive [next level v]\nnext costume\nbroadcast (Restart v)\nif <(costume [number v]) = [13]> then\n    clear graphic effects\nend\n\nwhen flag clicked\nswitch costume to (level 1 v)\ngo to x: (0) y: (00)\n\nwhen [6 v] key pressed\nbroadcast (Next level v)\n\n@Clouds\n\nwhen flag clicked\nforever\n    create clone of (_myself_ v)\n    wait (pick random (2) to (4)) seconds\nend\n\nwhen I start as a clone\nswitch costume to (cloud hitbox v)\ngo to x: (240) y: (pick random (10) to (150))\nset [my costume v] to (pick random (1) to (2))\nswitch costume to (My costume)\nset [ghost v] effect to (pick random (50) to (70))\nrepeat (96)\n    switch costume to (cloud hitbox v)\n    change x by (-5)\n    switch costume to (My costume)\nend\ndelete this clone\n\n@Deco\n\nwhen flag clicked\nswitch costume to (level 1 v)\nforever\n    go to x: (0) y: (0)\n    go to [back v] layer\n    switch costume to ([costume # v] of [level v])\nend\n\nbroadcast (Next level v)\n\n@Sprite1\n\ndefine Swing\nshow\nif <([direction v] of [player v]) = [90]> then\n    set size to (150) %\n    point in direction (30)\n    repeat (7)\n        turn right (20) degrees\n        switch costume to (swing v)\n        go to (player v)\n        broadcast (switch costume v)\n    end\nelse\n    set size to (150) %\n    point in direction (150)\n    repeat (7)\n        turn right (-20) degrees\n        switch costume to (swing2 v)\n        go to (player v)\n        broadcast (switch costume v)\n    end\nend\nhide\n\nwhen I start as a clone\nforever\n    show\n    point in direction (90)\n    switch costume to (swing3 v)\n    set size to (200) %\n    repeat (10)\n        change y by (1)\n    end\n    repeat (20)\n        change y by (-1)\n    end\n    repeat (10)\n        change y by (1)\n    end\n    go to x: (-45) y: (19)\nend\n\nwhen I receive [w1 v]\nforever\n    if <<(Weapon Number) = [1]> and <key (space v) pressed?>> then\n        Swing\n        wait until <not <key (space v) pressed?>>\n    end\nend\n\nwhen I receive [flash v]\nif <(Weapon Number) = [1]> then\n    Swing\nend\n\n@Enemies\n\nwhen I receive [setup enemies v]\nif  then\n    delete this clone\nend\nhide variable [lives v]\nif <([costume # v] of [level v]) = [2]> then\n    Clone [1] [209] [-9]\nend\nif <([costume # v] of [level v]) = [3]> then\n    Clone [5] [215] [49]\nend\nif <([costume # v] of [level v]) = [4]> then\n    Clone [3] [123] [153]\n    Clone [5] [53] [137]\nend\nif <([costume # v] of [level v]) = [5]> then\n    Clone [1] [-189] [152]\n    Clone [5] [240] [86]\nend\nif <([costume # v] of [level v]) = [6]> then\n    Clone [3] [-189] [152]\n    Clone [5] [189] [152]\nend\nif <([costume # v] of [level v]) = [7]> then\n    Clone [7] [18] [-6]\nend\nif <([costume # v] of [level v]) = [8]> then\n    Clone [7] [194] [-63]\n    Clone [1] [0] [-63]\n    Clone [3] [201] [99]\nend\nif <([costume # v] of [level v]) = [9]> then\n    Clone [5] [175] [-10]\nend\nif <([costume # v] of [level v]) = [10]> then\n    Clone [1] [-25] [36]\nend\nif <([costume # v] of [level v]) = [12]> then\n    Clone [7] [110] [-9]\nend\nif <([costume # v] of [level v]) = [14]> then\n    Clone [7] [110] [-9]\n    Clone [6] [29] [135]\nend\n\ndefine Clone (type) (x) (y)\ngo to x: (x) y: (y)\nswitch costume to (type)\nset [clone# v] to (type)\ncreate clone of (_myself_ v)\n\nwhen I receive [blue guy switch v]\nif <(costume [number v]) = [1]> then\n    switch costume to (costume3 v)\nend\n\nwhen flag clicked\nhide\n\nwhen I start as a clone\nforever\n    if <(costume [number v]) = [1]> then\n        if <(distance to [player v]) < [115]> then\n            if <(dead) = [0]> then\n                switch costume to (weapon1 v)\n                set [katana rotation v] to ((direction) / (90))\n                create clone of (_myself_ v)\n                switch costume to (costume1 v)\n            end\n        end\n        wait until <[115] < (distance to [player v])>\n    end\nend\n\nwhen I start as a clone\nclear graphic effects\nset size to (100) %\nshow\nset [enemyx v] to [0]\nset [enemyy v] to [0]\nset [dead v] to [0]\ngo to [front v] layer\nif <(costume [number v]) < [9]> then\n    forever\n        switch costume to ((Clone#) + (1))\n        if <<touching (sprite1 v)?> or <[-170] > (y position)>> then\n            point in direction (90)\n            clear graphic effects\n            set rotation style [all around v]\n            set [dead v] to [1]\n            repeat (20)\n                turn right (15) degrees\n                change y by (10)\n                change [ghost v] effect by (5)\n            end\n            delete this clone\n        end\n        change [enemyy v] by (-1)\n        if <<touching (water v)?> or <touching (lava v)?>> then\n            change [enemyy v] by (2)\n        end\n        if <([x position v] of [player v]) < ((x position) - (50))> then\n            change [enemyx v] by (-0.2)\n            point in direction (-90)\n        end\n        if <((x position) - (-20)) < ([x position v] of [player v])> then\n            change [enemyx v] by (0.2)\n            point in direction (90)\n        end\n        set [enemyx v] to ((Enemyx) * (0.9))\n        change x by (Enemyx)\n        if <touching (level v)?> then\n            change y by (1)\n        end\n        if <touching (level v)?> then\n            change y by (1)\n        end\n        if <touching (level v)?> then\n            change y by (1)\n        end\n        if <touching (level v)?> then\n            change y by (1)\n        end\n        if <touching (level v)?> then\n            change y by (-4)\n            change x by ((Enemyx) * (-1))\n            if <((y position) - (-40)) < ([y position v] of [player v])> then\n                set [enemyy v] to [15]\n                if <([abs v] of (Enemyx) ) = (Enemyx)> then\n                    set [enemyx v] to [-3]\n                else\n                    set [enemyx v] to [3]\n                end\n            else\n                set [enemyx v] to [0]\n            end\n        end\n        change y by (Enemyy)\n        if <touching (level v)?> then\n            change y by ((Enemyy) - ((Enemyy) * (2)))\n            set [enemyy v] to [0]\n        end\n        change y by (-1)\n        if <<((y position) - (-50)) < ([y position v] of [player v])> and <touching (level v)?>> then\n            set [enemyy v] to [14]\n        end\n        change y by (1)\n        switch costume to (Clone#)\n        if <<touching (sprite2 v)?> or <<touching (sprite6 v)?> or <touching (sprite4 v)?>>> then\n            point in direction (90)\n            clear graphic effects\n            set rotation style [all around v]\n            set [dead v] to [1]\n            repeat (20)\n                turn right (15) degrees\n                change y by (10)\n                change [ghost v] effect by (5)\n            end\n            delete this clone\n        end\n    end\nelse\n    if <(costume [number v]) = [9]> then\n        set rotation style [all around v]\n        if <(Katana rotation) = [1]> then\n            set size to (150) %\n            point in direction (30)\n            repeat (5)\n                turn right (30) degrees\n                switch costume to (weapon1 v)\n                broadcast (Blue guy switch v)\n                if <touching (player v)?> then\n                    create clone of (player v)\n                    broadcast (Restart v)\n                end\n            end\n        else\n            set size to (150) %\n            point in direction (150)\n            repeat (5)\n                turn right (-30) degrees\n                switch costume to (weapon2 v)\n                broadcast (Blue guy switch v)\n                if <touching (player v)?> then\n                    create clone of (player v)\n                    broadcast (Restart v)\n                end\n            end\n        end\n        delete this clone\n    else\n        if <(costume [number v]) = [11]> then\n            clear graphic effects\n            set rotation style [all around v]\n            point towards (player v)\n            repeat until <<touching (_edge_ v)?> or <touching (level v)?>>\n                move (10) steps\n                if <touching (player v)?> then\n                    create clone of (player v)\n                    broadcast (Restart v)\n                end\n            end\n            repeat (10)\n                change [ghost v] effect by (10)\n                if <touching (player v)?> then\n                    create clone of (player v)\n                    broadcast (Restart v)\n                end\n            end\n            delete this clone\n        else\n            if <(costume [number v]) = [12]> then\n                clear graphic effects\n                set rotation style [all around v]\n                point towards (player v)\n                repeat until <<touching (_edge_ v)?> or <touching (level v)?>>\n                    move (15) steps\n                    if <touching (player v)?> then\n                        create clone of (player v)\n                        broadcast (Restart v)\n                    end\n                end\n                repeat (10)\n                    change [ghost v] effect by (10)\n                    if <touching (player v)?> then\n                        create clone of (player v)\n                        broadcast (Restart v)\n                    end\n                end\n                delete this clone\n            else\n                if <(costume [number v]) = [13]> then\n                    set [oo v] to ((x position) - ([x position v] of [player v]))\n                    clear graphic effects\n                    set rotation style [all around v]\n                    set size to (60) %\n                    point in direction (0)\n                    if <(((x position) - ([x position v] of [player v])) * (-1)) < [1]> then\n                        switch costume to (costume8 v)\n                        repeat (30)\n                            move (12) steps\n                            turn right (-6) degrees\n                            if <touching (player v)?> then\n                                create clone of (player v)\n                                broadcast (Restart v)\n                            end\n                            if <touching (level v)?> then\n                                repeat (10)\n                                    change [ghost v] effect by (10)\n                                end\n                                delete this clone\n                            end\n                        end\n                        repeat until <touching (level v)?>\n                            change y by (-5)\n                            if <touching (player v)?> then\n                                create clone of (player v)\n                                broadcast (Restart v)\n                            end\n                        end\n                        repeat (10)\n                            change [ghost v] effect by (10)\n                        end\n                        delete this clone\n                    else\n                        switch costume to (costume5 v)\n                        repeat (30)\n                            move (12) steps\n                            turn right (6) degrees\n                            if <touching (player v)?> then\n                                create clone of (player v)\n                                broadcast (Restart v)\n                            end\n                            if <touching (level v)?> then\n                                repeat (10)\n                                    change [ghost v] effect by (10)\n                                end\n                                delete this clone\n                            end\n                        end\n                        repeat until <touching (level v)?>\n                            change y by (-5)\n                            if <touching (player v)?> then\n                                create clone of (player v)\n                                broadcast (Restart v)\n                            end\n                        end\n                        repeat (10)\n                            change [ghost v] effect by (10)\n                        end\n                        delete this clone\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen I start as a clone\nforever\n    if <(costume [number v]) = [3]> then\n        if <(dead) = [0]> then\n            switch costume to (weapon3 v)\n            set [katana rotation v] to ((direction) / (90))\n            create clone of (_myself_ v)\n            switch costume to (costume2 v)\n        end\n        wait (1.5) seconds\n    end\nend\n\nwhen I receive [restart v]\ndelete this clone\n\nwhen I start as a clone\nforever\n    if <(costume [number v]) = [5]> then\n        if <(dead) = [0]> then\n            switch costume to (costume7 v)\n            set [katana rotation v] to ((direction) / (90))\n            create clone of (_myself_ v)\n            switch costume to (yelo neja v)\n        end\n        wait (1) seconds\n    end\nend\n\nwhen I start as a clone\nforever\n    if <(costume [number v]) = [7]> then\n        if <(dead) = [0]> then\n            switch costume to (costume8 v)\n            set [katana rotation v] to ((direction) / (90))\n            create clone of (_myself_ v)\n            switch costume to (grey v)\n        end\n        wait (2) seconds\n    end\nend\n\nif <touching (level v)?> then\n    repeat (10)\n        change [ghost v] effect by (10)\n        if <touching (player v)?> then\n            create clone of (player v)\n            broadcast (Restart v)\n        end\n    end\n    delete this clone\nend\nif <touching (player v)?> then\n    create clone of (player v)\n    broadcast (Restart v)\nend\n\n@Sprite4\n\nwhen I receive [w3 v]\nset [turn v] to [0]\nforever\n    point in direction (Turn)\n    if <(Weapon Number) = [3]> then\n        show\n        if <key (space v) pressed?> then\n            repeat until <not <key (space v) pressed?>>\n                change [turn v] by (10)\n                point in direction (Turn)\n            end\n            point in direction (Turn)\n            create clone of (_myself_ v)\n            wait until <not <key (space v) pressed?>>\n        end\n    else\n        hide\n    end\nend\n\nwhen flag clicked\ndelete this clone\n\nwhen flag clicked\nhide\nwait until <([costume # v] of [level v]) = [1]>\nforever\n    if <([costume # v] of [level v]) = [4]> then\n        show\n        go to x: (-47) y: (20)\n        stop [this script v]\n    end\nend\n\ndefine Position\nif <([direction v] of [player v]) = [90]> then\n    go to x: (([x position v] of [player v]) + (28)) y: ([y position v] of [player v])\nelse\n    go to x: (([x position v] of [player v]) + (-28)) y: ([y position v] of [player v])\nend\nswitch costume to (thumbnail4 v)\ngo to [front v] layer\nset size to (100) %\n\nwhen I start as a clone\nswitch costume to (costume1 v)\nclear graphic effects\nrepeat until <<touching (level v)?> or <touching (_edge_ v)?>>\n    move (15) steps\nend\nrepeat (10)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nwhen I receive [w3 v]\nforever\n    Position\n    switch costume to (thumbnail2 v)\nend\n\n@Thumbnail\n\nwhen flag clicked\nforever\n    go to x: (0) y: (0)\n    reset timer\n    hide\nend\n\nwhen [timer v] > (0.01)\nset [ghost v] effect to (100)\nrepeat (10)\n    show\n    change [ghost v] effect by (-10)\n    go to [front v] layer\nend\n\n@Sprite3\n\ndefine Swing\nshow\nif <([direction v] of [player v]) = [90]> then\n    set size to (150) %\n    point in direction (30)\n    repeat (7)\n        turn right (20) degrees\n        switch costume to (swing v)\n        go to (player v)\n        broadcast (switch costume v)\n    end\nelse\n    set size to (150) %\n    point in direction (150)\n    repeat (7)\n        turn right (-20) degrees\n        switch costume to (swing2 v)\n        go to (player v)\n        broadcast (switch costume v)\n    end\nend\nhide\n\nwhen I start as a clone\nforever\n    show\n    point in direction (90)\n    switch costume to (swing3 v)\n    set size to (200) %\n    repeat (10)\n        change y by (1)\n    end\n    repeat (20)\n        change y by (-1)\n    end\n    repeat (10)\n        change y by (1)\n    end\n    go to x: (-45) y: (19)\nend\n\nwhen I receive [w1 v]\nforever\n    if <<(Weapon Number) = [1]> and <key (space v) pressed?>> then\n        Swing\n        wait until <not <key (space v) pressed?>>\n    end\nend\n\nwhen I receive [flash v]\nif <(Weapon Number) = [1]> then\n    Swing\nend\n\n@Sprite2\n\nwhen I receive [w2 v]\nforever\n    if <<(Weapon Number) = [2]> and <key (space v) pressed?>> then\n        create clone of (_myself_ v)\n        wait until <not <key (space v) pressed?>>\n    end\nend\n\nwhen flag clicked\ndelete this clone\n\nwhen flag clicked\nforever\n    point in direction (90)\n    switch costume to (costume1 v)\n    set size to (200) %\n    repeat (10)\n        change y by (1)\n    end\n    repeat (20)\n        change y by (-1)\n    end\n    repeat (10)\n        change y by (1)\n    end\n    go to x: (-120) y: (0)\nend\n\nwhen I start as a clone\ngo to (player v)\nshow\nset size to (150) %\nclear graphic effects\nif <([direction v] of [player v]) = [90]> then\n    repeat until <<touching (_edge_ v)?> or <touching (level v)?>>\n        change x by (10)\n    end\nelse\n    repeat until <<touching (_edge_ v)?> or <touching (level v)?>>\n        change x by (-10)\n    end\nend\nrepeat (10)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nshow\n\nwhen I receive [flash v]\nif <(Weapon Number) = [2]> then\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\n\n@Button1\n\nwhen flag clicked\nswitch costume to (造型1 v)\ncreate clone of (_myself_ v)\nswitch costume to (change v)\nforever\n    go to [front v] layer\n    set [ghost v] effect to (20)\n    if <touching (mouse-pointer v)?> then\n        set size to (130) %\n        set [show b1v v] to [1]\n    else\n        set size to (120) %\n        set [show b1v v] to [0]\n    end\nend\n\nwhen flag clicked\nforever\n    point in direction (90)\n    repeat (10)\n        turn left (1) degrees\n    end\n    repeat (20)\n        turn left (-1) degrees\n    end\n    repeat (10)\n        turn left (1) degrees\n    end\nend\n\nwhen I start as a clone\nforever\n    go to (mouse-pointer v)\n    go to [front v] layer\n    if <(Show B1v) = [1]> then\n        show\n    else\n        hide\n    end\nend\n\nwhen flag clicked\nforever\n    set y to (-150)\n    if <([direction v] of [player v]) = [90]> then\n        set x to (205)\n    else\n        set x to (-205)\n    end\nend\n\nwhen this sprite clicked\nbroadcast (Switch weapon v)\nwait until <not <touching (mouse-pointer v)?>>\n\n@Button2\n\nwhen flag clicked\nswitch costume to (造型1 v)\ncreate clone of (_myself_ v)\nswitch costume to (change v)\nforever\n    go to [front v] layer\n    set [ghost v] effect to (20)\n    if <touching (mouse-pointer v)?> then\n        set [show b2v v] to [1]\n        set size to (130) %\n        if <(Weapon Number) = [3]> then\n            if <mouse down?> then\n                repeat until <not <mouse down?>>\n                    change [turn v] by (10)\n                end\n                create clone of (sprite4 v)\n            end\n        end\n        if <(Weapon Number) = [4]> then\n            if <mouse down?> then\n                create clone of (sprite6 v)\n                wait until <not <mouse down?>>\n            end\n        end\n    else\n        set size to (120) %\n        set [show b2v v] to [0]\n    end\n    set y to (-150)\n    if <([direction v] of [player v]) = [90]> then\n        set x to (155)\n    else\n        set x to (-155)\n    end\nend\n\nwhen flag clicked\nforever\n    point in direction (90)\n    repeat (10)\n        turn left (1) degrees\n    end\n    repeat (20)\n        turn left (-1) degrees\n    end\n    repeat (10)\n        turn left (1) degrees\n    end\nend\n\nwhen I start as a clone\nforever\n    go to (mouse-pointer v)\n    go to [front v] layer\n    if <(Show b2v) = [1]> then\n        show\n    else\n        hide\n    end\nend\n\nwhen this sprite clicked\nbroadcast (Flash v)\nwait until <not <touching (mouse-pointer v)?>>\n\n@Sprite5\n\n@Sprite6\n\nwhen I receive [w4 v]\nset [turn v] to [0]\nforever\n    point in direction (Turn)\n    if <(Weapon Number) = [4]> then\n        show\n        if <key (space v) pressed?> then\n            broadcast (switch costume v)\n            create clone of (_myself_ v)\n            wait until <not <key (space v) pressed?>>\n        end\n    else\n        hide\n    end\nend\n\nwhen flag clicked\ndelete this clone\n\nwhen flag clicked\nrepeat until <touching (player v)?>\n    go to x: (-130) y: (20)\n    point in direction (90)\n    switch costume to (thumbnail2 v)\n    set size to (80) %\n    repeat (10)\n        change y by (1)\n    end\n    repeat (20)\n        change y by (-1)\n    end\n    repeat (10)\n        change y by (1)\n    end\nend\n\nwhen flag clicked\nhide\nwait until <([costume # v] of [level v]) = [1]>\nwait until <([costume # v] of [level v]) = [3]>\nshow\ngo to x: (-130) y: (20)\nwait until <touching (player v)?>\nset [weapon number v] to [4]\nset [weapon max v] to [4]\nbroadcast (W4 v)\nshow\n\ndefine Position\nset rotation style [left-right v]\nswitch costume to (costume1 v)\nif <([direction v] of [player v]) = [90]> then\n    point in direction (90)\n    go to x: (([x position v] of [player v]) + (28)) y: ([y position v] of [player v])\nelse\n    go to x: (([x position v] of [player v]) + (-28)) y: ([y position v] of [player v])\n    point in direction (-90)\nend\ngo to [front v] layer\nset size to (60) %\n\nwhen I start as a clone\nshow\nset [me? v] to (([direction v] of [player v]) / (90))\nbroadcast (switch costume v)\nset rotation style [all around v]\nif <(me?) = [1]> then\n    switch costume to (thumbnail2 v)\nelse\n    switch costume to (costume1 v)\nend\nclear graphic effects\npoint in direction (0)\nrepeat (30)\n    move (11) steps\n    turn right ((me?) * (6)) degrees\n    broadcast (switch costume v)\n    if <touching (_edge_ v)?> then\n        delete this clone\n    end\n    if <touching (level v)?> then\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n        delete this clone\n    end\nend\nrepeat until <touching (level v)?>\n    move (10) steps\n    turn right ((me?) * (6)) degrees\n    if <touching (_edge_ v)?> then\n        repeat (10)\n            change [ghost v] effect by (10)\n        end\n        delete this clone\n    end\n    if <(direction) < [170]> then\n        repeat until <touching (level v)?>\n            move (10) steps\n            turn right ((me?) * (1)) degrees\n            if <touching (_edge_ v)?> then\n                repeat (10)\n                    change [ghost v] effect by (10)\n                end\n                delete this clone\n            end\n        end\n    end\nend\nrepeat (10)\n    change [ghost v] effect by (10)\nend\ndelete this clone\n\nwhen I receive [w4 v]\nforever\n    Position\nend\n\nshow\n\n@WATER\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    set [ghost v] effect to (40)\n    go to [back v] layer\n    change y by (tide)\n    switch costume to ([costume # v] of [level v])\nend\n\nwhen flag clicked\nforever\n    set [tide v] to [0]\n    repeat (10)\n        change [tide v] by (0.1)\n    end\n    repeat (20)\n        change [tide v] by (-0.1)\n    end\n    repeat (10)\n        change [tide v] by (0.1)\n    end\nend\n\n@LAVA\n\nwhen flag clicked\ngo to x: (0) y: (0)\nforever\n    set [ghost v] effect to (40)\n    go to [back v] layer\n    change y by (tide)\n    switch costume to ([costume # v] of [level v])\nend\n\nwhen flag clicked\nforever\n    set [tide v] to [0]\n    repeat (10)\n        change [tide v] by (0.1)\n    end\n    repeat (20)\n        change [tide v] by (-0.1)\n    end\n    repeat (10)\n        change [tide v] by (0.1)\n    end\nend\n\n@Design Sprite\n\nwhen flag clicked\nhide\n\n@Placeholder For Enemies\n\nwhen flag clicked\nhide\n\n