I would expect this code to cause the object e.other to fade and then be removed. But when I run it, all that is visible is e.other being removed. I have increased the transition, but still not delay. Without the losecenter function, the delay works. What am I doing wrong?
thanks in advance
function losecenter(item)
item:removeSelf()
end
function onCollision(self,e)
if e.phase==“began” then
x=e.other.x
y=e.other.y
if string.sub(e.other.name,1,6)==“center” and self.name==“boulder” then
e.other.bodyType=“dynamic”
transition.to(e.other, { time=1000,alpha=.0,onComplete=losecenter(e.other)})
–the rest of the code doesn’t really matter, e.other should have disappeared after if faded.
text=display.newText("+100",x,y,native.sysemfont,20)
text:setTextColor(255,255,255)
score=score+100
camera:insert(text)
transition.to( text, { time=1500, alpha=.2, x=(x-50), y=(y-50) } )
scoretext.text=score
end
end
end
[import]uid: 50215 topic_id: 11824 reply_id: 311824[/import]