I've spent LOTS of time trying to get this idea to work for both X and Y coordinates. And it WILL NOT WORK. :/
Can you be more specific as to what is not working ?
I can get it working with the code I'd given you.
For both X and Y co-ordinates you can use something like
if player 1 x < [enemy 12 x]
{
player 1 x += 1
}
else
{
player 1 x -= 1
}
if player 1 y < [enemy 12 y]
{
player 1 y += 1
}
else
{
player 1 y -= 1
}