im working on a overhead view game where you control the player.
ok so i found this code
onClipEvent (load) {
posy = _x;
movey = 120;
// move back 120 px
maxy = posy-movey;
// max y movemen
activate = true;
// if move is completed stop checking for hitTests
}
onClipEvent (enterFrame) {
if (activate) {
if (this.hitTest(_root.hero._x-12, _root.hero._y, true) and Key.isDown(Key.LEFT)) {
if (_x<maxy) {
_x = maxy;
activate = false;
}
_x--;
_root.hero.speed = 1;
// slow down hero
}
}
// end activate
}
this works great, but i can only push the box to the left. any idea on how i could push it in all 4 directions, and have it stop once it hits my movieclip??
THANKS! game
the fla and swf are available. i got it to stop once it hit the walls but i can move it in all directions once it hits the wall ( if i push it into the right wall i cannot move it down but i can move it up)