Is there a way to prevent the characters starting at the same time? I tried this but every single character still starts the action the moment the animation starts even if I added the delay.
--runningPG1.. runningPG5 have attached a sprite and coordinates
arrayPg = {runningPG1, runningPG2, runningPG3, runningPG4, runningPG5}
for key, value in pairs(arrayPg) do
transition.to(value, { y = value.y+350, time = 1500})
transition.to(value, { x = value.x-740, time = 2500, delay = 1550 })
transition.to(value, { y = value.y+825, time = 2500, delay = 4100 })
end
If you want each one to start at a different time, I think you would need to add a delay based on the number in the loop. Something like:
--runningPG1.. runningPG5 have attached a sprite and coordinates
arrayPg = {runningPG1, runningPG2, runningPG3, runningPG4, runningPG5}
baseDelay = 0
for key, value in pairs(arrayPg) do
transition.to(value, { y = value.y+350, time = 1500, delay = baseDelay })
transition.to(value, { x = value.x-740, time = 2500, delay = baseDelay + 1550 })
transition.to(value, { y = value.y+825, time = 2500, delay = baseDelay + 4100 })
baseDelay = baseDelay + 500
end
or you could use a random delay also
for key, value in pairs(arrayPg) do
baseDelay = math.random(0, 2000)
transition.to(value, { y = value.y+350, time = 1500, delay = baseDelay })
transition.to(value, { x = value.x-740, time = 2500, delay = baseDelay + 1550 })
transition.to(value, { y = value.y+825, time = 2500, delay = baseDelay + 4100 })
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.