Reputation: 245
How do I move a display object in four direction using Corona SDK? I am in development of a maze game where the enemies has to movie randomly in four direction.
example I have tried it so:
function transtionBack()
transition.to(police, {time = 1000, x = police.x, y = 0, onComplete = transtionTo() })
end
function transtionTo()
transition.to(police, {time = 1000, x = police.x, y = 400, onComplete = transtionBack() })
end
transtionTo()
This doesn't seems to work; anyone have a better idea?
Upvotes: 2
Views: 170
Reputation: 245
I think i found the problem
function transtionBack()
transition.to(police, {time = 1000, x = police.x, y = 0, onComplete = transtionTo })
end
function transtionTo()
transition.to(police, {time = 1000, x = police.x, y = 400, onComplete = transtionBack })
end
transtionTo()
Upvotes: 2