You could use system compare two variables, if distance(player.x,player.y,enemy.x,enemy.y) less than equal to the 'range value' then enemy set position self.x or self.y +/- value depending on direction. The distance formula calculates the distance between the two objects. You could also do it another way which is to stick an invisible sprite on the enemy and have when player overlaps that sprite then teleport the enemy with set position, the both accomplish the same thing though.