Point and click engine

well so far i have this
http://raptorclaw.exofire.net/new%20engine.swf

and there are some collision problems

the player is _root.loadplayer

the walls are _root.block

the player mc is _root.loadplayer.MC

i’m not sure how to fix this problem :s

but heres the AS code for you to look at

this code is on _root.loadplayer


onClipEvent (enterFrame) {
    var a = this;
    var b = _root.block;
    if (b.hitTest(a._x, a._y, true)) {
        collide = true;
        _x -= moveX;
        _y -= moveY;
        moveX = moveY=0;
    } else {
        collide = false;
    }
    distance = Math.sqrt((posX-_x)*(posX-_x)+(posY-_y)*(posY-_y));
    if (collide && onMove) {
        this.MC.gotoAndStop("idle");
        onMove = false;
    } else if (!collide && onMove) {
        _x += moveX;
        _y += moveY;
    }
    if (distance<15) {
        this.MC.gotoAndStop("idle");
        onMove = false;
        moveX = moveY=0;
    }
}
onClipEvent (mouseDown) {
    posX = _root._xmouse;
    posY = _root._ymouse;
    angle = Math.atan2(posY-_y, posX-_x);
    moveX = Math.cos(angle)*15;
    moveY = Math.sin(angle)*15;
    if (!onMove) {
        onMove = true;
        this.MC.gotoAndPlay("walk");
    }
    if (_x>posX) {
        _xscale = -100;
    }
    if (_x<posX) {
        _xscale = 100;
    }
}


when you go into the corners and rapidly click in different directions you tend to sink into the walls

can somebody help please?