Change scenes Error

During the game level, after one side wins the object goes through a transition. The object is not able to insert itself into the localGroup,because by the time it reaches ln 122 to insert into localGroup, changeScene has been called. I have already tried to reverse the transition with the localGroup:insert, but that does not work as well.

Ln 122 Code:

cloud1 = display.newImage("images/cloud1.png", bb.x, bb.y)  
 transition.to( cloud1, { time=2500, alpha=0, x=bb.x, y=bb.y - 50 })  
ln 122-\>localGroup:insert(cloud1)  

Error:

lv10.lua:122: attempt to call method 'insert' (a nil value) [import]uid: 7197 topic_id: 6059 reply_id: 306059[/import]

figured it out. If I put a conditional to check if a boolean value. The boolean value is set when the game is ending. Therefore it will not process that chunk of code. [import]uid: 7197 topic_id: 6059 reply_id: 20793[/import]

@derwydd

You have to take care with the code you made with timers. Programming is linear but when you put timers, it will not waits for the timer ends, so you must put some controls like this boolean check you said. [import]uid: 8556 topic_id: 6059 reply_id: 21136[/import]