Facing problem

Hello fellow kirupans, I have a small problem. I am making a fighting game, and I want the hero to face his enemy at all time, but I dont know how. My code is a bit messed up:

 
onClipEvent (enterFrame) {
	 if (direction) {
		 if (_x>_root.player2._x) {
			 if (_xscale<0) {
				 _xscale *= -1;
				 }
			}
	 }
}
onClipEvent (enterFrame) {
	 if (direction) {
		 if (_x<_root.player2._x) {
			 if (_xscale<0) {
				 _xscale = -100;
				 }
			}
	 }
}

they both work just fine with me…

attachMovie(“arrow”, “arrow1”, 1, {_x:0, _xscale:-100});
var a = attachMovie(“arrow”, “arrow2”, 2, {_x:50});
a._xscale *= -1;

Um i’d just do this

onClipEvent(enterFrame){
dist = this._x-player._x;
if(dist<0){
this._xscale = -100;
}
}

cos if he’s facing the right direction to start off you only need to change when he’s on the other side

Thanks for the help :), but I found out the problem, I had the enemy’s instance name of “_root.player2” :huh: