When my game starts, I create an object that listens for a touch event. When that event fires, I pass that object that was passed in to the event listener to a function that does a removeSelf().
function myObject:touch(e)
if (e.phase == “ended”) then
killMe(self)
…
This works great unless the game ends because the timer ran out. Since there is no myObject available when the timer runs out, I can’t call the killMe(self) function.
There is only one myObject at any given time. Should I create a global variable and assign it to myObject so that I can kill that global variable when the timer runs out? What would be the best way to handle this? [import]uid: 41809 topic_id: 16981 reply_id: 316981[/import]