Hi guys,
I have a code in as 1 and was hoping whether someone could help me mekae it as 2
onClipEvent (load) {
s = 15;
b=this.getBounds()
function move(x, y) {
if (!hit.hitTest(_x+x+b.xmin+1, _y+y+b.ymin+1, true)) {
if (!hit.hitTest(_x+x+b.xmax-1, _y+y+b.ymin+1, true)) {
if (!hit.hitTest(_x+x+b.xmin+1, _y+y+b.ymax-1, true)) {
if (!hit.hitTest(_x+x+b.xmax-1, _y+y+b.ymax-1, 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.LEFT)) {
move(-s, 0);
}
if (Key.isDown(Key.RIGHT)) {
move(s, 0);
}
}
Thanks in Advance!
Impero