# hitTest help

**URL:** <https://forum.kirupa.com/t/hittest-help/305756>\
**Category:** Uncategorized\
**Created:** [March 3, 2010, 5:29am UTC](https://forum.kirupa.com/t/hittest-help/305756 "2010-03-03T05:29:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![silverneo188](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@silverneo188](https://forum.kirupa.com/u/silverneo188)\
**Post date:** [March 3, 2010, 5:29am UTC](https://forum.kirupa.com/t/hittest-help/305756/1 "2010-03-03T05:29:50Z")

</div>

okay im making a game where when you click a line is drawn in the direction you clicked. I need to use hitTest with it, how would i go about doin that? here is the stuff

This is on the main timeline, it links to the gun. “bullet” is an empty clip

```auto
 
gun.onEnterFrame = function ()
{
        var angle:Number = Math.atan2 (_root._ymouse - this._y, _root._xmouse - this._x);
        this._rotation = angle * 180 / Math.PI;
  if(isMouseDown){
   if(_root.canfire == true){
       mc = _root.attachMovie ("bullet", "bullet" + _root.getNextHighestDepth (), 
_root.getNextHighestDepth ());
                mc._x = this._x + Math.cos (angle) * (this.w - 0);
                mc._y = this._y + Math.sin (angle) * (this.w - 0);
                var maxWaver:Number = 1;
                var waver:Number = (Math.random () * maxWaver * 2 - maxWaver) * Math.PI / 180;
                mc.angle = angle + waver;
    _root.canfire = false
    _root.reloader.reload.gotoAndPlay(2);
   }
  }
}
_root.onMouseDown = function ()
{
        isMouseDown = true;
};
_root.onMouseUp = function ()
{
        isMouseDown = false;
};

```

Now here is the code on the first frame of the bullet clip

```auto

decay = 15;
this.onEnterFrame = function()
{
        if(this.angle != undefined)
        {
 
                this.disp = _root.createEmptyMovieClip(this._name+_root.getNextHighestDepth(), _root.getNextHighestDepth());
                this.disp.lineStyle(3, 0xFF0000);
 
                this.disp.moveTo(this._x, this._y);
 
                this.disp.lineTo(this._x + Math.cos(this.angle)*800, this._y+Math.sin(this.angle)*800);
                delete this.angle;
        }
        if(this.disp != undefined)
        {
                this.disp._alpha -= decay;
                if(this.disp._alpha <= 30)
                {
                        this.disp.removeMovieClip();
                        this.removeMovieClip();
                        delete this.onEnterFrame;
                }
        }
}

```

i Need to hitTest the line drawn in ^ with a clip called enemy. How would i go about doing that?
