# Point and click engine

**URL:** https://forum.kirupa.com/t/point-and-click-engine/297869
**Category:** Uncategorized
**Created:** [October 9, 2009, 2:32pm UTC](https://forum.kirupa.com/t/point-and-click-engine/297869 "2009-10-09T14:32:55Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![revin](https://avatars.discourse-cdn.com/v4/letter/r/919ad9/32.png) [@revin](https://forum.kirupa.com/u/revin)
#### Post date: [October 9, 2009, 2:32pm UTC](https://forum.kirupa.com/t/point-and-click-engine/297869/1 "2009-10-09T14:32:55Z")

</div>

well so far i have this  
[http://raptorclaw.exofire.net/new%20engine.swf](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

```auto

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?
