The Red Ninja 2 || A platformer 

Instructions: =====Info=====\nIf you haven’t already, please play the first one: https://scratch.mit.edu/projects/401255085/\nHere is the third: https://scratch.mit.edu/projects/402980379/\nHere’s the fourth: https://scratch.mit.edu/projects/404940060/\nAnd the fifth: https://scratch.mit.edu/projects/406739724/\nEquipped with your weapons, the ninja is on for another adventure! Please love, fav, and follow for more! \nCan we keep the love-view ratio above 20?\n=====Disclaimer=====\nYou have to double click the flag, or the bow won’t show.\n It might lag occasionally on slow devices because of too many clones, but still, enjoy! This is also mobile friendly.\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\nclear graphic effects\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@角色1\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 color (#da6066)?>> 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 [2]\nbroadcast (W1 v)\nbroadcast (W2 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 [9109kj821kaw.mp3 v] until done\nend\n\n@Level\n\nwhen I receive [next level v]\nnext costume\nbroadcast (Restart v)\n\nwhen flag clicked\nswitch costume to (level 1 v)\ngo to x: (0) y: (00)\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] [144] [-60]\nend\nif <([costume # v] of [level v]) = [3]> then\n    Clone [3] [145] [-15]\n    Clone [1] [0] [-15]\nend\nif <([costume # v] of [level v]) = [5]> then\n    Clone [1] [187] [87]\n    Clone [1] [160] [-60]\nend\nif <([costume # v] of [level v]) = [6]> then\n    Clone [3] [164] [-61]\n    Clone [1] [176] [87]\nend\nif <([costume # v] of [level v]) = [7]> then\n    Clone [3] [-63] [110]\n    Clone [5] [152] [37]\nend\nif <([costume # v] of [level v]) = [8]> then\n    Clone [5] [-211] [137]\n    Clone [1] [162] [-12]\nend\nif <([costume # v] of [level v]) = [9]> then\n    Clone [5] [167] [38]\n    Clone [1] [0] [0]\n    Clone [3] [215] [-12]\nend\nif <([costume # v] of [level v]) = [10]> then\n    Clone [3] [29] [36]\n    Clone [5] [180] [-12]\n    Clone [1] [0] [70]\nend\nif <([costume # v] of [level v]) = [11]> then\n    Clone [3] [21] [-10]\n    Clone [5] [219] [-8]\nend\nif <([costume # v] of [level v]) = [12]> then\n    Clone [1] [-56] [-109]\n    Clone [5] [50] [-109]\n    Clone [3] [70] [50]\n    Clone [1] [-199] [132]\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]) < [7]> 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)?> 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 (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]) = [7]> 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]) = [9]> 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]) = [10]> 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            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\nbroadcast (Next level v)\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\ngo to x: (-47) y: (20)\nwait until <([costume # v] of [level v]) = [1]>\nrepeat until <touching (player v)?>\n    point in direction (90)\n    switch costume to (thumbnail2 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: (-47) y: (20)\nend\npoint in direction (90)\nbroadcast (W3 v)\n\nwhen flag clicked\nwait until <([costume # v] of [level v]) = [1]>\nhide\nwait until <([costume # v] of [level v]) = [4]>\nshow\nwait until <touching (player v)?>\nset [weapon number v] to [3]\nset [weapon max v] to [3]\nbroadcast (W3 v)\nshow\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@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@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    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@Enemies2\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]) < [5]> 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)?> then\n            change [enemyy v] by (1.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)?> 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]) = [5]> 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]) = [7]> 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        end\n    end\nend\n\nwhen I receive [restart v]\ndelete this clone\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 receive [blue guy switch v]\nif <(costume [number v]) = [1]> then\n    switch costume to (costume3 v)\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\nswitch costume to (weapon3 v)\ncreate clone of (_myself_ v)\n\n