# HitTest don't work

**URL:** <https://forum.kirupa.com/t/hittest-dont-work/223164>\
**Category:** programming\
**Created:** [April 19, 2007, 11:57pm UTC](https://forum.kirupa.com/t/hittest-dont-work/223164 "2007-04-19T23:57:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![falkflyer](https://avatars.discourse-cdn.com/v4/letter/f/e495f1/32.png) [@falkflyer](https://forum.kirupa.com/u/falkflyer)\
**Post date:** [April 19, 2007, 11:57pm UTC](https://forum.kirupa.com/t/hittest-dont-work/223164/1 "2007-04-19T23:57:54Z")

</div>

Okay, I’m trying to make my first game, however the enemies only die some of the time. It’s weird though, because the main laser always works, but the turret fire only works once in a while. The file’s really messy, so I’ve uploaded both the .fla and the .swf. If you have any questions I’ll try to answer them.  
fla: [http://www.xcvtech.com/school/view/A9-TurboDefender.fla](http://www.xcvtech.com/school/view/A9-TurboDefender.fla)  
swf: [http://www.xcvtech.com/school/view/A9-TurboDefender.swf](http://www.xcvtech.com/school/view/A9-TurboDefender.swf)

shift shoots turret, space is laser(wait for it to recharge).  
wasd control (w up, a left, s down, d right)  
mouse up/down aims turret

```php
onEnterFrame = function () {
 _x -= 8;
 if (_x<0) {
  this.removeMovieClip();
  _root.spawn.spawn1.ships1--;
 }
 if (_root.ship.bigLaser.hitTest(_x, _y)) {
  this.hul -= 50;
 }
 for (i=1; i<_root.missile.laserCounter; i++) {
  if (_root["laser"+i].hitTest(this)) {
   this.hul -= 25;
   _root["laser"+i].removeMovieClip();
  }
 }
 if (this.hul<=0) {
  this.gotoAndPlay(10);
 }
 myHull = this.hul;
};

```

Enemie’s main code
