# \[Flash8\]hitTest and variable help

**URL:** <https://forum.kirupa.com/t/flash8-hittest-and-variable-help/284976>\
**Category:** Uncategorized\
**Created:** [March 25, 2009, 6:19pm UTC](https://forum.kirupa.com/t/flash8-hittest-and-variable-help/284976 "2009-03-25T18:19:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dirge](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@Dirge](https://forum.kirupa.com/u/Dirge)\
**Post date:** [March 25, 2009, 6:19pm UTC](https://forum.kirupa.com/t/flash8-hittest-and-variable-help/284976/1 "2009-03-25T18:19:39Z")

</div>

Okay, so I’m developing my first solo game.

I’ve got code so that you have 10 lives.

but while the enemy is touching you you lose them equal to the framerate.

```
onClipEvent(enterFrame){

```

if (\_root.player.hitTest(this)){  
\_root.lives --;  
}  
}

how do I make it so you can only lose one life per hit?

Also, I’ve been trying to code temporary invulnerability when the player is hurt, so they have time to recover. I have no idea how to implement this haha. Can anyone shine some light in this direction on that? I’d REALLY appreciate any help I can get, as I’m very new to all this coding business.

Here’s a demo of the game if you’d like to play it to get a feel for what I’m talking about.

[http://spamtheweb.com/ul/upload/250309/47818\_preloaderewd.php](http://spamtheweb.com/ul/upload/250309/47818_preloaderewd.php)
