The for loop gives the coordinates where to move the marker (a path), only the transition goes directly to the last coordinates.
I tried to make a performwithDelay() but i’m afraid i doesn’t handle that right
the xto and yto gives the right coordinates (before the function), but the xto in the function gives only the last coordinates (so this function is called after the for loop is completed.
so what i want is: move the marker from coordinate to coordinate and not (as now) from the begining direcly (linear) to the last coordinates. (the loop must not loop again until the transition is over)
thanks
[lua]animate = function(event)
local beginx = 1;
local beginy = 1;
local endx = 10
local endy = 10
path = CalcPath(CalcMoves(board, beginx, beginy, endx, endy))
local marker = display.newCircle(0,0, 8)
marker:setFillColor(255, 174, 0)
for i = 1, table.getn(path) do
newX = path[i].x
newY = path[i].y
xto=(newX*32-16)
yto=(newY*32-16)
print(yto)
local function mover()
transition.to(marker, {time=100, x=xto, y=yto });
print(xto);
end
timer.performWithDelay(i, mover, 1)
end
end[/lua] [import]uid: 18622 topic_id: 29361 reply_id: 329361[/import]