Código ActionScript :
movespeed=2 onClipEvent (enterFrame) { if (this.hitTest(_parent.wall3)) { this._y -= movespeed; } else { this._y += 0; } if (this.hitTest(_parent.wall2)) { this._y += movespeed; } else { this._y -= 0; } if (this.hitTest(_parent.wall1)) { this._x += movespeed; } else { this._x -= 0; } if (this.hitTest(_parent.wall4)) { this._x -= movespeed; } else { this._x += 0; } }
Los movieClips: wall1, wall2, wall3, wall4 estan alrededor del enemigo y cada uno como pueden ver en el codigo hace que se detenga, pero resultaria traumatico el agregar cada accion a los enemigos de todas las paredes de un escenario, quisiera preguntarles si hay forma de que el mapa ("hit") que usa mi personaje principal, tambien haga que los enemigos se detengan?, hice varias pruebas como:
Código ActionScript :
if (this.body.hitTest(_parent.hit.x, _parent.hit.y,)) { this._x += movespeed; } else { this._x -= 0; }
Muchas gracias adelantadas, espero que me puedan echar la mano.
Saludos¡¡¡