I would expect this code to raise a rectangle up along either side of the screen and then traverse across the top ending up in the top center of the screen.
Instead what happens is the rectangle does a sweeping arch from the lower corner of the screen to the upper center of the screen. It’s as if it is combining the two transition.to functions and giving me a “combined” result.
How do I get it to do what I want it to do, instead of what it wants to do.
–this should be when the rectangle then moves toward the center of the screen.
function moveAcross(side)
if side==“R” then
transition.to(r_lift,{delay=500, time=1500,x=_W/2})
else
transition.to(l_lift,{delay=500, time=1500,x=_W/2})
end
end
–this begins the raise of either side of the screen of the rectangles (r_lift /l_lift)
function raiseLift(side)
if side==“R” then
transition.to(r_lift,{delay=1000, time=3000,y=H_cnt, onComplete=moveAcross(“R”)})
else
transition.to(l_lift,{delay=1000, time=3000,y=H_cnt, onComplete=moveAcross(“L”)})
end
end
–this function creates the two rectangles and gives them physics.
function positionLifts()
l_lift=display.newRect(0,_H-5,W_cnt,5)
l_lift.name=“l_lift”
physics.addBody(l_lift,“static”)
localGroup:insert(l_lift)
r_lift=display.newRect(_W-W_cnt,_H-5,W_cnt,5)
r_lift.name=“r_lift”
physics.addBody(r_lift,“static”)
localGroup:insert(r_lift)
end
[import]uid: 50215 topic_id: 12236 reply_id: 312236[/import]