# Facing problem

**URL:** https://forum.kirupa.com/t/facing-problem/122691
**Category:** Uncategorized
**Created:** [September 16, 2004, 1:42am UTC](https://forum.kirupa.com/t/facing-problem/122691 "2004-09-16T01:42:19Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![JoMan](https://avatars.discourse-cdn.com/v4/letter/j/2bfe46/32.png) [@JoMan](https://forum.kirupa.com/u/JoMan)
#### Post date: [September 16, 2004, 1:42am UTC](https://forum.kirupa.com/t/facing-problem/122691/1 "2004-09-16T01:42:19Z")

</div>

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:

```php
 
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;
				 }
			}
	 }
}

```
