# Hit Test Problem

**URL:** <https://forum.kirupa.com/t/hit-test-problem/97416>\
**Category:** Uncategorized\
**Created:** [December 22, 2003, 4:33am UTC](https://forum.kirupa.com/t/hit-test-problem/97416 "2003-12-22T04:33:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Comglomo](https://avatars.discourse-cdn.com/v4/letter/c/e19adc/32.png) [@Comglomo](https://forum.kirupa.com/u/Comglomo)\
**Post date:** [December 22, 2003, 4:33am UTC](https://forum.kirupa.com/t/hit-test-problem/97416/1 "2003-12-22T04:33:47Z")

</div>

I have searched the foru and read the tutorial on how to do this so I tried to get my own code out of it…  
What Im doing is I have a character and he can walk around… whenever he gets to a wall I want him to stop…  
here is my code

```auto

onClipEvent (enterFrame) {
if (wall1.hitTest(getBounds(_root).xMax, _y, true)) {
				_x -= 1;
			}
			if (wall1.hitTest(getBounds(_root).xMin, _y, true)) {
				_x += 1;
			}
			if (wall1.hitTest(_x, getBounds(_root).yMax, true)) {
				_y -= 1;
			}
			if (wall1.hitTest(_x, getBounds(_root).yMin, true)) {
				_y += 1;
			}
}

```

All Help is appreciated
