# hitTest with lines

**URL:** https://forum.kirupa.com/t/hittest-with-lines/300075
**Category:** Uncategorized
**Created:** [November 16, 2009, 12:05am UTC](https://forum.kirupa.com/t/hittest-with-lines/300075 "2009-11-16T00:05:03Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Gareth](https://avatars.discourse-cdn.com/v4/letter/g/ba8739/32.png) [@Gareth](https://forum.kirupa.com/u/Gareth)
#### Post date: [November 16, 2009, 12:05am UTC](https://forum.kirupa.com/t/hittest-with-lines/300075/1 "2009-11-16T00:05:03Z")

</div>

hi there!  
I’m making a video game and there are some walls, which are in fact lines drawn with wall.moveTo() and wall.lineTo()

this is what I have: (simplified)

```auto

_root.createEmptyMovieClip("wall", 1);
wall.onEnterFrame = function() {
	wall.lineStyle(1, 0xFFFFFF, 100);
	wall.moveTo(variablex, variablex);
	wall.lineTo(variablex2, variabley2);
};

```

this works fine, but…

I also have a player MC, and I want to detect collision between my player and those lines  
my idea: (player’s code)

```auto

	if(this.hitTest(_root.wall._x,_root.wall._y,true)){
		trace("asd");
	}

```

but for some reason this doesn’t work

can you help me please?  
thanks in advance
