does anybody know a way to use the hitTest function but against all Mc’s.if not does anybody know how to use the hitTest in a top view game (Like the original Gta’s)where you can move in 360 degree’s.
Try this:
onClipEvent (load) {
s = 5;
b = this.getBounds(this);
function move(x, y) {
if (!_root.limits.hitTest(_x+x+b.xmin+5, _y+y+b.ymin+5, true)) {
if (!_root.limits.hitTest(_x+x+b.xmax-5, _y+y+b.ymin+5, true)) {
if (!_root.limits.hitTest(_x+x+b.xmin+5, _y+y+b.ymax-5, true)) {
if (!_root.limits.hitTest(_x+x+b.xmax-5, _y+y+b.ymax-5, true)) {
_x += x;
_y += y;
}
}
}
}
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
move(0, -s);
}
if (Key.isDown(Key.DOWN)) {
move(0, s);
}
if (Key.isDown(Key.RIGHT)) {
move(s, 0);
}
if (Key.isDown(Key.LEFT)) {
move(-s, 0);
}
}
Hope that helps. Its not mine, but it was taught to me
P.S. its for da walls. I dont know how to make a hitTest for ALL the mcs.