# Basic flash game enemy meteor lives problem

**URL:** <https://forum.kirupa.com/t/basic-flash-game-enemy-meteor-lives-problem/286328>\
**Category:** Uncategorized\
**Created:** [April 13, 2009, 10:21pm UTC](https://forum.kirupa.com/t/basic-flash-game-enemy-meteor-lives-problem/286328 "2009-04-13T22:21:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frey](https://avatars.discourse-cdn.com/v4/letter/f/aeb1de/32.png) [@Frey](https://forum.kirupa.com/u/Frey)\
**Post date:** [April 13, 2009, 10:21pm UTC](https://forum.kirupa.com/t/basic-flash-game-enemy-meteor-lives-problem/286328/1 "2009-04-13T22:21:41Z")

</div>

Hi guys.

I have a problem regarding the lives in my game. Basically at the moment I have my game with my character which you move along the screen (well the background moves) and meteors fall from the sky through tweens. What I want to happen is when the character gets hit by a meteor he loses a life. Currently when he gets hit for every milisecond the meteor is touching him the ‘lives’ scorevalue decreases so it’s as if the number goes from 3 to -7, -7 to -12, as he gets hit. I get what it’s doing but I want it so for every time he gets hit he only loses one life, so it’ll only decrease by one. Here is my current code for when he gets hit:

```auto

var gameLives:Number = 3;
livesDisplay_txt.text="3";

function cometCollision(evt:Event):void{
    if(characterBoy_mc.hitTestObject(comet_mc)){
        livesDisplay_txt.text=String(gameLives);
        gameLives--;
    }        
}

stage.addEventListener(Event.ENTER_FRAME, cometCollision);

```
