# Problems with hitTest...Need HELP!

**URL:** <https://forum.kirupa.com/t/problems-with-hittest-need-help/92177>\
**Category:** Uncategorized\
**Created:** [October 14, 2003, 6:30am UTC](https://forum.kirupa.com/t/problems-with-hittest-need-help/92177 "2003-10-14T06:30:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![knutlig](https://avatars.discourse-cdn.com/v4/letter/k/b5e925/32.png) [@knutlig](https://forum.kirupa.com/u/knutlig)\
**Post date:** [October 14, 2003, 6:30am UTC](https://forum.kirupa.com/t/problems-with-hittest-need-help/92177/1 "2003-10-14T06:30:23Z")

</div>

Problems with hitTest

go to [http://www.knut.espenish.com/speedr...tent/game.html](http://www.knut.espenish.com/speedr...tent/game.html).

My hitTest function only works on the y-axis, and i have no idea why.

Can someone please help me…

this is the code…

onClipEvent (enterFrame) {  
// \_root.speed = speed;  
if (Key.isDown(Key.UP)) {  
speed += 3;  
}  
if (Key.isDown(Key.DOWN)) {  
speed -=3;  
}  
if (Key.isDown(Key.LEFT)) {  
xSpeed = xSpeed -3;  
}  
if (Key.isDown(Key.RIGHT)) {  
xSpeed = xSpeed +3;  
}  
this.\_x = this.\_x + xSpeed;  
xSpeed = xSpeed \* 0.75;

// Hit test Function  
x = xSpeed;  
y = speed\*-1;  
if (\_root.\_root.road.hitTest(\_x+x, \_y+y, true)) {  
\_x += x;  
\_y += y;  
}  
}

Cheers

Knutlig
