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]