Enemy pathing

I'm having some issues with enemy pathing in my platformer right now. Essentially I don't know the proper action or attributes to give the enemy to react the way I want. I would like for my enemy to just move back and forth constantly. I've tried simply "Move To" without success. My other issue is having the enemy start this movement when the player reaches a certain point in the level. Essentially I do not know how to start the enemy's movement when the player reaches this point versus at the very beginning of the scene. Any help would be great!
Comments
You first need to figure out his overall architecture to keep it from getting messy. I would recommend flagging states for him. For example, Patrol means he goes back and forth. Attack means he will stop and chase or shoot. Flee means he will try to run away. This way you can block out the behaviors.
http://forums.gamesalad.com/discussion/comment/293623#Comment_293623 video/templates
@hotMagic good advice!
@};- MH
Constrain the actor's X position to:
AAA*cos(self.time*BBB)+CCC
AAA = the distance in pixels he will travel left and right from the centre point, which is CCC . . . and BBB is how fast he will travel.
I keep hearing this from quite a few people, that constrains are to be avoided, only recently I've offered 'constraining' and 'spawning' and having two actors instead of one all as ways to address some game design goal, and each time the response seems to be that it's best to avoid all these things as, on some level, they will kill your game's performance. But from my experience this is not the case ????
By way of a test I just placed 100 actors on an iPad sized layout (I couldn't fit anymore on) - they are all being constrained (with their own individual values) to 512*cos(self.time*100)+512 (so they sweep rapidly from left to right across the iPad's screen) - and they are all being spawned from another actor.
The iPad had no issue whatsoever with them, the playback kept above 60 fps, and this was on a lowly iPad 1 !
So that's a scene with a hundred actors being spawned and those one hundred actors all being thrown around the place by a positional constraint quite happily at 60 fps on an iPad 1 ! . . . but in reality most of these questions are from people asking about a single actor (as is the case here) . . . . and as even a hundred constraints on an iPad 1 are no problem I can't see why constrain (and 'spawn') has attracted this label of being 'nasty' and best avoided ?