Hi, thanks for the reply! I was thinking of a (non-scrolling) platformer. Here's how I would represent it in words:
If the enemy is to the left of the main character the enemy would move right.
If the enemy is to the right of the main character the enemy would move left.
If the character and enemy is at the same x position the enemy would stop.
I just couldn't figure it out, so any help appreciated