# What is wrong with my hitTest code?

**URL:** <https://forum.kirupa.com/t/what-is-wrong-with-my-hittest-code/150866>\
**Category:** flash\
**Created:** [June 11, 2005, 3:41am UTC](https://forum.kirupa.com/t/what-is-wrong-with-my-hittest-code/150866 "2005-06-11T03:41:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nathan99](https://avatars.discourse-cdn.com/v4/letter/n/96bed5/32.png) [@nathan99](https://forum.kirupa.com/u/nathan99)\
**Post date:** [June 11, 2005, 3:41am UTC](https://forum.kirupa.com/t/what-is-wrong-with-my-hittest-code/150866/1 "2005-06-11T03:41:58Z")

</div>

hey guys, i have this code on my wall for the hitTest with a car… However it doesnt work unless it is on my car mc. It works fine on the car mc, though it need to be on the wall.

Its got me stumped good. Any ideas?

```auto
onClipEvent (enterFrame) {
_root.speed *= .98;
x = Math.sin(_root.car._rotation*(Math.PI/180))*_root.speed;
y = Math.cos(_root.car._rotation*(Math.PI/180))*_root.speed*-1;
**if (!_root.car.hitTest(_x+x, _y+y, true)) {**
_x += x*-1;
_y += y*-1;
} else {
_root.speed *= -.6;
}
}

```
