# Game Firing problem with key.isDown

**URL:** <https://forum.kirupa.com/t/game-firing-problem-with-key-isdown/100647>\
**Category:** Uncategorized\
**Created:** [January 31, 2004, 11:38pm UTC](https://forum.kirupa.com/t/game-firing-problem-with-key-isdown/100647 "2004-01-31T23:38:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Haxorleet](https://avatars.discourse-cdn.com/v4/letter/h/8491ac/32.png) [@Haxorleet](https://forum.kirupa.com/u/Haxorleet)\
**Post date:** [January 31, 2004, 11:38pm UTC](https://forum.kirupa.com/t/game-firing-problem-with-key-isdown/100647/1 "2004-01-31T23:38:05Z")

</div>

I looked at the [tutorial on how to fire in a game](http://www.kirupa.com/developer/mx/fire.htm) , and tried to replace the clicking the button to hitting the Z button, so it looks like this

This is the code on pressing the key:  
[AS]onEnterFrame = function(){  
if (Key.isDown(90)){  
\_root.fire = 1;  
\_root.i += .1;  
duplicateMovieClip(\_root.bullet, “bullet”+i, i);  
}

}[/AS]

And this is the code on the bullet:  
[AS]onClipEvent (load) {  
this.\_visible = 0;  
if (\_root.fire == 1) {  
this.\_x = \_root.player.\_x;  
this.\_y = \_root.player.\_y;  
}  
}  
onClipEvent (enterFrame) {  
if (this != \_level0.bullet) {  
if (\_root.fire == 1) {  
this.\_y -= 10;  
this.\_visible = 1;  
}  
if (this.\_y\<0) {  
this.removeMovieClip();  
}  
}[/AS]  
…basically the same except replacing “crab” with “player”…

Now the problem is, when i release the key an extra bullet fires off, and then when i press Z again,that bullet dissappears in mid-air every other time, so is there a way to get that last bullet to just not fire off and be removed?
