The Red Ninja 4 || A platformer

Instructions: =====Info=====\nThe Red Ninja: https://scratch.mit.edu/projects/401255085/\nThe Red Ninja 2: https://scratch.mit.edu/projects/402521703/\nThe Red Ninja 3: https://scratch.mit.edu/projects/402980379/\nThe Red Ninja 5: https://scratch.mit.edu/projects/406739724/\nAre you ready to head to the Ancient Temple of the Forbidden? We need to find a roll of golden toilet paper over there. Let’s go! #6 on trending? Thanks all!\n=====Disclaimer=====\nIt might lag occasionally on slow devices because of too many clones, but still, enjoy! This is also mobile friendly.\nFor less lag go to Forkphorus.github.io/#404940060\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 on both mobile and computer!

@Stage\n\nwhen flag clicked\nswitch backdrop to (backdrop1 v)\nclear graphic effects\nwait until <([costume # v] of [level v]) = [12]>\nswitch backdrop to (backdrop2 v)\nset [ghost v] effect to (10)\nwait until <([costume # v] of [level v]) = [13]>\nclear graphic effects\nswitch backdrop to (backdrop1 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\nclear graphic effects\nwait until <([costume # v] of [level v]) = [12]>\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 I receive [restart v]\nswitch costume to (a0 v)\nif <(lives for player) = [1]> then\n    set [y v] to [0]\n    set [x v] to [0]\n    go to x: (-215) y: (-30)\n    if <touching (level v)?> then\n        change x by (5)\n    end\n    point in direction (90)\n    broadcast (Setup Enemies v)\n    set [y v] to [0]\n    set [x v] to [0]\n    set [lives for player v] to [1]\nelse\n    change [lives for player v] by (-1)\nend\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\nset [lives for player v] to [1]\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    if <touching (level v)?> then\n        broadcast (Restart v)\n    end\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)\nbroadcast (W4 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\nwhen I receive [switch to normal v]\nswitch costume to (a0 v)\n\nwhen I receive [move player v]\nif <not <touching (lava v)?>> then\n    change x by (Move::X)\n    change y by (Move::Y)\nelse\n    broadcast (Restart v)\nend\n\nbroadcast (Next level v)\n\nwhen [r v] key pressed\nbroadcast (Restart v)\n\n@Level\n\nwhen I receive [next level v]\nclear graphic effects\nnext costume\nbroadcast (Restart v)\n\nwhen flag clicked\nswitch costume to (level 1 v)\ngo to x: (0) y: (00)\n\ncreate clone of (level v)\n\nwhen I start as a clone\nswitch costume to (costume1 v)\nif <([costume # v] of [level v]) = [2]> then\n    go to x: (-97) y: (-60)\n    repeat until <not <([costume # v] of [level v]) = [2]>>\n        Glide [-97] [-59]\n        Glide [97] [-59]\n    end\nend\nif <([costume # v] of [level v]) = [3]> then\n    go to x: (-97) y: (-120)\n    repeat until <not <([costume # v] of [level v]) = [3]>>\n        Glide [-97] [41]\n        Glide [-97] [-109]\n    end\nend\nif <([costume # v] of [level v]) = [4]> then\n    go to x: (-97) y: (-108)\n    repeat until <not <([costume # v] of [level v]) = [4]>>\n        Glide [-97] [-108]\n        Glide [144] [-108]\n    end\nend\nif <([costume # v] of [level v]) = [5]> then\n    go to x: (-97) y: (41)\n    repeat until <not <([costume # v] of [level v]) = [5]>>\n        Glide [-97] [41]\n        Glide [-97] [-109]\n    end\nend\nif <([costume # v] of [level v]) = [6]> then\n    go to x: (0) y: (41)\n    repeat until <not <([costume # v] of [level v]) = [6]>>\n        Glide [0] [41]\n        Glide [0] [-109]\n    end\nend\nif <([costume # v] of [level v]) = [7]> then\n    go to x: (-48) y: (-7)\n    repeat until <not <([costume # v] of [level v]) = [7]>>\n        Glide [-48] [-7]\n        Glide [-48] [-160]\n    end\nend\nif <([costume # v] of [level v]) = [9]> then\n    go to x: (-49) y: (-63)\n    repeat until <not <([costume # v] of [level v]) = [9]>>\n        Glide [-49] [-62]\n        Glide [99] [40]\n    end\nend\n\ndefine Glide (x) (y)\nrepeat until <<(round (x position)) = (x)> and <(round (y position)) = (y)>>\n    set [move::x v] to (((x) - (x position)) / (12))\n    set [move::y v] to (((y) - (y position)) / (12))\n    change x by (Move::X)\n    change y by (Move::Y)\n    change y by (3)\n    if <touching (player v)?> then\n        broadcast (Move player v)\n    end\n    change y by (-3)\nend\n\ndelete this clone\n\nwhen I receive [restart v]\ndelete this clone\n\n@Clouds\n\nwhen flag clicked\nforever\n    if <not <(backdrop [number v]) = [2]>> then\n        create clone of (_myself_ v)\n    end\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]) = [1]> then\n    Clone [1] [140] [-12]\nend\nif <([costume # v] of [level v]) = [2]> then\n    Clone [1] [0] [-12]\n    Clone [5] [222] [87]\n    create clone of (level v)\nend\nif <([costume # v] of [level v]) = [3]> then\n    Clone [3] [-17] [85]\n    Clone [1] [-80] [70]\n    Clone [7] [100] [0]\n    create clone of (level v)\nend\nif <([costume # v] of [level v]) = [4]> then\n    Clone [1] [-74] [136]\n    Clone [5] [167] [87]\n    create clone of (level v)\nend\nif <([costume # v] of [level v]) = [5]> then\n    Clone [5] [240] [86]\n    Clone [1] [-89] [87]\n    Clone [7] [116] [-60]\n    create clone of (level v)\nend\nif <([costume # v] of [level v]) = [6]> then\n    Clone [1] [98] [87]\n    Clone [7] [170] [-2]\n    create clone of (level v)\nend\nif <([costume # v] of [level v]) = [7]> then\n    Clone [5] [82] [37]\n    Clone [1] [0] [-63]\n    create clone of (level v)\nend\nif <([costume # v] of [level v]) = [8]> then\n    Clone [9] [175] [-10]\n    Clone [1] [0] [-20]\nend\nif <([costume # v] of [level v]) = [9]> then\n    Clone [9] [162] [91]\n    Clone [7] [0] [0]\n    create clone of (level v)\nend\nif <([costume # v] of [level v]) = [10]> then\n    Clone [9] [66] [10]\n    Clone [1] [-69] [91]\n    Clone [5] [219] [60]\nend\nif <([costume # v] of [level v]) = [11]> then\n    Clone [9] [190] [-29]\n    Clone [5] [-17] [29]\nend\nif <([costume # v] of [level v]) = [12]> then\n    Clone [9] [213] [-75]\n    Clone [7] [-200] [85]\n    Clone [3] [200] [85]\n    Clone [1] [2] [-75]\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]) < [11]> 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        if <touching (level v)?> then\n            change y by (10)\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            if <not <(costume [number v]) = [9]>> 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                change [enemies left v] by (-1)\n                delete this clone\n            else\n                if <touching (sprite6 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                    change [enemies left v] by (-1)\n                    delete this clone\n                end\n            end\n        end\n        if <touching (sprite7 v)?> then\n            change [enemyx v] by (((direction) / (-90)) * (10))\n        end\n    end\nelse\n    if <(costume [number v]) = [11]> 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]) = [13]> 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 (sprite7 v)?> then\n                    repeat (10)\n                        change [ghost v] effect by (10)\n                    end\n                    change [enemies left v] by (-1)\n                    delete this clone\n                end\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]) = [14]> 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                    if <touching (sprite7 v)?> then\n                        repeat (10)\n                            change [ghost v] effect by (10)\n                        end\n                        delete this clone\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]) = [15]> 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\nwhen I start as a clone\nforever\n    if <(costume [number v]) = [17]> then\n        go to [back v] layer\n        go [forward v] (2) layers\n        if <touching (player v)?> then\n            change [x v] by ((([direction v] of [player v]) / (-90)) * (10))\n        end\n        repeat (1)\n        delete this clone\n    end\nend\n\nwhen I start as a clone\nforever\n    if <(costume [number v]) = [9]> then\n        if <(dead) = [0]> then\n            switch costume to (cake-a v)\n            create clone of (_myself_ v)\n            switch costume to (prpo v)\n        end\n    end\nend\n\nset [wave v] to [1]\nset [enemies left v] to [5]\nClone [1] [212] [-75]\nwait (2) seconds\nClone [5] [-209] [85]\nwait (2) seconds\nClone [9] [-212] [-75]\nwait (2) seconds\nClone [1] [212] [-75]\nwait (2) seconds\nClone [5] [209] [85]\nwait (8) seconds\n\nset [lives for player v] to [5]\n\nbroadcast (Restart 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\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@LIGHT2\n\nwhen flag clicked\nforever\n    go to (player v)\n    go to [back v] layer\n    set [ghost v] effect to (40)\n    set size to (Weordp) %\nend\n\nwhen flag clicked\nforever\n    set [weordp v] to [50]\n    repeat (20)\n        change [weordp v] by (1)\n    end\n    repeat (20)\n        change [weordp v] by (-1)\n    end\nend\n\n@LIGHT3\n\nwhen flag clicked\nforever\n    go to (player v)\n    go to [back v] layer\n    set [ghost v] effect to (20)\n    set size to (Weordp) %\nend\n\nwhen flag clicked\nforever\n    set [weordp v] to [30]\n    repeat (20)\n        change [weordp v] by (1)\n    end\n    repeat (20)\n        change [weordp v] by (-1)\n    end\nend\n\n@Sprite6\n\nshow\n\nwhen I receive [w4 v]\nset [turn v] to [0]\nforever\n    point in direction (Turn)\n    if <(Weapon Number) = [4]> then\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        hide\n    else\n        hide\n    end\nend\n\nwhen flag clicked\ndelete this clone\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))\nset rotation style [all around v]\nif <(me?) = [1]> then\n    switch costume to (costume1 v)\nelse\n    switch costume to (thumbnail2 v)\nend\nclear graphic effects\npoint in direction (0)\nrepeat (30)\n    move (11) steps\n    turn right ((me?) * (6)) degrees\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]\nset [weapon max v] to [4]\nforever\n    Position\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\nset [y v] to [0]\nset [x v] to [0]\n\n@Sprite7\n\nwhen I receive [w5 v]\nset [turn v] to [0]\nforever\n    point in direction (Turn)\n    if <(Weapon Number) = [5]> then\n        show\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: (-120) y: (-30)\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\nend\n\nwhen flag clicked\nhide\nwait until <([costume # v] of [level v]) = [1]>\nwait until <([costume # v] of [level v]) = [6]>\nshow\ngo to x: (-120) y: (-30)\nwait until <touching (player v)?>\nset [weapon number v] to [5]\nset [weapon max v] to [5]\nbroadcast (W5 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\nset size to (150) %\n\nwhen I receive [w5 v]\nforever\n    Position\nend\n\n@角色1\n\nwhen flag clicked\nforever\n    if <([costume # v] of [level v]) = [13]> then\n        show\n    else\n        hide\n    end\nend\n\nwhen flag clicked\nset [effect v] to [0]\nforever\n    set y to ((([cos v] of ((Effect) * (2)) ) * (10)) + (-50))\n    point in direction ((90) + (([cos v] of (Effect) ) * (3)))\n    change [effect v] by (11)\nend\n\n@角色2\n\nwhen flag clicked\nforever\n    set [ghost v] effect to (20)\n    go to (角色1 v)\n    go to [back v] layer\n    turn right (3) degrees\nend\n\nwhen flag clicked\nforever\n    if <([costume # v] of [level v]) = [13]> then\n        show\n    else\n        hide\n    end\nend\n\n