PDA

View Full Version : HitTest not working well


RDG
05-23-2007, 09:43 PM
Hi, I've been doing RPG games for a while now and have had the same problem in all of them. When the user comes to a corner he slowly passes through it. The code I'm using is this:

onClipEvent (enterFrame) {
if (hitTest(_root.user)) {
_root.bg1._x += 5;
}
}

(This is the code for a right wall).

Where 'bg1' is the background. When the user presses the key RIGHT the player faces to the right and "walks", and the background moves to the left.

Also, I don't like the fact that he bounces off the wall. Any help will be appreciated.

Thanks