Hey,
So I have this transitions and I want them to randomly be activated. And then, once I tap the object, the transition get cancelled. Here’s my code:
local object1 = display.newImageRect ("object1.png",80,40)
object1.x =40; object1.y = 30
local object1 = display.newImageRect ("object1.png",80,40)
object1.x =40; object1.y = 90
local object1 = display.newImageRect ("object1.png",80,40)
object1.x =40; object1.y = 150
local trans1 = transition.to(object1, {time = 2000, x = 100, y=30})
local trans2 = transition.to(object2, {time = 2000, x = 100, y=90})
local trans3 = transition.to(object3, {time = 2000, x = 100, y=150})
local function onTouch(event)
transition.cancel(trans1)
transreverse = transition.to(object1, { time = 200, x=40, y=30})
end
object1:addEventListener("tap", onTouch)
local function onTouch2(event)
transition.cancel(trans2)
transreverse2 = transition.to(object2, { time = 200, x=40, y=30})
end
object2:addEventListener("tap", onTouch2)
local function onTouch3(event)
transition.cancel(trans3)
transreverse3 = transition.to(object3, { time = 200, x=40, y=30})
end
object3:addEventListener("tap", onTouch3)
Right now they all start transitioning at the same time…I need them to start one at a time, randomly, and stop after I tap each of them. Once they’re back to the original place (x=40), I need them to reenter into the random function to start transitioning again.
Any thoughts?
Tks
[import]uid: 95495 topic_id: 18826 reply_id: 318826[/import]