# \*Another\* game problem (hitTest)

**URL:** https://forum.kirupa.com/t/another-game-problem-hittest/87522
**Category:** programming
**Created:** [April 21, 2005, 5:47pm UTC](https://forum.kirupa.com/t/another-game-problem-hittest/87522 "2005-04-21T17:47:42Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Bone](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/bone/32/1243_2.png) [@Bone](https://forum.kirupa.com/u/Bone)
#### Post date: [April 21, 2005, 5:47pm UTC](https://forum.kirupa.com/t/another-game-problem-hittest/87522/1 "2005-04-21T17:47:42Z")

</div>

Before anyone says, yes I have searched and I’ve tried various things, but to no avail.

Yes, I have another problem with my game… This time, I obviously want some sort of reaction when a projectile hits an enemy. I’ve put this bit of script on the bullet MC which removes it when it comes into contact with an enemy:

```auto
onClipEvent (enterFrame) {
    if (this.hitTest(_root.enemy)) {
        this.removeMovieClip();
    }
}

```

Now I want to know what to put on the enemy in order to make it play a certain frame when it comes into contact with one of the bullets. The problem is, i don’t know what to be testing for, as each of the bullets has a seperate instance name. This is the system by which the bullets are duplicated and named:

```auto
onClipEvent (enterFrame) {
    if (Key.isDown(key.SPACE)){
    _root.fire = 1;
    _root.i += 1;
        duplicateMovieClip(_root.bullet, "bullet" + _root.i, _root.i);
    }
}

```

What I’m thinking I need is something like :

```auto
onClipEvent (enterFrame) {
     if (this.hitTest( **** )) {
         gotoAndPlay(Whatever);
     }
 }

```

But I have no idea what to put in place of the \*'s.

Sorry for the long post. Any help appreciated.
