constantly moving obstacle

refer to the image below:
Image and video hosting by TinyPic

I’m trying to create constantly moving obstacle( blue circle in the picture above ).
The blue circle will move left to right with a constant speed.

the goal of this game is to move the player(red square) to right side of area without heating obstacles.

Any related examples or tutorials will be welcome.
Help me guys! [import]uid: 131469 topic_id: 23123 reply_id: 323123[/import]

I helped someone out the other day with the same kind of transitioning “loop”. See if this helps.

http://developer.anscamobile.com/forum/2012/03/09/rotating-back-original-location-completion

[import]uid: 21331 topic_id: 23123 reply_id: 92474[/import]

Thank you so much. The post help me solve the problem.
I made the movement how I wanted.
But I’m not quite sure why the codes make this movement.

--create function "batter"  
local function batter()  
 --create rectangle shape object with name "rect1"  
 local rec1 = display.newRect(200,200, 10, 100)  
 --change the anchor point to bottom center of the shape  
 rec1:setReferencePoint(display.BottomCenterReferencePoint)  
 -- ?  
 local move\_timer = nil  
 -- ?  
 local trans = nil  
  
 --create function "move\_one"  
 local function move\_one()  
 --say "move\_one" when the function is used  
 print("move\_one")  
  
 --create function "move\_two"  
 local function move\_two()  
  
 --say "move\_two" when the function is used  
 print("move\_two")  
  
 --make movement   
 trans = transition.to(rec1, {time=100, x=50, y=100, onComplete=move\_one})  
 end  
 --movement  
 trans = transition.to(rec1, {time=100, x=100, y=50, onComplete=move\_two})  
 end  
 move\_one()  
end  
  
-- why say batter?  
batter()  
  

and I don’t understand how it flows.
in line 24, it says onComplete = move_one. now it goes back to line 13 and start reading again from there?
[import]uid: 131469 topic_id: 23123 reply_id: 92493[/import]