I’ve been working on a problem for a while now and I just cannot figure it out.
Object 1 moves with a transition, and when it collides with a different object, it cancels the transition temporarily, pauses for a second to make the other object nil, and then starts its transition again.
This is the basic set up I am using to do this:
function collide(self, event)
if (event.phase == "began") then
transition.cancel(self.myTransition)
nilEventOther()
return true
elseif (event.phase =="ended") then
self.myTransition = transition.to(self, {time=1000, x=self.x + 90, onComplete=moveAgain})
print("stopped colliding")
return true
end
end
This works fine when Object 1 only collides with one other object at a time. When it collides with two objects at a time, though, it will nil the one object, but then it will just start the transition again after that object is gone, and completely ignore the second object.
What can I do to make it so Object 1 recognizes the second object and will not continue moving until all objects it collides with are gone? [import]uid: 45667 topic_id: 22122 reply_id: 322122[/import]
[import]uid: 52491 topic_id: 22122 reply_id: 88021[/import]