Run around with the arrow keys. You can't win, just try to stay alive. The enemy teleports randomly every 3 seconds. I never implemented anything to prevent it from teleporting on to you, so if you want to stay away from it, run around on the edges (I made a 20-pixel margin around the edges to prevent it from teleporting there). Pause with P and you can reveal the enemy target with R.
Minor tweak of CodeNinja's game.