The Miner 4 | Turn-based battle | platformer  #games

Instructions: the miner 1 (start here if u haven't played it) https://scratch.mit.edu/projects/486252650/\nprevious: https://scratch.mit.edu/projects/490894133/\nWASD or arrows to move\nin a battle, select the move you want to use, then select the enemy you want to attack.\nm to mute\nmay contain some glitches, i tried to fix as many as i could but let me know if there are any game breaking glitches\nheart and star if u enjoyed! :)\nno ads\ntop loved!! :D\ncredits:\nmusic used: Darkside by Alan Walker, Spectre by Alan Walker, Hearthache from Undertale, and Wings by Halcyonic Falcon X \n@Thepuzzlegame for some art and the turn based battle engine\nhealth bars by @liquidmetal\nboss health bar @luckylmj\nplatforming engine by @MCBRex\n@RendHeaven for the boss art\npart of the story by @i_xm_bxd_luck\ncoin art @birdnani\n@coltroc for the helmet and pickaxe art\n@mushroomman1009 for the mudman edited by me\n#stories

@Stage\n\nwhen flag clicked\nset [turn v] to [Warrior]\nset [warrior health v] to [1300]\nset [mage health v] to [1000]\nset [archer health v] to [1000]\nset [m1 health v] to (pick random (100) to (200))\nset [m2 health v] to (pick random (100) to (200))\nset [m3 health v] to (pick random (100) to (200))\nset [swing attk v] to [no]\nset [animation v] to [no]\nset [wave v] to [1]\ndelete (all) of [m-health max v]\nadd (M1 health) to [m-health max v]\nadd (M2 Health) to [m-health max v]\nadd (M3 Health) to [m-health max v]\ndelete (all) of [players alive v]\nadd [Warrior] to [players alive v]\nadd [Mage] to [players alive v]\nadd [Archer] to [players alive v]\nforever\n    if <(Warrior Health) < [0]> then\n        set [warrior health v] to [0]\n    end\n    if <(Mage Health) < [0]> then\n        set [mage health v] to [0]\n    end\n    if <(Archer Health) < [0]> then\n        set [archer health v] to [0]\n    end\n    if <(Warrior Health) > [1300]> then\n        set [warrior health v] to [1300]\n    end\n    if <(Mage Health) > [1000]> then\n        set [mage health v] to [1000]\n    end\n    if <(Archer Health) > [1000]> then\n        set [archer health v] to [1000]\n    end\n    if <<(Turn) = [Warrior]> and <(Warrior Health) = [0]>> then\n        broadcast (delete buttons v)\n        set [turn v] to [Mage]\n    end\n    if <<(Turn) = [Mage]> and <(Mage Health) = [0]>> then\n        broadcast (delete buttons v)\n        set [turn v] to [Archer]\n    end\n    if <<(Turn) = [Archer]> and <(Archer Health) = [0]>> then\n        broadcast (delete buttons v)\n        set [turn v] to [Monster 1]\n    end\n    if <<(Turn) = [Monster 1]> and <(M1 health) = [0]>> then\n        broadcast (delete buttons v)\n        set [turn v] to [Monster 2]\n    end\n    if <<(Turn) = [Monster 2]> and <(M2 Health) = [0]>> then\n        broadcast (delete buttons v)\n        set [turn v] to [Monster 3]\n    end\n    if <<(Turn) = [Monster 3]> and <(M3 Health) = [0]>> then\n        broadcast (delete buttons v)\n        set [turn v] to [Warrior]\n    end\n    if <<(M1 health) = [0]> and <<(M2 Health) = [0]> and <(M3 Health) = [0]>>> then\n        wait until <(animation) = [no]>\n        wait until <<([costume # v] of [monster 1 v]) = [4]> and <<([costume # v] of [monster 2 v]) = [4]> and <([costume # v] of [monster 3 v]) = [4]>>>\n        wait (1) seconds\n        change [wave v] by (1)\n        broadcast (new wave v)\n    end\nend\n\nwhen I receive [new wave v]\nset [m1 health v] to ((pick random (100) to (200)) + ((wave) * (80)))\nset [m2 health v] to ((pick random (100) to (200)) + ((wave) * (80)))\nset [m3 health v] to ((pick random (100) to (200)) + ((wave) * (80)))\ndelete (all) of [m-health max v]\nadd (M1 health) to [m-health max v]\nadd (M2 Health) to [m-health max v]\nadd (M3 Health) to [m-health max v]\n\nwhen flag clicked\nswitch backdrop to (backdrop2 v)\nclear graphic effects\nwait until <(Level) = [11]>\nswitch backdrop to (backdrop1 v)\nforever\n    repeat (18)\n        change [color v] effect by (0.5)\n        wait (0.01) seconds\n    end\n    repeat (18)\n        change [color v] effect by (-0.5)\n        wait (0.01) seconds\n    end\nend\n\nwhen flag clicked\nswitch backdrop to (backdrop2 v)\nclear graphic effects\nwait until <(Level) = [8]>\nswitch backdrop to (cave v)\n\n@battle miner\n\nwhen flag clicked\nswitch costume to (warrior v)\ngo to x: (-147) y: (77)\npoint in direction (90)\n\nwhen I receive [message1 v]\nstop [other scripts in sprite v]\nwait (0.25) seconds\nswitch costume to (warrior v)\nwait (0.1) seconds\nswitch costume to (warrior-jab 1 v)\nbroadcast (thrust attack v)\nrepeat (5)\n    wait (0.07) seconds\n    next costume\nend\nwait (0.1) seconds\nswitch costume to (warrior v)\nwait (0.1) seconds\npoint in direction (-90)\nbroadcast (return v)\n\nwhen I receive [return v]\nforever\n    if <<(x position) = [-147]> and <(y position) = [77]>> then\n        broadcast (finish v)\n        stop [this script v]\n    end\n    wait (0.1) seconds\n    switch costume to (warrior-walk1 v)\n    wait (0.1) seconds\n    switch costume to (warrior-walk2 v)\n    wait (0.1) seconds\n    switch costume to (warrior-walk3 v)\n    wait (0.1) seconds\n    switch costume to (warrior-walk2 v)\nend\n\nwhen I receive [swing v]\nset [animation v] to [yes]\nwait until <(Selecting) = [no]>\nswitch costume to (warrior v)\nforever\n    wait (0.1) seconds\n    switch costume to (warrior-walk1 v)\n    wait (0.1) seconds\n    switch costume to (warrior-walk2 v)\n    wait (0.1) seconds\n    switch costume to (warrior-walk3 v)\n    wait (0.1) seconds\n    switch costume to (warrior-walk2 v)\nend\n\nwhen I receive [thrust v]\nset [animation v] to [yes]\nwait until <(Selecting) = [no]>\nswitch costume to (warrior v)\nforever\n    wait (0.1) seconds\n    switch costume to (warrior-walk1 v)\n    wait (0.1) seconds\n    switch costume to (warrior-walk2 v)\n    wait (0.1) seconds\n    switch costume to (warrior-walk3 v)\n    wait (0.1) seconds\n    switch costume to (warrior-walk2 v)\nend\n\nwhen I receive [thrust v]\nwait until <(Selecting) = [no]>\nglide (2.5) secs to x: (attack x) y: (attack y)\nbroadcast (message1 v)\n\nwhen I receive [return v]\nglide (2.5) secs to x: (-147) y: (77)\n\nwhen I receive [finish v]\nswitch costume to (warrior v)\npoint in direction (90)\nset [animation v] to [no]\n\nwhen I receive [swing v]\nwait until <(Selecting) = [no]>\nglide (2.5) secs to x: (attack x) y: (attack y)\nbroadcast (message2 v)\n\nwhen I receive [message2 v]\nstop [other scripts in sprite v]\nwait (0.25) seconds\nswitch costume to (warrior v)\nwait (0.1) seconds\nswitch costume to (warrior-swing 1 v)\nrepeat (4)\n    wait (0.02) seconds\n    next costume\nend\nwait (0.14) seconds\nswitch costume to ((costume [number v]) - (1))\nswitch costume to ((costume [number v]) - (1))\nswitch costume to ((costume [number v]) - (1))\nswitch costume to ((costume [number v]) - (1))\nbroadcast (swing attack v)\nswitch costume to (warrior v)\nwait (0.1) seconds\npoint in direction (-90)\nbroadcast (return v)\n\nwhen I receive [monster attack v]\nwait (0.1) seconds\nif <not <(costume [number v]) = [22]>> then\n    if <(Warrior Health) = [0]> then\n        wait (0.25) seconds\n        switch costume to (warrior-death 1 v)\n        repeat (9)\n            wait (0.01) seconds\n            next costume\n        end\n        set [#3 v] to [1]\n        repeat (length of [players alive v])\n            if <(item (#3) of [players alive v]) = [Warrior]> then\n                set [id v] to (#3)\n            end\n            change [#3 v] by (1)\n        end\n        delete (ID) of [players alive v]\n    end\nend\n\nwhen this sprite clicked\nif <(revive) = [yes]> then\n    set [revived v] to [Warrior]\n    set [revive v] to [no]\nend\n\nwhen I receive [reborn v]\nif <<(revived) = [Warrior]> and <(Warrior Health) = [0]>> then\n    set [warrior health v] to (pick random (500) to (800))\n    wait (0.25) seconds\n    switch costume to (warrior-death 10 v)\n    repeat (9)\n        wait (0.01) seconds\n        switch costume to ((costume [number v]) - (1))\n    end\n    switch costume to (warrior v)\n    add [Warrior] to [players alive v]\nend\n\nwhen this sprite clicked\nif <<(heal) = [yes]> and <not <(Warrior Health) = [0]>>> then\n    set [healed v] to [Warrior]\n    set [heal v] to [no]\nend\n\nwhen I receive [new wave v]\nset [battleover? v] to [1]\n\nwhen I receive [_battle v]\nif <(Warrior Health) > [0]> then\n    switch costume to (archer v)\nend\n\n@Mage\n\nwhen flag clicked\nswitch costume to (mage v)\ngo to x: (-164) y: (-15)\n\nwhen I receive [revive v]\nwait until <(revive) = [no]>\nset [selecting v] to [no]\nswitch costume to (mage v)\nwait (0.1) seconds\nswitch costume to (mage-cast 1 v)\nwait (0.05) seconds\nswitch costume to (mage-cast 2 v)\nwait (0.05) seconds\nswitch costume to (mage-cast 3 v)\nwait (0.05) seconds\nswitch costume to (mage-cast 2 v)\nwait (0.05) seconds\nswitch costume to (mage-cast 1 v)\nwait (0.05) seconds\nswitch costume to (mage v)\nbroadcast (Light Beam v)\n\nwhen I receive [toxic v]\nset [animation v] to [yes]\nwait until <(Selecting) = [no]>\nswitch costume to (mage v)\nwait (0.1) seconds\nswitch costume to (mage-cast 1 v)\nwait (0.05) seconds\nswitch costume to (mage-cast 2 v)\nwait (0.05) seconds\nswitch costume to (mage-cast 3 v)\nwait (0.05) seconds\nswitch costume to (mage-cast 2 v)\nwait (0.05) seconds\nswitch costume to (mage-cast 1 v)\nwait (0.05) seconds\nswitch costume to (mage v)\nbroadcast (Poison v)\n\nwhen I receive [monster attack v]\nwait (0.1) seconds\nif <not <(costume [number v]) = [14]>> then\n    if <(Mage Health) = [0]> then\n        wait (0.25) seconds\n        switch costume to (mage-death 1 v)\n        repeat (9)\n            wait (0.01) seconds\n            next costume\n        end\n        set [#3 v] to [1]\n        repeat (length of [players alive v])\n            if <(item (#3) of [players alive v]) = [Mage]> then\n                set [id v] to (#3)\n            end\n            change [#3 v] by (1)\n        end\n        delete (ID) of [players alive v]\n        go [backward v] (10) layers\n    end\nend\n\nwhen this sprite clicked\nif <<(heal) = [yes]> and <not <(Mage Health) = [0]>>> then\n    set [healed v] to [Mage]\n    set [heal v] to [no]\nend\n\nwhen I receive [_battle v]\nif <(Mage Health) > [0]> then\n    switch costume to (archer v)\nend\n\n@Archer\n\nwhen flag clicked\nswitch costume to (archer v)\ngo to x: (-134) y: (-115)\n\nwhen I receive [shoot v]\nset [animation v] to [yes]\nwait until <(Selecting) = [no]>\nswitch costume to (archer v)\nwait (0.1) seconds\nrepeat (18)\n    wait (0.01) seconds\n    next costume\nend\nwait (0.5) seconds\nbroadcast (arrow fire v)\nrepeat (5)\n    wait (0.01) seconds\n    next costume\nend\nswitch costume to (archer v)\n\nwhen I receive [monster attack v]\nwait (0.1) seconds\nif <not <(costume [number v]) = [34]>> then\n    if <(Archer Health) = [0]> then\n        wait (0.25) seconds\n        switch costume to (archer-death 1 v)\n        repeat (9)\n            wait (0) seconds\n            next costume\n        end\n        set [#3 v] to [1]\n        repeat (length of [players alive v])\n            if <(item (#3) of [players alive v]) = [Archer]> then\n                set [id v] to (#3)\n            end\n            change [#3 v] by (1)\n        end\n        delete (ID) of [players alive v]\n    end\nend\n\nwhen this sprite clicked\nif <(revive) = [yes]> then\n    set [revived v] to [Archer]\n    set [revive v] to [no]\nend\n\nwhen I receive [reborn v]\nif <<(revived) = [Archer]> and <(Archer Health) = [0]>> then\n    set [archer health v] to (pick random (400) to (700))\n    wait (0.25) seconds\n    switch costume to (archer-death 10 v)\n    repeat (9)\n        wait (0) seconds\n        switch costume to ((costume [number v]) - (1))\n    end\n    switch costume to (archer v)\n    add [Archer] to [players alive v]\nend\n\nwhen I receive [heal v]\nset [animation v] to [yes]\nwait until <(heal) = [no]>\nset [selecting v] to [no]\nswitch costume to (archer v)\nwait (0.1) seconds\nrepeat (18)\n    wait (0.01) seconds\n    next costume\nend\nwait (0.5) seconds\nbroadcast (heal arrow v)\nrepeat (5)\n    wait (0.01) seconds\n    next costume\nend\nswitch costume to (archer v)\n\nwhen this sprite clicked\nif <<(heal) = [yes]> and <not <(Archer Health) = [0]>>> then\n    set [healed v] to [Archer]\n    set [heal v] to [no]\nend\n\nwhen I receive [_battle v]\nif <(Archer Health) > [0]> then\n    switch costume to (archer v)\nend\n\n@Arrow\n\nwhen flag clicked\ngo to (archer v)\npoint in direction (90)\nset [ghost v] effect to (100)\n\nwhen I receive [arc v]\nrepeat (5)\n    turn right (-1.2) degrees\n    wait (0.05) seconds\nend\n\nwhen I receive [arc 2 v]\nrepeat (5)\n    turn right (2) degrees\n    wait (0.05) seconds\nend\n\nwhen I receive [arrow fire v]\nset [ghost v] effect to (0)\nset [arrow gone v] to [no]\nif <(arrow attack) = [1]> then\n    point in direction (80)\n    broadcast (Arc 2 v)\n    glide (0.57) secs to x: (61) y: (72)\n    broadcast (Arrow Fired v)\nend\nif <(arrow attack) = [2]> then\n    broadcast (Arc v)\n    glide (0.5) secs to x: (61) y: (-21)\n    broadcast (Arrow Fired v)\nend\nif <(arrow attack) = [3]> then\n    repeat (18)\n        revolve (-5) degrees around x: (-10) y: (-200)\n        turn right (2.5) degrees\n    end\n    broadcast (Arrow Fired v)\nend\n\nwhen I receive [arrow fired v]\nrepeat (50)\n    change [ghost v] effect by (2)\nend\nset [arrow gone v] to [yes]\nset [animation v] to [no]\ngo to (archer v)\npoint in direction (90)\n\ndefine None\nif <((y position) - (ypos)) = [0]> then\n    if <(x position) > (xpos)> then\n        set x to ((([sin v] of ((90) - (deg)) ) * ([sqrt v] of ((((x position) - (xpos)) * ((x position) - (xpos))) + (((y position) - (ypos)) * ((y position) - (ypos)))) )) + (xpos))\n        set y to ((([cos v] of ((90) - (deg)) ) * ([sqrt v] of ((((x position) - (xpos)) * ((x position) - (xpos))) + (((y position) - (ypos)) * ((y position) - (ypos)))) )) + (ypos))\n    else\n        set x to ((([sin v] of ((-90) - (deg)) ) * ([sqrt v] of ((((x position) - (xpos)) * ((x position) - (xpos))) + (((y position) - (ypos)) * ((y position) - (ypos)))) )) + (xpos))\n        set y to ((([cos v] of ((-90) - (deg)) ) * ([sqrt v] of ((((x position) - (xpos)) * ((x position) - (xpos))) + (((y position) - (ypos)) * ((y position) - (ypos)))) )) + (ypos))\n    end\nelse\n    if <((y position) - (ypos)) < [0]> then\n        set x to ((([sin v] of ((([atan v] of (((x position) - (xpos)) / ((y position) - (ypos))) ) + (180)) - (deg)) ) * ([sqrt v] of ((((x position) - (xpos)) * ((x position) - (xpos))) + (((y position) - (ypos)) * ((y position) - (ypos)))) )) + (xpos))\n        set y to ((([cos v] of ((([atan v] of (((x position) - (xpos)) / ((y position) - (ypos))) ) + (180)) - (deg)) ) * ([sqrt v] of ((((x position) - (xpos)) * ((x position) - (xpos))) + (((y position) - (ypos)) * ((y position) - (ypos)))) )) + (ypos))\n    else\n        set x to ((([sin v] of (([atan v] of (((x position) - (xpos)) / ((y position) - (ypos))) ) - (deg)) ) * ([sqrt v] of ((((x position) - (xpos)) * ((x position) - (xpos))) + (((y position) - (ypos)) * ((y position) - (ypos)))) )) + (xpos))\n        set y to ((([cos v] of (([atan v] of (((x position) - (xpos)) / ((y position) - (ypos))) ) - (deg)) ) * ([sqrt v] of ((((x position) - (xpos)) * ((x position) - (xpos))) + (((y position) - (ypos)) * ((y position) - (ypos)))) )) + (ypos))\n    end\nend\n\nwhen I receive [heal arrow v]\nset [ghost v] effect to (0)\nglide (0.25) secs to x: (-2) y: (-72)\nset [speed v] to [5]\nrepeat (40)\n    revolve (5) degrees around x: (-20) y: (0)\n    turn right ((6) - (speed)) degrees\n    change [speed v] by (0.1)\nend\nif <(healed) = [Warrior]> then\n    repeat (10)\n        revolve (5) degrees around x: (-20) y: (0)\n        turn right ((6) - (speed)) degrees\n        change [speed v] by (0.1)\n    end\nend\nif <(healed) = [Mage]> then\n    repeat (10)\n        revolve (5) degrees around x: (-20) y: (0)\n        turn right ((6) - (speed)) degrees\n        change [speed v] by (0.1)\n    end\nend\nif <(healed) = [Archer]> then\nend\nrepeat (10)\n    revolve (5) degrees around x: (-20) y: (0)\n    turn right ((6) - (speed)) degrees\n    change [speed v] by (0.1)\n    change [ghost v] effect by (10)\nend\nif <(healed) = [Warrior]> then\n    change [warrior health v] by (pick random (400) to (600))\nend\nif <(healed) = [Mage]> then\n    change [mage health v] by (pick random (300) to (500))\nend\nif <(healed) = [Archer]> then\n    change [archer health v] by (pick random (300) to (500))\nend\nbroadcast (Arrow Fired v)\n\n@Enemies\n\n@Monster 1\n\nwhen flag clicked\ngo to x: (116) y: (77)\nswitch costume to (slime v)\nforever\n    if <<not <(M1 health) = [0]>> and <<touching (mouse-pointer v)?> and <mouse down?>>> then\n        if <(swing attk) = [yes]> then\n            set [attack x v] to [52]\n        else\n            set [attack x v] to [48]\n        end\n        set [attack y v] to [95]\n        set [selecting v] to [no]\n        set [arrow attack v] to [1]\n    end\n    if <(M1 health) < [1]> then\n        set [m1 health v] to [0]\n    end\nend\n\nwhen I receive [swing attack v]\nif <(attack y) = [95]> then\n    change [m1 health v] by (pick random (-150) to (-250))\nend\nif <(M1 health) < [0]> then\n    if <(_enemy) = [mud]> then\n        repeat (20)\n            change [ghost v] effect by (5)\n        end\n    else\n        repeat (3)\n            wait (0.1) seconds\n            next costume\n        end\n        repeat (20)\n            change [ghost v] effect by (5)\n        end\n    end\nend\n\nwhen I receive [arrow fired v]\nif <touching (arrow v)?> then\n    set [rand v] to (pick random (1) to (4))\n    if <(rand) = [4]> then\n        change [m1 health v] by (pick random (-240) to (-280))\n    else\n        change [m1 health v] by (pick random (-60) to (-160))\n    end\nend\nif <(M1 health) < [0]> then\n    wait until <(arrow gone) = [yes]>\n    if <(_enemy) = [mud]> then\n        repeat (20)\n            change [ghost v] effect by (5)\n        end\n    else\n        repeat (3)\n            wait (0.1) seconds\n            next costume\n        end\n        repeat (20)\n            change [ghost v] effect by (5)\n        end\n    end\nend\n\nwhen I receive [thrust attack v]\nchange [m1 health v] by (pick random (-50) to (-120))\nif <(M1 health) < [0]> then\n    repeat (3)\n        wait (0.1) seconds\n        next costume\n    end\n    repeat (20)\n        change [ghost v] effect by (5)\n    end\nend\n\nwhen I receive [poison v]\nif <(attack y) = [95]> then\n    repeat until <(duration) = [0]>\n        if <touching (poison v)?> then\n            change [m1 health v] by (-2)\n        end\n    end\nend\n\nwhen I receive [erase v]\nwait (1) seconds\nif <<not <(costume [number v]) = [4]>> and <(M1 health) = [0]>> then\n    if <(_enemy) = [mud]> then\n        repeat (20)\n            change [ghost v] effect by (5)\n        end\n    else\n        repeat (3)\n            wait (0.1) seconds\n            next costume\n        end\n        repeat (20)\n            change [ghost v] effect by (5)\n        end\n    end\nend\n\nwhen I receive [new wave v]\nset [ghost v] effect to (0)\nwait (0) seconds\nglide (pick random (1.1) to (2)) secs to x: (116) y: (77)\n\nwhen I receive [new wave v]\ngo to x: (240) y: (77)\nif <(_enemy) = [mud]> then\n    switch costume to (costume1 v)\nelse\n    switch costume to (slime-bounce 1 v)\n    repeat until <<(x position) = [116]> and <(y position) = [77]>>\n        repeat (2)\n            wait (0.15) seconds\n            next costume\n        end\n        repeat (2)\n            wait (0.15) seconds\n            switch costume to ((costume [number v]) - (1))\n        end\n    end\n    switch costume to (slime v)\nend\n\nwhen I receive [delete buttons v]\nif <(Turn) = [Monster 1]> then\n    if <(M1 health) = [0]> then\n        set [turn v] to [Monster 2]\n        broadcast (delete buttons v)\n    end\n    if <not <(M1 health) = [0]>> then\n        set [victim v] to (item (random) of [players alive v])\n        wait until <(animation) = [no]>\n        wait (1) seconds\n        set [found v] to [no]\n        broadcast (find victim v)\n        if <(_enemy) = [mud]> then\n            switch costume to (costume1 v)\n        else\n            switch costume to (slime-bounce 1 v)\n        end\n        repeat until <(found) = [yes]>\n            if <not <(_enemy) = [mud]>> then\n                repeat (2)\n                    wait (0.15) seconds\n                    next costume\n                end\n                repeat (2)\n                    wait (0.15) seconds\n                    switch costume to ((costume [number v]) - (1))\n                end\n            end\n        end\n        if <(victim) = [Warrior]> then\n            if <(_enemy) = [mud]> then\n                change [warrior health v] by ((pick random (-120) to (-160)) - ((wave) * (60)))\n            else\n                change [warrior health v] by ((pick random (-100) to (-150)) - ((wave) * (60)))\n            end\n        end\n        if <(victim) = [Mage]> then\n            if <(_enemy) = [mud]> then\n                change [mage health v] by ((pick random (-120) to (-150)) - ((wave) * (60)))\n            else\n                change [mage health v] by ((pick random (-100) to (-150)) - ((wave) * (60)))\n            end\n        end\n        if <(victim) = [Archer]> then\n            if <(_enemy) = [mud]> then\n                change [archer health v] by ((pick random (-120) to (-150)) - ((wave) * (60)))\n            else\n                change [archer health v] by ((pick random (-100) to (-150)) - ((wave) * (60)))\n            end\n        end\n        set [found v] to [no]\n        broadcast (monster attack v)\n        repeat until <(found) = [yes]>\n            if <not <(_enemy) = [mud]>> then\n                repeat (2)\n                    wait (0.15) seconds\n                    next costume\n                end\n                repeat (2)\n                    wait (0.15) seconds\n                    switch costume to ((costume [number v]) - (1))\n                end\n            end\n        end\n        set [turn v] to [Monster 2]\n        broadcast (delete buttons v)\n        if <not <(_enemy) = [mud]>> then\n            switch costume to (slime v)\n        end\n    else\n        switch costume to (slime v)\n        repeat (10)\n            set [turn v] to [Monster 2]\n            broadcast (delete buttons v)\n        end\n    end\nend\n\nwhen I receive [monster attack v]\nif <(Turn) = [Monster 1]> then\n    if <not <(M1 health) = [0]>> then\n        glide (2.5) secs to x: (116) y: (77)\n        set [found v] to [yes]\n    end\nend\n\nwhen I receive [find victim v]\nif <(Turn) = [Monster 1]> then\n    if <not <(M1 health) = [0]>> then\n        if <(victim) = [Warrior]> then\n            glide (2.5) secs to x: (-121) y: (54)\n        end\n        if <(victim) = [Mage]> then\n            glide (2.5) secs to x: (-142) y: (-50)\n        end\n        if <(victim) = [Archer]> then\n            glide (2.5) secs to x: (-113) y: (-138)\n        end\n        set [found v] to [yes]\n    end\nend\n\nwhen I receive [_battle v]\nclear graphic effects\nforever\n    if <<(M1 health) = [0]> and <(Turn) = [Monster 1]>> then\n        set [turn v] to [Monster 2]\n        broadcast (delete buttons v)\n    end\nend\n\nwhen flag clicked\nshow\nforever\n    if <(_enemy) = [boss]> then\n        stop [other scripts in sprite v]\n        set [ghost v] effect to (100)\n        hide\n        if <(Turn) = [Monster 1]> then\n            set [turn v] to [Monster 2]\n            broadcast (delete buttons v)\n        end\n        if <(Turn) = [Monster 3]> then\n            set [turn v] to [Warrior]\n        end\n    end\nend\n\n@Monster 2\n\nwhen flag clicked\ngo to x: (116) y: (-15)\nswitch costume to (slime v)\nforever\n    if <<not <(M2 Health) = [0]>> and <<touching (mouse-pointer v)?> and <mouse down?>>> then\n        if <(swing attk) = [yes]> then\n            set [attack x v] to [52]\n        else\n            set [attack x v] to [48]\n        end\n        set [attack y v] to [4]\n        set [selecting v] to [no]\n        set [arrow attack v] to [2]\n    end\n    if <(M2 Health) < [0]> then\n        set [m2 health v] to [0]\n    end\nend\n\nwhen I receive [thrust attack v]\nchange [m2 health v] by (pick random (-100) to (-120))\nif <(M2 Health) < [0]> then\n    repeat (3)\n        wait (0.1) seconds\n        next costume\n    end\n    repeat (20)\n        change [ghost v] effect by (5)\n    end\nend\n\nwhen I receive [swing attack v]\nif <(attack y) = [4]> then\n    change [m2 health v] by (pick random (-150) to (-250))\nend\nif <(M2 Health) < [0]> then\n    repeat (3)\n        wait (0.1) seconds\n        next costume\n    end\n    repeat (20)\n        change [ghost v] effect by (5)\n    end\nend\n\nwhen I receive [arrow fired v]\nif <touching (arrow v)?> then\n    set [rand v] to (pick random (1) to (4))\n    if <(rand) = [4]> then\n        change [m2 health v] by (pick random (-240) to (-280))\n    else\n        change [m2 health v] by (pick random (-60) to (-160))\n    end\nend\nif <(M2 Health) < [1]> then\n    wait until <(arrow gone) = [yes]>\n    if <not <(_enemy) = [boss]>> then\n        repeat (3)\n            wait (0.1) seconds\n            next costume\n        end\n    end\n    repeat (20)\n        change [ghost v] effect by (5)\n    end\nend\n\nwhen I receive [poison v]\nif <(attack y) = [4]> then\n    repeat until <(duration) = [0]>\n        if <touching (poison v)?> then\n            change [m2 health v] by (-2)\n        end\n    end\nend\n\nwhen I receive [erase v]\nwait (1) seconds\nif <<not <(costume [number v]) = [4]>> and <(M2 Health) = [0]>> then\n    if <not <(_enemy) = [boss]>> then\n        repeat (3)\n            wait (0.1) seconds\n            next costume\n        end\n    end\n    repeat (20)\n        change [ghost v] effect by (5)\n    end\nend\n\nwhen I receive [new wave v]\nset [ghost v] effect to (0)\nwait (0) seconds\nglide (pick random (1.1) to (2)) secs to x: (116) y: (-15)\n\nwhen I receive [new wave v]\ngo to x: (240) y: (-15)\nswitch costume to (slime-bounce 1 v)\nrepeat until <<(x position) = [116]> and <(y position) = [-15]>>\n    repeat (2)\n        wait (0.15) seconds\n        next costume\n    end\n    repeat (2)\n        wait (0.15) seconds\n        switch costume to ((costume [number v]) - (1))\n    end\nend\nswitch costume to (slime v)\n\nwhen I receive [delete buttons v]\nif <(Turn) = [Monster 2]> then\n    if <not <(M2 Health) = [0]>> then\n        set [victim v] to (item (random) of [players alive v])\n        wait until <(animation) = [no]>\n        wait (1) seconds\n        set [found v] to [no]\n        broadcast (find victim v)\n        if <not <(_enemy) = [boss]>> then\n            switch costume to (slime-bounce 1 v)\n            repeat until <(found) = [yes]>\n                repeat (2)\n                    wait (0.15) seconds\n                    next costume\n                end\n                repeat (2)\n                    wait (0.15) seconds\n                    switch costume to ((costume [number v]) - (1))\n                end\n            end\n        end\n        if <(victim) = [Warrior]> then\n            change [warrior health v] by ((pick random (-100) to (-150)) - ((wave) * (60)))\n        end\n        if <(victim) = [Mage]> then\n            change [mage health v] by ((pick random (-100) to (-150)) - ((wave) * (60)))\n        end\n        if <(victim) = [Archer]> then\n            change [archer health v] by ((pick random (-100) to (-150)) - ((wave) * (60)))\n        end\n        set [found v] to [no]\n        broadcast (monster attack v)\n        repeat until <(found) = [yes]>\n            if <not <(_enemy) = [boss]>> then\n                repeat (2)\n                    wait (0.15) seconds\n                    next costume\n                end\n                repeat (2)\n                    wait (0.15) seconds\n                    switch costume to ((costume [number v]) - (1))\n                end\n                if <not <(_enemy) = [boss]>> then\n                    switch costume to (slime v)\n                    set [turn v] to [Monster 3]\n                    broadcast (delete buttons v)\n                else\n                    set [turn v] to [Monster 3]\n                    broadcast (delete buttons v)\n                end\n            end\n        end\n    else\n        if <not <(_enemy) = [boss]>> then\n            switch costume to (slime v)\n            set [turn v] to [Monster 3]\n            broadcast (delete buttons v)\n        else\n            set [turn v] to [Monster 3]\n            broadcast (delete buttons v)\n        end\n    end\nend\n\nwhen I receive [monster attack v]\nif <(Turn) = [Monster 2]> then\n    if <not <(M2 Health) = [0]>> then\n        glide (2.5) secs to x: (116) y: (-15)\n        set [found v] to [yes]\n    end\nend\n\nwhen I receive [find victim v]\nif <(Turn) = [Monster 2]> then\n    if <not <(M2 Health) = [0]>> then\n        if <(victim) = [Warrior]> then\n            glide (2.5) secs to x: (-121) y: (54)\n        end\n        if <(victim) = [Mage]> then\n            glide (2.5) secs to x: (-142) y: (-50)\n        end\n        if <(victim) = [Archer]> then\n            glide (2.5) secs to x: (-113) y: (-138)\n        end\n        if <(_enemy) = [boss]> then\n            if <(victim) = [Warrior]> then\n                change [warrior health v] by ((pick random (-200) to (-300)) - ((wave) * (60)))\n            end\n            if <(victim) = [Mage]> then\n                change [mage health v] by ((pick random (-100) to (-150)) - ((wave) * (60)))\n            end\n            if <(victim) = [Archer]> then\n                change [archer health v] by ((pick random (-230) to (-300)) - ((wave) * (60)))\n            end\n        end\n        set [found v] to [yes]\n    end\nend\n\nwhen I receive [_battle v]\nclear graphic effects\nif <(_enemy) = [boss]> then\n    set [m2 health v] to [2600]\nend\nforever\n    if <(Turn) = [Monster 2]> then\n        wait (3) seconds\n        broadcast (find victim v)\n        wait (3) seconds\n        broadcast (monster attack v)\n        wait (3) seconds\n        set [turn v] to [Monster 3]\n    end\nend\n\nwhen flag clicked\nforever\n    if <(_enemy) = [boss]> then\n        switch costume to (ancient wyrm v)\n        set [_enemy v] to [boss]\n    end\nend\n\n@Monster 3\n\nwhen flag clicked\ngo to x: (116) y: (-115)\nswitch costume to (slime v)\nforever\n    if <<not <(M3 Health) = [0]>> and <<touching (mouse-pointer v)?> and <mouse down?>>> then\n        if <(swing attk) = [yes]> then\n            set [attack x v] to [52]\n        else\n            set [attack x v] to [48]\n        end\n        set [attack y v] to [-97]\n        set [selecting v] to [no]\n        set [arrow attack v] to [3]\n    end\n    if <(M3 Health) < [1]> then\n        set [m3 health v] to [0]\n    end\nend\n\nwhen I receive [swing attack v]\nif <(attack y) = [-97]> then\n    change [m3 health v] by (pick random (-150) to (-250))\nend\nif <(M3 Health) < [0]> then\n    repeat (3)\n        wait (0.1) seconds\n        next costume\n    end\n    repeat (20)\n        change [ghost v] effect by (5)\n    end\nend\n\nwhen I receive [thrust attack v]\nchange [m3 health v] by (pick random (-100) to (-120))\nif <(M3 Health) < [0]> then\n    repeat (3)\n        wait (0.1) seconds\n        next costume\n    end\n    repeat (20)\n        change [ghost v] effect by (5)\n    end\nend\n\nwhen I receive [arrow fired v]\nif <touching (arrow v)?> then\n    set [rand v] to (pick random (1) to (4))\n    if <(rand) = [4]> then\n        change [m3 health v] by (pick random (-240) to (-280))\n    else\n        change [m3 health v] by (pick random (-60) to (-160))\n    end\nend\nif <(M3 Health) < [0]> then\n    wait until <(arrow gone) = [yes]>\n    repeat (3)\n        wait (0.1) seconds\n        next costume\n    end\n    repeat (20)\n        change [ghost v] effect by (5)\n    end\nend\n\nwhen I receive [poison v]\nif <(attack y) = [-97]> then\n    repeat until <(duration) = [0]>\n        if <touching (poison v)?> then\n            change [m3 health v] by (-2)\n        end\n    end\nend\n\nwhen I receive [erase v]\nwait (1) seconds\nif <<not <(costume [number v]) = [4]>> and <(M3 Health) = [0]>> then\n    repeat (3)\n        wait (0.1) seconds\n        next costume\n    end\n    repeat (20)\n        change [ghost v] effect by (5)\n    end\nend\n\nwhen I receive [new wave v]\nset [ghost v] effect to (0)\nwait (0) seconds\nglide (pick random (1.1) to (2)) secs to x: (116) y: (-115)\n\nwhen I receive [new wave v]\ngo to x: (240) y: (-115)\nswitch costume to (slime-bounce 1 v)\nrepeat until <<(x position) = [116]> and <(y position) = [-115]>>\n    repeat (2)\n        wait (0.15) seconds\n        next costume\n    end\n    repeat (2)\n        wait (0.15) seconds\n        switch costume to ((costume [number v]) - (1))\n    end\nend\nswitch costume to (slime v)\n\nwhen I receive [delete buttons v]\nif <(Turn) = [Monster 3]> then\n    if <not <(M3 Health) = [0]>> then\n        set [victim v] to (item (random) of [players alive v])\n        wait until <(animation) = [no]>\n        wait (1) seconds\n        set [found v] to [no]\n        broadcast (Find victim v)\n        switch costume to (slime-bounce 1 v)\n        repeat until <(found) = [yes]>\n            repeat (2)\n                wait (0.15) seconds\n                next costume\n            end\n            repeat (2)\n                wait (0.15) seconds\n                switch costume to ((costume [number v]) - (1))\n            end\n        end\n        if <(victim) = [Warrior]> then\n            change [warrior health v] by ((pick random (-100) to (-150)) - ((wave) * (60)))\n        end\n        if <(victim) = [Mage]> then\n            change [mage health v] by ((pick random (-100) to (-150)) - ((wave) * (60)))\n        end\n        if <(victim) = [Archer]> then\n            change [archer health v] by ((pick random (-100) to (-150)) - ((wave) * (60)))\n        end\n        set [found v] to [no]\n        broadcast (Monster Attack v)\n        repeat until <(found) = [yes]>\n            repeat (2)\n                wait (0.15) seconds\n                next costume\n            end\n            repeat (2)\n                wait (0.15) seconds\n                switch costume to ((costume [number v]) - (1))\n            end\n        end\n        switch costume to (slime v)\n        set [turn v] to [Warrior]\n        broadcast (delete buttons v)\n    else\n        switch costume to (slime v)\n        set [turn v] to [Warrior]\n        broadcast (Delete Buttons v)\n    end\nend\n\nwhen I receive [monster attack v]\nif <(Turn) = [Monster 3]> then\n    if <not <(M3 Health) = [0]>> then\n        glide (2.5) secs to x: (116) y: (-115)\n        set [found v] to [yes]\n    end\nend\n\nwhen I receive [find victim v]\nif <(Turn) = [Monster 3]> then\n    if <not <(M3 Health) = [0]>> then\n        if <(victim) = [Warrior]> then\n            glide (2.5) secs to x: (-121) y: (54)\n        end\n        if <(victim) = [Mage]> then\n            glide (2.5) secs to x: (-142) y: (-50)\n        end\n        if <(victim) = [Archer]> then\n            glide (2.5) secs to x: (-113) y: (-138)\n        end\n        set [found v] to [yes]\n    end\nend\n\nwhen I receive [_battle v]\nclear graphic effects\n\nwhen flag clicked\nshow\nforever\n    if <(_enemy) = [boss]> then\n        hide\n    end\nend\n\n@Healthbars\n\nwhen flag clicked\nset size to (100) %\nset [_enemy v] to [slime]\nhide\nset [ghost v] effect to (100)\nset [# v] to [1]\nrepeat (6)\n    create clone of (_myself_ v)\n    wait (0) seconds\n    change [# v] by (1)\nend\n\nwhen I start as a clone\nif <(#) = [1]> then\n    show\n    clear graphic effects\n    go to x: (-95) y: (168)\n    forever\n        if <(Warrior Health) = [1300]> then\n            switch costume to (full v)\n        else\n            if <(Warrior Health) = [0]> then\n                switch costume to (empty v)\n            else\n                switch costume to ((-1) * ((1) + (((48.5) / (1300)) * (Warrior Health))))\n            end\n        end\n    end\nend\nif <(#) = [2]> then\n    show\n    clear graphic effects\n    go to x: (-95) y: (152)\n    forever\n        if <(Mage Health) = [1000]> then\n            switch costume to (full v)\n        else\n            if <(Mage Health) = [0]> then\n                switch costume to (empty v)\n            else\n                switch costume to ((-1) * ((1) + (((48.5) / (1300)) * (Mage Health))))\n            end\n        end\n    end\nend\nif <(#) = [3]> then\n    show\n    clear graphic effects\n    go to x: (-95) y: (138)\n    forever\n        if <(Archer Health) = [1000]> then\n            switch costume to (full v)\n        else\n            if <(Archer Health) = [0]> then\n                switch costume to (empty v)\n            else\n                switch costume to ((-1) * ((1) + (((48.5) / (1000)) * (Archer Health))))\n            end\n        end\n    end\nend\nif <(#) = [4]> then\n    if <not <(_enemy) = [boss]>> then\n        show\n        clear graphic effects\n    end\n    go to x: (64) y: (168)\n    forever\n        if <not <(_enemy) = [boss]>> then\n            if <(M1 health) = (item (1) of [m-health max v])> then\n                switch costume to (full v)\n            else\n                if <(M1 health) = [0]> then\n                    switch costume to (empty v)\n                else\n                    switch costume to ((-1) * ((1) + (((48.5) / (item (1) of [m-health max v])) * (M1 health))))\n                end\n            end\n        else\n            hide\n        end\n    end\nend\nif <(#) = [5]> then\n    if <not <(_enemy) = [boss]>> then\n        show\n        clear graphic effects\n    end\n    if <not <(_enemy) = [boss]>> then\n        go to x: (64) y: (152)\n        forever\n            if <(M2 Health) = (item (2) of [m-health max v])> then\n                switch costume to (full v)\n            else\n                if <(M2 Health) = [0]> then\n                    switch costume to (empty v)\n                else\n                    switch costume to ((-1) * ((1) + (((48.5) / (item (2) of [m-health max v])) * (M2 Health))))\n                end\n            end\n        end\n    else\n        hide\n    end\nend\nif <(#) = [6]> then\n    if <not <(_enemy) = [boss]>> then\n        show\n        clear graphic effects\n    end\n    go to x: (64) y: (138)\n    forever\n        if <not <(_enemy) = [boss]>> then\n            if <(M3 Health) = (item (3) of [m-health max v])> then\n                switch costume to (full v)\n            else\n                if <(M3 Health) = [0]> then\n                    switch costume to (empty v)\n                else\n                    switch costume to ((-1) * ((1) + (((48.5) / (item (3) of [m-health max v])) * (M3 Health))))\n                end\n            end\n        else\n            hide\n        end\n    end\nend\n\nwhen flag clicked\nforever\n    if <(Archer Health) < [1]> then\n        set [archer health v] to [0]\n    end\n    if <(Warrior Health) < [1]> then\n        set [warrior health v] to [0]\n    end\n    if <(Mage Health) < [1]> then\n        set [mage health v] to [0]\n    end\nend\n\n@Displays\n\nwhen flag clicked\nswitch costume to (costume1 v)\nset [ghost v] effect to (25)\nwait until <(Level) = [11]>\nswitch costume to (costume2 v)\n\nwhen I receive [_battle v]\nwait until <<(M3 Health) < [1]> and <<(M2 Health) < [1]> and <(M1 health) < [1]>>>\nwait (1) seconds\nbroadcast (new wave v)\n\n@Buttons\n\nwhen flag clicked\nset [#2 v] to []\nset [selecting v] to [no]\nset [ghost v] effect to (100)\nforever\n    if <<(Turn) = [Warrior]> or <<(Turn) = [Mage]> or <(Turn) = [Archer]>>> then\n        show\n        if <(Turn) = [Warrior]> then\n            wait until <(Selecting) = [no]>\n            wait until <(animation) = [no]>\n            set [#2 v] to [Thrust]\n            create clone of (_myself_ v)\n            wait (0) seconds\n            set [#2 v] to [Swing]\n            create clone of (_myself_ v)\n            wait (0) seconds\n            set [#2 v] to [Pass]\n            create clone of (_myself_ v)\n            wait until <not <(Turn) = [Warrior]>>\n            broadcast (delete buttons v)\n        end\n        if <(Turn) = [Mage]> then\n            wait until <(Selecting) = [no]>\n            wait until <(animation) = [no]>\n            set [#2 v] to [Poison]\n            create clone of (_myself_ v)\n            wait (0) seconds\n            set [#2 v] to [Revive]\n            create clone of (_myself_ v)\n            wait (0) seconds\n            set [#2 v] to [Pass]\n            create clone of (_myself_ v)\n            wait until <not <(Turn) = [Mage]>>\n            broadcast (delete buttons v)\n        end\n        if <(Turn) = [Archer]> then\n            wait until <(Selecting) = [no]>\n            wait until <(animation) = [no]>\n            set [#2 v] to [Shoot]\n            create clone of (_myself_ v)\n            wait (0) seconds\n            set [#2 v] to [Heal]\n            create clone of (_myself_ v)\n            wait (0) seconds\n            set [#2 v] to [Pass]\n            create clone of (_myself_ v)\n            wait until <not <(Turn) = [Archer]>>\n            broadcast (delete buttons v)\n        end\n    else\n        hide\n    end\nend\n\nwhen I start as a clone\nset [ghost v] effect to (0)\nif <(#2) = [Pass]> then\n    switch costume to (pass v)\n    go to x: (10) y: (-145)\nend\nif <(#2) = [Thrust]> then\n    switch costume to (thrust v)\n    go to x: (-10) y: (-50)\nend\nif <(#2) = [Swing]> then\n    switch costume to (swing v)\n    go to x: (1) y: (-95)\nend\nif <(#2) = [Poison]> then\n    switch costume to (poison v)\n    go to x: (0) y: (-46)\nend\nif <(#2) = [Revive]> then\n    switch costume to (revive v)\n    go to x: (-5) y: (-95)\nend\nif <(#2) = [Pass]> then\n    switch costume to (pass v)\n    go to x: (10) y: (-145)\nend\nif <(#2) = [Shoot]> then\n    switch costume to (shoot v)\n    go to x: (0) y: (-46)\nend\nif <(#2) = [Heal]> then\n    switch costume to (heal v)\n    go to x: (8) y: (-95)\nend\nforever\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        wait until <not <mouse down?>>\n        if <(Turn) = [Archer]> then\n            set [turn v] to [Monster 1]\n        end\n        if <(Turn) = [Mage]> then\n            set [turn v] to [Archer]\n        end\n        if <(Turn) = [Warrior]> then\n            set [turn v] to [Mage]\n        end\n        if <(costume [number v]) = [2]> then\n            set [selecting v] to [yes]\n            broadcast (thrust v)\n        end\n        if <(costume [number v]) = [3]> then\n            set [selecting v] to [yes]\n            set [swing attk v] to [yes]\n            broadcast (swing v)\n        end\n        if <(costume [number v]) = [4]> then\n            set [selecting v] to [yes]\n            broadcast (shoot v)\n        end\n        if <(costume [number v]) = [5]> then\n            set [selecting v] to [yes]\n            set [heal v] to [yes]\n            broadcast (heal v)\n        end\n        if <(costume [number v]) = [6]> then\n            set [selecting v] to [yes]\n            broadcast (toxic v)\n        end\n        if <(costume [number v]) = [7]> then\n            set [selecting v] to [yes]\n            set [revive v] to [yes]\n            broadcast (revive v)\n        end\n    end\nend\n\nwhen I receive [delete buttons v]\ndelete this clone\n\n@Poison\n\nwhen I start as a clone\nshow\nswitch costume to (costume1 v)\nrepeat (pick random (8) to (12))\n    change x by (((((10) * ([sin v] of ((sine) + (off set)) )) + (x off set)) - (x position)) * (0.3))\n    change y by (4)\n    if <touching (_edge_ v)?> then\n        delete this clone\n    end\nend\nnext costume\nrepeat (pick random (8) to (12))\n    change x by (((((12) * ([sin v] of ((sine) + (off set)) )) + (x off set)) - (x position)) * (0.3))\n    change y by (4)\n    if <touching (_edge_ v)?> then\n        delete this clone\n    end\nend\ndelete this clone\n\ndefine None\nset [ghost v] effect to (40)\nhide\nset size to (size) %\nforever\n    go to x: (firex) y: (firey)\n    set [color v] effect to (pick random (10) to (-10))\n    set [x off set v] to (firex)\n    set [off set v] to (pick random (0) to (500))\n    create clone of (_myself_ v)\nend\n\nwhen I receive [poison v]\ncreate poison cloud at x: ((attack x) + (70)) y: ((attack y) - (20)) with size: (100)\n\nwhen I receive [poison v]\nset [duration v] to (pick random (3) to (5))\nrepeat until <(duration) = [0]>\n    wait (1) seconds\n    change [duration v] by (-1)\nend\nbroadcast (Erase v)\n\nwhen I receive [erase v]\nchange [ghost v] effect by (25)\nwait (0) seconds\nchange [ghost v] effect by (25)\nwait (0) seconds\nchange [ghost v] effect by (25)\nwait (0) seconds\nchange [ghost v] effect by (25)\nstop [other scripts in sprite v]\nset [animation v] to [no]\ndelete this clone\n\n@Revive\n\nwhen flag clicked\nset [ghost v] effect to (100)\n\nwhen I receive [light beam v]\nif <(revived) = [Warrior]> then\n    go to (battle miner v)\nend\nif <(revived) = [Archer]> then\n    go to x: (([x position v] of [archer v]) - (30)) y: ([y position v] of [archer v])\nend\nrepeat (10)\n    wait (0.05) seconds\n    change [ghost v] effect by (-2)\nend\nbroadcast (Reborn v)\nwait (1) seconds\nrepeat (10)\n    wait (0.05) seconds\n    change [ghost v] effect by (2)\nend\n\nif <(revived) = [Warrior]> then\n    go to (battle miner v)\nend\nif <(revived) = [Archer]> then\n    go to (archer v)\nend\n\n@Game Over\n\nwhen flag clicked\nhide\nswitch costume to (costume1 v)\nset [ghost v] effect to (100)\ngo to x: (0) y: (0)\nwait (1) seconds\nforever\n    go to [front v] layer\n    if <<(Warrior Health) = [0]> and <<(Mage Health) = [0]> and <(Archer Health) = [0]>>> then\n        show\n        repeat (25)\n            wait (0.01) seconds\n            change [ghost v] effect by (-4)\n        end\n        stop [all v]\n    end\nend\n\n@story\n\nwhen flag clicked\nstart sound [Wings v]\ngo to x: (0) y: (0)\ngo to [front v] layer\nswitch costume to (costume1 v)\nshow\nforever\n    if <mouse down?> then\n        if <(costume [number v]) = [7]> then\n            broadcast (start v)\n        end\n        next costume\n        wait until <not <mouse down?>>\n    end\n    if <key (x v) pressed?> then\n        switch costume to (costume7 v)\n    end\nend\n\nwhen [m v] key pressed\nif <(volume) = [100]> then\n    set volume to (0) %\nelse\n    set volume to (100) %\nend\n\nwhen I receive [start v]\nstop all sounds\nstop [other scripts in sprite v]\ngo to x: (999) y: (999)\nhide\nforever\n    play sound [Darkside - Alan Walker v] until done\n    play sound [Spectre - Alan Walker v] until done\nend\n\nwhen I receive [_battle v]\nif <(Level) = [11]> then\n    stop [other scripts in sprite v]\n    forever\n        play sound [Heartache.mp3 v] until done\n    end\nend\n\n@Player\n\ndefine Place Player: (x) (y) Set Size To: (size)\ngo to x: (x) y: (y)\nset size to (size) %\n\nwhen flag clicked\nhide\n\ndefine Gravity, Platform Detection, Physics....\nforever\n    if <(battleover?) = [1]> then\n        go to [front v] layer\n        change [y v] by (-1)\n        if <<<key (a v) pressed?> or <key (left arrow v) pressed?>> or <<mouse down?> and <(mouse x) < (x position)>>> then\n            switch costume to (3 v)\n            point in direction (-90)\n            change [x v] by (-1)\n        end\n        if <<<key (d v) pressed?> or <key (right arrow v) pressed?>> or <<mouse down?> and <(mouse x) > (x position)>>> then\n            switch costume to (4 v)\n            point in direction (90)\n            change [x v] by (1)\n        end\n        set [x v] to ((x) * (0.9))\n        change x by (x)\n        if <touching (dirt v)?> then\n            set [x v] to [-3]\n            set [y v] to [2]\n        end\n        if <touching (levels v)?> then\n            change y by (1)\n        end\n        if <touching (levels v)?> then\n            change y by (1)\n        end\n        if <touching (levels v)?> then\n            change y by (1)\n        end\n        if <touching (levels v)?> then\n            change y by (1)\n        end\n        if <touching (levels v)?> then\n            change y by (-4)\n            change x by ((x) * (-1))\n            if <<<key (up arrow v) pressed?> or <key (w v) pressed?>> or <<mouse down?> and <(mouse y) > [0]>>> then\n                set [y v] to [17]\n                if <(x) > [0]> 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 (levels 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 <key (w v) pressed?>> or <<mouse down?> and <((mouse y) - (y position)) > [50]>>> and <touching (levels v)?>> then\n            switch costume to (4 v)\n            set [y v] to [15]\n        end\n        change y by (1)\n        if <<<<touching (deadlies v)?> or <touching (enemies v)?>> or <(y position) < [-175]>> or <key (r v) pressed?>> then\n            if <(Level) = [6]> then\n                change [level v] by (1)\n                Place Player: [-200] [0] Set Size To: [100]\n                broadcast (lvlchange v)\n            else\n                Place Player: [-200] [0] Set Size To: [100]\n            end\n        end\n        if <(x position) > [230]> then\n            change [level v] by (1)\n            Place Player: [-200] [0] Set Size To: [100]\n            broadcast (lvlchange v)\n        end\n        if <touching (bouncers v)?> then\n            start sound [Squish Pop v]\n            set [y v] to [20]\n        end\n    end\nend\n\nwhen flag clicked\nset volume to (100) %\nforever\n    if <<key ((join [] [,]) v) pressed?> and <key (q v) pressed?>> then\n        if <(battleover?) = [1]> then\n            Place Player: [-200] [0] Set Size To: [100]\n            change [level v] by (1)\n            broadcast (lvlchange v)\n            wait (0.1) seconds\n            if <(Level) = [11]> then\n                stop [this script v]\n            end\n        end\n    end\nend\n\nwhen I receive [start v]\nshow\nwait (0) seconds\n\nwhen I receive [start v]\nPlace Player: [-200] [0] Set Size To: [100]\nhide variable [y v]\nhide variable [x v]\nset [y v] to [0]\nset [x v] to [0]\nset [level v] to [1]\nforever\n    Gravity, Platform Detection, Physics....\nend\n\nwhen I receive [_battle v]\nhide\nwait until <(battleover?) = [1]>\nPlace Player: [-200] [0] Set Size To: [100]\nshow\n\nwhen I receive [_clearfront v]\nhide\nwait until <(battleover?) = [1]>\nPlace Player: [-200] [0] Set Size To: [100]\nshow\n\n@Levels\n\nwhen flag clicked\nhide\ngo to [front v] layer\n\nwhen I receive [start v]\nshow\nforever\n    switch costume to (Level)\nend\n\nwhen I receive [_battle v]\nhide\nwait until <(battleover?) = [1]>\nshow\n\nwhen I receive [_clearfront v]\nhide\nwait until <(battleover?) = [1]>\nshow\n\n@lv art\n\nwhen flag clicked\nhide variable [coins v]\ngo to [front v] layer\ngo [backward v] (3) layers\n\nwhen I receive [start v]\nshow\nforever\n    switch costume to (Level)\n    if <(costume [number v]) = [2]> then\n        show variable [coins v]\n    end\nend\n\nwhen I receive [_battle v]\nhide\nwait until <(battleover?) = [1]>\nshow\n\nwhen I receive [_clearfront v]\nhide\nwait until <(battleover?) = [1]>\nshow\n\n@pick\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nshow\nforever\n    go to (player v)\n    point in direction ([direction v] of [player v])\nend\n\nwhen I receive [start v]\nshow\nforever\n    switch costume to (pickaxe7 v)\n    go to [front v] layer\n    if <<key (s v) pressed?> or <key (down arrow v) pressed?>> then\n        wait (0.2) seconds\n        switch costume to (pickaxe2 v)\n        wait (0.2) seconds\n        switch costume to (pickaxe7 v)\n    end\nend\n\nwhen I receive [_battle v]\nhide\nwait until <(battleover?) = [1]>\nshow\n\nwhen I receive [_clearfront v]\nhide\nwait until <(battleover?) = [1]>\nshow\n\n@coin\n\nwhen flag clicked\nset [coins v] to [0]\nhide\nset [_coincome v] to [0]\nforever\n    if <(_coincome) = [1]> then\n        show\n    else\n        hide\n    end\nend\n\nwhen I receive [start v]\nset [level v] to [1]\ngo to [front v] layer\n\nwhen I receive [_battle v]\nrepeat until <(battleover?) = [1]>\n    hide\nend\nshow\n\nwhen I receive [start v]\nset [level v] to [1]\nforever\n    if <touching (player v)?> then\n        hide\n        change [coins v] by (1)\n        set [_coincome v] to [0]\n        start sound [Coin v]\n        wait until <(_coincome) = [1]>\n        show\n    end\nend\n\nwhen I receive [lvlchange v]\nif <(Level) = [2]> then\n    go to x: (212) y: (149)\n    set [_coincome v] to [1]\n    show\nend\nif <(Level) = [3]> then\n    go to x: (-26) y: (-75)\n    show\n    set [_coincome v] to [1]\nend\nif <(Level) = [4]> then\n    go to x: (216) y: (45)\n    set [_coincome v] to [1]\n    show\nend\nif <(Level) = [5]> then\n    go to x: (140) y: (-83)\n    set [_coincome v] to [1]\n    show\nend\nif <(Level) = [7]> then\n    go to x: (140) y: (-70)\n    set [_coincome v] to [1]\n    show\nend\nif <(Level) = [11]> then\n    hide\n    hide variable [coins v]\nend\nif <(Level) = [9]> then\n    go to x: (-145) y: (20)\n    set [_coincome v] to [1]\n    show\nend\nif <(Level) = [8]> then\n    go to x: (137) y: (-2)\n    set [_coincome v] to [1]\n    show\nend\n\nwhen I receive [_clearfront v]\nhide\nwait until <(battleover?) = [1]>\nshow\n\n@Bouncers\n\nwhen I receive [start v]\nshow\nforever\n    go to [front v] layer\n    switch costume to (Level)\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [_battle v]\nhide\nwait until <(battleover?) = [1]>\nshow\n\n@touchable\n\nwhen flag clicked\nhide\nset [battleover? v] to [1]\n\nwhen I receive [start v]\ngo to [front v] layer\nshow\nbroadcast (enemyspawn v)\n\nwhen I receive [_battle v]\nrepeat until <(battleover?) = [1]>\n    go to [back v] layer\n    hide\nend\n\nwhen I receive [_battle v]\nhide variable [coins v]\nwait until <(battleover?) = [1]>\ngo to [front v] layer\nshow variable [coins v]\n\nwhen I receive [enemyspawn v]\nforever\n    if <(Level) = [4]> then\n        show\n        switch costume to (Level)\n        stop [other scripts in sprite v]\n        wait until <touching (player v)?>\n        if <touching (player v)?> then\n            set [_enemy v] to [slime]\n            set [battleover? v] to [0]\n            broadcast (_battle v)\n            hide\n        end\n        wait until <(Level) = [5]>\n        broadcast (enemyspawn v)\n    end\nend\n\nstop [this script v]\n\nwhen I receive [enemyspawn v]\nforever\n    if <(Level) = [11]> then\n        show\n        switch costume to (Level)\n        stop [other scripts in sprite v]\n        wait until <touching (player v)?>\n        if <touching (player v)?> then\n            set [_enemy v] to [boss]\n            set [battleover? v] to [0]\n            broadcast (_battle v)\n            hide\n            wait until <(battleover?) = [1]>\n            broadcast (enemyspawn v)\n        end\n    end\nend\n\nwhen I receive [enemyspawn v]\nforever\n    switch costume to (Level)\nend\n\nwhen I receive [enemyspawn v]\nforever\n    if <(Level) = [9]> then\n        show\n        switch costume to (Level)\n        stop [other scripts in sprite v]\n        wait until <touching (player v)?>\n        broadcast (new wave v)\n        repeat (10)\n            broadcast (_battle v)\n            set [battleover? v] to [0]\n            broadcast (_clearfront v)\n            set [_enemy v] to [mud]\n        end\n        hide\n        wait until <(Level) = [10]>\n        broadcast (enemyspawn v)\n    end\nend\n\nstop [this script v]\n\nwhen I receive [enemyspawn v]\nforever\n    if <(Level) = [6]> then\n        show\n        switch costume to (Level)\n        stop [other scripts in sprite v]\n        wait until <touching (player v)?>\n        if <touching (player v)?> then\n            set [_enemy v] to [slime]\n            set [battleover? v] to [0]\n            broadcast (_battle v)\n            hide\n            wait until <(Level) = [7]>\n            broadcast (enemyspawn v)\n        end\n    end\nend\n\nstop [this script v]\n\n@Deadlies\n\nwhen I receive [start v]\nshow\nforever\n    switch costume to (Level)\nend\n\nwhen flag clicked\nhide\ngo to [front v] layer\n\nwhen I receive [_battle v]\nhide\nwait until <(battleover?) = [1]>\nshow\n\n@dirt\n\nwhen flag clicked\nhide\nwait until <(Level) = [6]>\nswitch costume to (dirt v)\nshow\nforever\n    go to [front v] layer\n    if <<touching (pick v)?> and <<key (down arrow v) pressed?> or <key (s v) pressed?>>> then\n        wait (2) seconds\n        hide\n        stop [this script v]\n    end\nend\n\nwhen I receive [_battle v]\nrepeat until <(battleover?) = [1]>\n    go to [back v] layer\n    hide\nend\nif <(Level) = [6]> then\n    show\n    go to [front v] layer\nend\n\nwhen flag clicked\nhide\nset [level v] to [1]\nwait until <(Level) = [8]>\nswitch costume to (rocks v)\nshow\nforever\n    go to [front v] layer\n    if <<touching (pick v)?> and <<key (down arrow v) pressed?> or <key (s v) pressed?>>> then\n        wait (3) seconds\n        hide\n        stop [this script v]\n    end\nend\n\nwhen I receive [_clearfront v]\nhide\nwait until <(battleover?) = [1]>\n\n@shop\n\nwhen flag clicked\nhide\nwait until <(Level) = [10]>\nshow\ngo to [front v] layer\nforever\n    if <touching (player v)?> then\n        say [A customer! Be careful down there, buy some of my health potions before you go!] for (1.5) seconds\n        say [ \[press space to buy healing potions, $6\]] for (1) seconds\n    end\nend\n\nwhen flag clicked\nhide\nwait until <(Level) = [10]>\nshow\ngo to [front v] layer\nforever\n    if <not <touching (player v)?>> then\n        say []\n    end\n    if <<touching (player v)?> and <<(Coins) > [5]> and <key (space v) pressed?>>> then\n        set [mage health v] to [1000]\n        set [warrior health v] to [1300]\n        set [archer health v] to [1000]\n        stop [other scripts in sprite v]\n        change [coins v] by (-6)\n        say [Thanks, good luck!]\n    end\n    if <(Level) = [11]> then\n        hide\n    end\nend\n\n@LuckyLMJ's Health Bar\n\ndefine Draw health bar with a length of ( length ) and a thickness of (thickness) at XY (x) (y) max (max) current (current)\ngo to x: ((x) - (( length ) / (2))) y: (y)\nset pen size to ((thickness) + (3))\npen down\nset pen color to (#000000)\nchange x by ( length )\npen up\ngo to x: ((x) - (( length ) / (2))) y: (y)\nset pen size to (thickness)\npen down\nif <((current) / (max)) < [.2]> then\n    set pen color to (#e81818)\n    set pen shade to (50)\n    change pen shade by (((current) / (max)) * (25))\nelse\n    if <((current) / (max)) < [.5]> then\n        set pen color to (#ee7d16)\n        set pen shade to (50)\n        change pen shade by (((current) / (max)) * (20))\n    else\n        if <((current) / (max)) < [.7]> then\n            set pen color to (#e1a91a)\n            set pen shade to (50)\n            change pen shade by (((current) / (max)) * (15))\n        else\n            set pen shade to (30)\n            set pen color to (#0e9a6c)\n            change pen shade by (((current) / (max)) * (10))\n        end\n    end\nend\nchange x by (((current) / (max)) * ( length ))\npen up\n\ngo to x: ((x) - ((size) / (45))) y: ((y) - ((size) / (45)))\n\ngo to x: ((x) - ((size) / (45))) y: ((y) - ((size) / (45)))\n\nwhen I receive [_battle v]\nif <(_enemy) = [boss]> then\n    forever\n        erase all\n        Draw health bar with a length of (100) and a thickness of (10) at XY (40) (135) max (2600) current (M2 Health)\n    end\nend\n\nwhen flag clicked\nerase all\n\n@tb\n\nwhen flag clicked\nhide\nswitch costume to (costume1 v)\nwait until <<(M2 Health) = [0]> and <(_enemy) = [boss]>>\nwait (1) seconds\ngo to [front v] layer\nshow\nstop [all v]\n\n