here is the link to the flash :
http://www.swfme.com/view/1211482 [early version]
http://raptor.x10.mx/index.php [latest]
and here is my flash file: http://www.zshare.net/download/96025525599154c2/
whenever you click yourself into a corner it gets stuck, i dunno how to resolve it, but otherwise the code is nearly perfect collision
in latest version player was moved to _root.map.player but it still behaves the same way
MovieClip.prototype.movement = function() {
var a = this;
var b = _root.map.block;
if (!_root.isPaused) {
if (_root.continueanim) {
a.mc.play();
}
a.spd = _root.pscale/100*5;
_root.rescale(a, _root.pscale);
a.xDistance = (a.posX-a._x);
a.yDistance = (a.posY-a._y);
a.hitX = (!b.hitTest(a._x+a.moveX, a._y, true))*(Math.abs(a.xDistance)>5);
a.hitY = (!b.hitTest(a._x, a._y+a.moveY, true))*(Math.abs(a.yDistance)>5);
if (Math.abs(a.xDistance)<Math.abs(a.moveX)) {
a.moveX = a.xDistance;
if (Math.abs(a.moveX)<=5) {
a.moveX = 0;
}
}
if (Math.abs(a.yDistance)<Math.abs(a.moveY)) {
a.moveY = a.yDistance;
if (Math.abs(a.moveY)<=5) {
a.moveY = 0;
}
}
if (a.hitX == 0 && a.hitY == 0 && a.onMove) {
a.mc.gotoAndPlay("idle");
a.onMove = false;
}
a._x += a.moveX*a.hitX;
a._y += a.moveY*a.hitY;
} else {
a.mc.stop();
_root.continueanim = true;
}
};
usually if you click the character into a corner you’d get stuck if you clicked in at an angle
can anybody help me? i’d appreciate a fix maybe ^^