is it possible to make a transition while dragging the map?
if the object isn’t moving it’s easy only i haven’t figured out yet how i can do this with a moving object!
the object is already moving to some coordinates so it doesn’t help if i change the goal of the transition…
sorry for my bad english
thanks
[edit]
so i have to update the transition coordinates (while already moving)(this is imposible?) or i have to manipulate the x and y coordinates by dragging them with the map (don’t know if this is possible?)
in ghost vs monsters it look likes it’s done with the clouds in the background. does any one know how?
[edit2]
ohh it really gives me headache
the ghost vs monsters app pauses the clouds so it’s not relevant for me…
i think i have to make a enterframe event? only that’s also the hard part because the coordinates of the object (ship1) transition are in an array (the route around the obstacles). Here’s the code, i hope you guys know how to fix this because i have no idea :’(
This is the array with the coordinates (newX and newY are the tile numbers (x:5,y:1 next array x:5,y:2 etc) and the xto are the new coordinates where to move to (tiles are 128x128 pixels).
[lua]path = CalcPath(CalcMoves(board, beginx, beginy, endx, endy))
for i = 1, table.getn(path) do
newX = path[i].x
newY = path[i].y
xto=(newX*128-64)-respectivelijkx
yto=(newY*128-64)-respectivelijky
transition.to(ship1, {delay = 500*(i-1),time=500, x=xto, y=yto });
end[/lua]
this is the code for the map dragging:
[lua]function map(event)
if(event.phase == “began”) then
display.getCurrentStage():setFocus (event.target)
nowx = event.x - spritemap.x
nowy = event.y - spritemap.y
nowship1x = event.x - ship1.x
nowship1y = event.y - ship1.y
print(nowship1x)
print(nowship1y)
elseif(event.phase == “moved”) then
previousX = event.x - nowx
previousY = event.y - nowy
previousship1X = event.x - nowship1x
previousship1Y = event.y - nowship1y
if ( previousX <= worldLimits.XMin and previousX >= adjustedXMax ) then spritemap.x = previousX;
ship1.x=previousship1X
respectivelijkx = -previousX
end
if ( previousY <= worldLimits.YMin and previousY >= adjustedYMax ) then spritemap.y = previousY;
ship1.y=previousship1Y
respectivelijky = -previousY
end
elseif(event.phase == “ended”) then
end
end[/lua] [import]uid: 18622 topic_id: 29381 reply_id: 329381[/import]