# Health System,

**URL:** https://forum.kirupa.com/t/health-system/184042
**Category:** programming
**Created:** [April 1, 2006, 8:47am UTC](https://forum.kirupa.com/t/health-system/184042 "2006-04-01T08:47:02Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ricer](https://avatars.discourse-cdn.com/v4/letter/r/e47774/32.png) [@ricer](https://forum.kirupa.com/u/ricer)
#### Post date: [April 1, 2006, 8:47am UTC](https://forum.kirupa.com/t/health-system/184042/1 "2006-04-01T08:47:02Z")

</div>

heya i made a health system, but i got 1 small question

how can u let the “moving\_mc” die when hp = 0 ?

i made a dynamic box for the health,

in my frame i putted:

```auto
 health = 100; 

```

and in my monster :

```auto
 if (_root.moving_mc.hitTest(this)) {
        _root.health -= 2;

```

---

<div class="post-metadata">

### Author: ![B\_L\_U\_E](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@B\_L\_U\_E](https://forum.kirupa.com/u/B_L_U_E)
#### Post date: [April 1, 2006, 9:19am UTC](https://forum.kirupa.com/t/health-system/184042/2 "2006-04-01T09:19:04Z")

</div>

Within the hitTest, check to see if you have sufficient health.[AS] if (\_root.moving\_mc.hitTest(this)) {  
\_root.health\>0 ? \_root.health -= 2 : trace(“You died!”);  
}[/AS]

---

<div class="post-metadata">

### Author: ![ricer](https://avatars.discourse-cdn.com/v4/letter/r/e47774/32.png) [@ricer](https://forum.kirupa.com/u/ricer)
#### Post date: [April 1, 2006, 12:05pm UTC](https://forum.kirupa.com/t/health-system/184042/3 "2006-04-01T12:05:25Z")

</div>

thnx man,

is there any script that makes it go to a choosen Frame name? 🙂

---

<div class="post-metadata">

### Author: ![bombsledder](https://avatars.discourse-cdn.com/v4/letter/b/958977/32.png) [@bombsledder](https://forum.kirupa.com/u/bombsledder)
#### Post date: [April 1, 2006, 1:39pm UTC](https://forum.kirupa.com/t/health-system/184042/4 "2006-04-01T13:39:02Z")

</div>

hero.gotoAndStop(/\* framename or number here\*/)

because gotoAndStop is overloaded you can put a number or you can put the frame name

---

<div class="post-metadata">

### Author: ![ricer](https://avatars.discourse-cdn.com/v4/letter/r/e47774/32.png) [@ricer](https://forum.kirupa.com/u/ricer)
#### Post date: [April 1, 2006, 2:59pm UTC](https://forum.kirupa.com/t/health-system/184042/5 "2006-04-01T14:59:18Z")

</div>

thnx but bombsledder,

that doesnt work i allready tried that ☹ thnx anyway 🙂

---

<div class="post-metadata">

### Author: ![Joppe](https://avatars.discourse-cdn.com/v4/letter/j/b38774/32.png) [@Joppe](https://forum.kirupa.com/u/Joppe)
#### Post date: [April 1, 2006, 4:01pm UTC](https://forum.kirupa.com/t/health-system/184042/6 "2006-04-01T16:01:35Z")

</div>

if (\_root.moving\_mc.hitTest(this)) {  
\_root.health\>0 ? \_root.health -= 2 :hero.gotoAndStop(/\* framename or number here\*/)  
}

you should maybe try on something you might complete 😕
