Treasure Quest -A Platformer-

Instructions: Please ❤️ and⭐!\n---\n⬇️ PLEASE READ (Scroll down too) ⬇️\nTaking too long to load? Use turbowarp: https://turbowarp.org/413072152\nAlso fullscreen can break things, please don't use it.\nSupported controls: Arrow Keys and WASD, plus Space, Z, or X to jump/select. Enter, Backspace, and Esc are also available menu inputs on turbowarp.org.\n\nMobile is now supported! I had to settle with an onscreen circle pad, which isn't the greatest but it works for the most part. I'd still recommend using a keyboard for the best experience though.\n\nLeft/Right + P to skip backwards/forwards a level, Up/Down + P to restart a level (works when stopped!)\nHold a number (1-6) and hit "start" to world warp\n---\nPlease ❤️ and⭐!

@Stage\n\nwhen flag clicked\nswitch backdrop to (1 v)\n\nwhen I receive [game start v]\nswitch backdrop to (2 v)\n\nwhen backdrop switches to [5 v]\nstop [other scripts in sprite v]\nforever\n    set [items v] to [2]\nend\n\nwhen backdrop switches to [3 v]\nstop [other scripts in sprite v]\nforever\n    set [items v] to [1]\nend\n\n@Player\n\ndefine engine\nswitch costume to (hitbox v)\nif <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n    set [costumes v] to [2]\n    point in direction (90)\n    change [xv v] by (1)\nend\nif <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n    set [costumes v] to [3]\n    point in direction (-90)\n    change [xv v] by (-1)\nend\nif <touching (rock v)?> then\n    set [xv v] to [0]\n    change [xv v] by (-0.4)\nend\nset [xv v] to ((XV) * (0.9))\nchange x by (XV)\nif <touching (level v)?> then\n    change y by (1)\n    if <touching (level v)?> then\n        change y by (1)\n        if <touching (level v)?> then\n            change y by (1)\n            if <touching (level v)?> then\n                change y by (1)\n            end\n        end\n    end\nend\nif <touching (level v)?> then\n    change x by ((XV) * (-1))\n    change y by (-4)\n    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        if <(XV) > [0]> then\n            set [xv v] to [-5]\n        else\n            set [xv v] to [5]\n        end\n        set [yv v] to [15]\n    else\n        set [yv v] to [0]\n    end\nend\nchange [yv v] by (-1)\nchange y by (YV)\nif <touching (level v)?> then\n    change y by ((YV) * (-1))\n    set [yv v] to [0]\nend\nchange y by (-1)\nif <touching (level v)?> then\n    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        set [yv v] to [15]\n    end\nend\nchange y by (1)\nswitch costume to (costumes)\n\nwhen flag clicked\nforever\n    if <<touching (saw  v)?> or <touching (bullet v)?>> then\n        go to x: (-201) y: (-106)\n    end\nend\n\nwhen flag clicked\nbroadcast (Main Menu v)\n\nwhen I receive [main menu v]\nhide\n\nwhen I receive [game start v]\nforever\n    if <touching (exit v)?> then\n        next backdrop\n        go to x: (-201) y: (-106)\n    end\nend\n\nwhen I receive [game start v]\nforever\n    if <touching (spikes v)?> then\n        go to x: (-201) y: (-106)\n    end\nend\n\nwhen I receive [game start v]\nstart sound [Connect v]\nswitch backdrop to (backdrop1 \(1\) v)\nswitch costume to (normal v)\nshow\ngo to x: (-201) y: (0)\nset size to (50) %\nset [level v] to [1]\nset [xv v] to [0]\nset [yv v] to [0]\nforever\n    engine\nend\n\nwhen I receive [game start v]\nforever\n    if <touching (lava v)?> then\n        go to x: (-201) y: (-106)\n    end\nend\n\nwhen I receive [game start v]\nforever\n    if <touching (enemy v)?> then\n        go to x: (-201) y: (-106)\n    end\nend\n\nwhen I receive [game start v]\nforever\n    if <touching (trampoline v)?> then\n        set [yv v] to [20]\n    end\nend\n\nwhen flag clicked\nset volume to (100) %\nforever\n    if <touching (exit v)?> then\n        next backdrop\n        go to x: (-201) y: (-35)\n    end\nend\n\nwhen I receive [game start v]\nforever\n    if <key (5 v) pressed?> then\n        wait (0.1) seconds\n        next backdrop\n        go to x: (-201) y: (0)\n    end\nend\n\nwhen flag clicked\nstart sound [Tobu & Itro - Sunburst v]\n\nwhen I receive [boss v]\nrepeat (50)\n    change volume by (-2)\nend\ngo to x: (-190) y: (-70)\n\nwhen backdrop switches to [10 v]\nbroadcast (boss v)\n\nwhen I receive [fight! v]\nforever\n    if <touching (boss v)?> then\n        go to x: (-201) y: (-35)\n        broadcast (reset v)\n    end\nend\n\n@Level\n\nwhen flag clicked\ngo to x: (7) y: (-25)\nswitch costume to (1 v)\n\nwhen I receive [main menu v]\nhide\n\nwhen I receive [game start v]\nshow\n\nwhen backdrop switches to [2 v]\nswitch costume to (1 v)\n\nwhen backdrop switches to [3 v]\nswitch costume to (2 v)\n\nwhen backdrop switches to [4 v]\nswitch costume to (3 v)\n\nwhen backdrop switches to [5 v]\nswitch costume to (4 v)\n\nwhen backdrop switches to [6 v]\nswitch costume to (5 v)\n\nwhen backdrop switches to [7 v]\nswitch costume to (6 v)\n\nwhen backdrop switches to [8 v]\nswitch costume to (7 v)\n\nwhen backdrop switches to [9 v]\nswitch costume to (8 v)\n\nwhen backdrop switches to [10 v]\nswitch costume to (9 v)\n\nwhen backdrop switches to [11 v]\nswitch costume to (10 v)\n\nwhen backdrop switches to [12 v]\nswitch costume to (11 v)\n\nwhen backdrop switches to [13 v]\nswitch costume to (12 v)\n\nwhen backdrop switches to [14 v]\nswitch costume to (13 v)\n\nwhen I receive [fight! v]\nswitch costume to (9-2 v)\n\n@Spikes\n\nwhen flag clicked\nhide\n\nwhen I receive [game start v]\nhide\n\nwhen I receive [instructions v]\nhide\n\nwhen I receive [main menu v]\nhide\n\nwhen backdrop switches to [2 v]\nhide\n\nwhen backdrop switches to [3 v]\nshow\nswitch costume to (1 v)\n\nwhen backdrop switches to [4 v]\nshow\nswitch costume to (2 v)\n\nwhen backdrop switches to [5 v]\nhide\n\nwhen backdrop switches to [6 v]\nshow\nswitch costume to (3 v)\n\nwhen backdrop switches to [7 v]\nswitch costume to (4 v)\n\nwhen backdrop switches to [8 v]\nhide\n\nwhen backdrop switches to [9 v]\nhide\n\nwhen backdrop switches to [10 v]\nbroadcast (boss v)\nswitch costume to (5 v)\n\nwhen backdrop switches to [12 v]\nshow\nswitch costume to (3 v)\n\nwhen backdrop switches to [13 v]\nhide\n\nshow\nswitch costume to (3 v)\n\n@Enemy\n\nwhen flag clicked\npoint in direction (90)\nset size to (100) %\nhide\n\nwhen backdrop switches to [2 v]\nhide\n\nwhen I receive [game start v]\nhide\n\nwhen I receive [instructions v]\nhide\n\nwhen I receive [main menu v]\nhide\n\nwhen backdrop switches to [5 v]\nshow\ngo to x: (208) y: (80)\nrepeat until <(backdrop [number v]) = [6]>\n    point in direction (-75)\n    repeat (10)\n        change x by (-10)\n    end\n    wait (0.25) seconds\n    point in direction (60)\n    repeat (10)\n        change x by (10)\n    end\n    wait (0.25) seconds\nend\n\nwhen backdrop switches to [4 v]\nswitch costume to (1 v)\nshow\ngo to x: (140) y: (-112)\npoint in direction (-90)\n\nwhen I start as a clone\nswitch costume to (pick random (1) to (2))\ngo to x: (170) y: (-80)\nif <(backdrop [number v]) = [7]> then\n    wait (pick random (0) to (0.3)) seconds\n    repeat until <(backdrop [number v]) = [8]>\n        glide (1) secs to x: (80) y: (-80)\n        point in direction (90)\n        glide (1) secs to x: (170) y: (-80)\n        point in direction (-90)\n    end\n    delete this clone\nelse\n    go to x: (-32) y: (-93)\nend\n\nwhen backdrop switches to [12 v]\nhide\n\nwhen flag clicked\nforever\n    if <<touching (pick v)?> and <([costume name v] of [pick v]) = [sword ]>> then\n        hide\n        broadcast (enemy dead v)\n        if <(backdrop [number v]) = [6]> then\n            stop [other scripts in sprite v]\n        end\n    end\nend\n\nwhen backdrop switches to [6 v]\nrepeat until <(backdrop [number v]) = [7]>\n    show\n    switch costume to (costume2 v)\n    point in direction (-90)\n    go to x: (200) y: (30)\nend\n\nwhen backdrop switches to [7 v]\nshow\nswitch costume to (costume2 v)\ngo to x: (0) y: (90)\ncreate clone of (_myself_ v)\nwait (1) seconds\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nforever\n    if <<touching (pick v)?> and <([costume name v] of [pick v]) = [sword ]>> then\n        delete this clone\n    end\nend\n\nwhen backdrop switches to [8 v]\nrepeat until <(backdrop [number v]) = [9]>\n    hide\nend\n\n@Trampoline\n\nwhen flag clicked\nshow\n\nwhen flag clicked\nswitch costume to (1 v)\nforever\n    if <touching (player v)?> then\n        play sound [Big Boing v] until done\n    end\nend\n\nwhen I receive [game start v]\nhide\n\nwhen backdrop switches to [2 v]\nhide\n\nwhen I receive [main menu v]\nhide\n\nwhen I receive [instructions v]\nhide\n\nwhen backdrop switches to [5 v]\nhide\n\nwhen backdrop switches to [6 v]\ngo to x: (-69) y: (-128)\n\nwhen backdrop switches to [7 v]\nshow\nswitch costume to (2 v)\ngo to x: (0) y: (-150)\n\nwhen backdrop switches to [8 v]\nswitch costume to (1 v)\nhide\n\nwhen backdrop switches to [11 v]\nhide\ngo to x: (-78) y: (-127)\n\nwhen backdrop switches to [12 v]\nhide\n\nwhen backdrop switches to [10 v]\nshow\ngo to x: (21) y: (-120)\n\n@Main Menu\n\nwhen I receive [main menu v]\nswitch costume to (1 v)\nshow\n\nwhen flag clicked\nhide\n\nwhen I receive [game start v]\nhide\n\nwhen I receive [instructions v]\nswitch costume to (2 v)\n\nwhen I receive [story v]\nhide\n\n@Play Button\n\nwhen flag clicked\nshow\ngo to [front v] layer\n\nwhen I receive [game start v]\nhide\n\nwhen I receive [instructions v]\nhide\n\nwhen I receive [main menu v]\nshow\n\nwhen flag clicked\nshow\ngo to [front v] layer\ngo to x: (37) y: (22)\nforever\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (15)\n        if <mouse down?> then\n            broadcast (story v)\n        end\n    else\n        clear graphic effects\n    end\nend\n\nwhen I receive [story v]\ngo to x: (999) y: (999)\nhide\n\n@Instructions Button\n\nwhen flag clicked\ngo to x: (38) y: (-61)\nshow\ngo to [front v] layer\nforever\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (15)\n    else\n        clear graphic effects\n    end\n    if <<mouse down?> and <touching (mouse-pointer v)?>> then\n        broadcast (Instructions v)\n    end\nend\n\nwhen I receive [game start v]\nhide\n\nwhen I receive [instructions v]\nhide\n\nwhen I receive [main menu v]\nshow\n\nwhen I receive [story v]\nhide\ngo to x: (999) y: (999)\n\n@Back\n\nwhen flag clicked\ngo to x: (23) y: (-150)\nhide\nforever\n    if <touching (mouse-pointer v)?> then\n        set [brightness v] effect to (15)\n    else\n        clear graphic effects\n    end\n    if <<touching (mouse-pointer v)?> and <mouse down?>> then\n        broadcast (Main Menu v)\n    end\nend\n\nwhen I receive [instructions v]\nshow\ngo to [front v] layer\n\nwhen I receive [game start v]\nhide\n\nwhen I receive [main menu v]\nhide\n\nwhen I receive [story v]\ngo to x: (999) y: (999)\nhide\n\n@Exit\n\nwhen backdrop switches to [3 v]\nhide\nwait until <(item) = [p]>\nshow\n\nwhen I receive [game start v]\nshow\n\nwhen backdrop switches to [5 v]\nhide\nwait until <(item) = [s]>\nshow\n\nwhen I receive [game start v]\nstop all sounds\nforever\n    play sound [Unlimited v] until done\nend\n\nwhen backdrop switches to [10 v]\nhide\n\nwhen I receive [bossdead v]\nshow\n\nwhen I receive [boss v]\nstop [other scripts in sprite v]\nwait (1) seconds\nrepeat (50)\n    change volume by (2)\nend\nforever\n    play sound [Heartache.mp3 v] until done\nend\n\nwhen I receive [bossdead v]\nstop [other scripts in sprite v]\nwait (1) seconds\nforever\n    play sound [Unlimited v] until done\nend\n\nwhen backdrop switches to [12 v]\nhide\nwait until <color (#000000) is touching (#8644b3)?>\nshow\n\nwhen backdrop switches to [13 v]\nhide\n\n@Coin\n\nwhen flag clicked\nhide\n\nwhen flag clicked\nforever\n    if <touching (player v)?> then\n        start sound [Coin v]\n        hide\n    end\nend\n\nwhen backdrop switches to [3 v]\nswitch costume to (1 v)\nshow\ngo to x: (156) y: (-68)\n\nwhen backdrop switches to [4 v]\nswitch costume to (costume1 v)\nshow\ngo to x: (137) y: (79)\n\nwhen backdrop switches to [5 v]\nshow\nswitch costume to (1 v)\ngo to x: (120) y: (-70)\n\nwhen backdrop switches to [6 v]\nshow\ngo to x: (216) y: (29)\n\nwhen backdrop switches to [7 v]\nshow\ngo to x: (14) y: (26)\n\nwhen backdrop switches to [8 v]\nshow\ngo to x: (160) y: (0)\nrepeat (10)\n    create clone of (_myself_ v)\nend\n\nwhen backdrop switches to [9 v]\nhide\n\nwhen backdrop switches to [11 v]\nshow\ngo to x: (0) y: (-90)\n\nwhen backdrop switches to [12 v]\nhide\n\nwhen backdrop switches to [6 v]\nshow\nswitch costume to (1 v)\ngo to x: (140) y: (29)\n\nwhen backdrop switches to [7 v]\nshow\nswitch costume to (costume1 v)\ngo to x: (55) y: (80)\n\nwhen I start as a clone\nshow\nif <(backdrop [number v]) = [11]> then\n    switch costume to (1 v)\n    go to x: (pick random (101) to (158)) y: (pick random (-111) to (-94))\nelse\n    switch costume to (pick random (1) to (10))\n    go to x: (pick random (160) to (240)) y: (pick random (50) to (-25))\nend\nforever\n    if <touching (player v)?> then\n        start sound [Coin v]\n        delete this clone\n    end\nend\n\nwhen I receive [money v]\nrepeat (10)\n    create clone of (_myself_ v)\nend\n\n@TB\n\nwhen flag clicked\ngo to [front v] layer\nhide\n\n@bullet\n\nwhen flag clicked\nhide\n\nwhen backdrop switches to [6 v]\ngo to x: (96) y: (28)\nswitch costume to (costume1 v)\nshow\nrepeat until <(backdrop [number v]) = [7]>\n    go to (enemy v)\n    show\n    repeat until <<touching (player v)?> or <touching (_edge_ v)?>>\n        change x by (-10)\n    end\n    hide\n    wait (0.2) seconds\nend\n\nwhen backdrop switches to [7 v]\nstop [other scripts in sprite v]\nswitch costume to (costume1 v)\nshow\nrepeat until <(backdrop [number v]) = [8]>\n    go to (enemy v)\n    show\n    repeat until <<touching (player v)?> or <touching (_edge_ v)?>>\n        change x by (-10)\n    end\n    wait (0) seconds\n    hide\n    wait (0.2) seconds\nend\n\nwhen I receive [enemy dead v]\nstop [other scripts in sprite v]\nhide\n\n@pick\n\nwhen flag clicked\nset [item v] to [0]\nset [items v] to [0]\nhide\nforever\n    if <<key (s v) pressed?> or <key (down arrow v) pressed?>> then\n        if <(item) = [p]> then\n            switch costume to (pickaxe7 v)\n            wait (0.2) seconds\n            switch costume to (pickaxe2 v)\n            wait (0.2) seconds\n            switch costume to (pickaxe7 v)\n        end\n        if <(item) = [s]> then\n            switch costume to (sword v)\n            wait (0.2) seconds\n            switch costume to (sword  v)\n            wait (0.2) seconds\n            switch costume to (sword v)\n        end\n    end\nend\n\nwhen backdrop switches to [3 v]\npoint in direction (90)\nswitch costume to (pickaxe7 v)\nshow\ngo to x: (80) y: (-71)\nwait until <touching (player v)?>\nstart sound [Collect v]\nset [items v] to [1]\nset [item v] to [p]\nforever\n    go to (player v)\n    point in direction ([direction v] of [player v])\nend\n\nwhen [space v] key pressed\nif <(item) = [p]> then\n    if <(items) = [2]> then\n        switch costume to (sword v)\n        set [item v] to [s]\n    end\nelse\n    switch costume to (pickaxe7 v)\n    set [item v] to [p]\nend\n\n@rock\n\nwhen flag clicked\ngo to [back v] layer\nhide\ngo to x: (0) y: (0)\n\nwhen backdrop switches to [5 v]\nswitch costume to (costume1 v)\nshow\nforever\n    if <<touching (pick v)?> and <([costume name v] of [pick v]) = [Pickaxe2]>> then\n        wait (3) seconds\n        hide\n    end\nend\n\nwhen backdrop switches to [6 v]\nswitch costume to (costume2 v)\nshow\nforever\n    if <<touching (pick v)?> and <([costume name v] of [pick v]) = [Pickaxe2]>> then\n        wait (3) seconds\n        hide\n    end\nend\n\nwhen backdrop switches to [8 v]\nstop [other scripts in sprite v]\nswitch costume to (costume3 v)\nshow\nforever\n    if <<touching (pick v)?> and <([costume name v] of [pick v]) = [Pickaxe2]>> then\n        wait (3) seconds\n        hide\n        stop [this script v]\n    end\nend\n\nwhen backdrop switches to [9 v]\nswitch costume to (costume2 v)\ngo to x: (-308) y: (15)\nrepeat (5)\n    change x by (70)\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nshow\nforever\n    if <<touching (pick v)?> and <([costume name v] of [pick v]) = [Pickaxe2]>> then\n        wait (2) seconds\n        hide\n    end\nend\n\n@story\n\nwhen flag clicked\nhide\n\nwhen I receive [game start v]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [story v]\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\ngo to [front v] layer\nclear graphic effects\nshow\nforever\n    if <mouse down?> then\n        if <(costume [number v]) = [7]> then\n            broadcast (Game Start v)\n        else\n            next costume\n        end\n        wait until <not <mouse down?>>\n    end\n    if <key (x v) pressed?> then\n        switch costume to (costume7 v)\n        wait until <not <key (x v) pressed?>>\n    end\nend\n\n@item\n\nwhen backdrop switches to [5 v]\nshow\nwait until <touching (player v)?>\nstart sound [Collect v]\nset [item v] to [s]\nhide\n\nwhen flag clicked\nhide\n\n@BOSS\n\ndefine Say (speech) Beats (beats) Note (note) Clear? (clear?) Wait after (wait after) Instrument (instrument)\nif <(clear?) = [y]> then\n    delete all of [speech v]\nend\nset [speech letter v] to [0]\nrepeat (length of (speech))\n    change [speech letter v] by (1)\n    add (letter (speech letter) of (speech)) to [speech v]\n    say (Speech)\nend\nadd [ ] to [speech v]\nwait (wait after) seconds\nsay []\n\ndefine Game\npoint towards (player v)\nchange [yv v] by (-1)\nPosition\nchange [xv v] by (pick random (2) to (-2))\nif <(limit) < [5]> then\n    if <(xv) > [-7]> then\n        if <([abs v] of (([x v] of [player v]) - (x)) ) > [20]> then\n            if <([x v] of [player v]) < (x)> then\n                change [xv v] by (-1)\n            else\n                change [xv v] by (1)\n            end\n        end\n    end\nend\nif <<(round (x)) = (round (data x))> and <(round (y)) = (round (data y))>> then\n    change [limit v] by (1)\nelse\n    set [limit v] to [0]\n    set [data x v] to (round (x))\n    set [data y v] to (round (y))\nend\nif <(limit) > [5]> then\n    change [y v] by (-2)\n    Position\n    if <touching (level v)?> then\n        repeat until <not <touching (level v)?>>\n            change [y v] by (-2)\n            change [xv v] by (-10)\n            set [xv v] to ((xv) * (0.9))\n            change [y v] by (2)\n            change x by (xv)\n            Position\n        end\n    end\nend\nif <(limit) < [5]> then\n    set [xv v] to ((xv) * (0.9))\nend\nchange x by (xv)\nchange [y v] by (-2)\nPosition\nif <<touching (level v)?> and <(y) < ([y v] of [player v])>> then\n    set [yv v] to [7]\nend\nchange [y v] by (2)\nPosition\nchange y by (yv)\n\ndefine change x by (xv)\nchange [x v] by (xv)\nPosition\nif <touching (level v)?> then\n    repeat (12)\n        change [y v] by (1)\n        Position\n        if <not <touching (level v)?>> then\n            stop [this script v]\n        end\n    end\n    change [y v] by (-12)\n    set [yv v] to [12]\n    Position\n    if <touching (level v)?> then\n        repeat until <not <touching (level v)?>>\n            if <(xv) > [0]> then\n                change [x v] by (-1)\n            else\n                change [x v] by (1)\n            end\n            Position\n        end\n        set [xv v] to [0]\n    end\nend\n\ndefine change y by (yv)\nchange [y v] by (yv)\nPosition\nif <touching (level v)?> then\n    repeat until <not <touching (level v)?>>\n        if <(yv) > [0]> then\n            change [y v] by (-1)\n        else\n            change [y v] by (1)\n        end\n        Position\n    end\n    set [yv v] to [0]\nend\n\ndefine Position\ngo to x: (x) y: (y)\n\nwhen I receive [tick v]\nGame\n\nwhen I receive [reset v]\nReset\n\ndefine Reset\nset [hp v] to [3]\nset [x v] to [220]\nset [y v] to [-30]\nset [xv v] to [0]\nset [yv v] to [0]\nset [limit v] to [0]\nshow\n\nwhen I receive [boss v]\npoint in direction (-90)\ngo to x: (220) y: (-96)\nset [x v] to [220]\nset [y v] to [-30]\nshow\nSay [HA HA HA! You fell for my trap!] Beats [] Note [] Clear? [y] Wait after [2] Instrument []\nSay [You're that new prisoner, aren't you?] Beats [] Note [] Clear? [y] Wait after [2] Instrument []\nSay [Okay, you got this far, so i'll make a deal.] Beats [] Note [] Clear? [y] Wait after [2] Instrument []\nSay [If you beat me, I will let you be free!] Beats [] Note [] Clear? [y] Wait after [2] Instrument []\nshow variable [hp v]\nwait (1) seconds\nbroadcast (fight! v)\nforever\n    broadcast (Tick v)\nend\n\nwhen flag clicked\nhide variable [hp v]\nhide\nset [hp v] to [3]\nforever\n    if <(HP) < [1]> then\n        stop [other scripts in sprite v]\n        play sound [Win v] until done\n        broadcast (bossdead v)\n    end\nend\n\nwhen I receive [bossdead v]\nstop [other scripts in sprite v]\nhide variable [hp v]\nhide\n\nwhen I receive [fight! v]\nforever\n    if <<touching (pick v)?> and <([costume name v] of [pick v]) = [sword ]>> then\n        change [hp v] by (-1)\n        wait (1) seconds\n    end\nend\n\nset [hp v] to [0]\n\n@chest\n\nwhen flag clicked\nhide\ngo to [back v] layer\n\nwhen I receive [bossdead v]\nwait until <(backdrop [number v]) = [11]>\nswitch costume to (closed v)\nshow\nforever\n    if <<touching (pick v)?> and <([costume name v] of [pick v]) = [Pickaxe2]>> then\n        wait (1.2) seconds\n        switch costume to (open v)\n        broadcast (money v)\n        stop [this script v]\n    end\nend\n\nwhen backdrop switches to [12 v]\nhide\n\n@extra\n\nwhen flag clicked\nhide\ngo to x: (71) y: (-20)\n\nwhen backdrop switches to [12 v]\nshow\nwait until <touching (player v)?>\nstart sound [Collect v]\nforever\n    go to (player v)\n    point in direction ([direction v] of [player v])\nend\n\n