local onImage11Collision = function ( self, event )
if( self.type == "bomba" and event.other.type == "cauldron" ) then
score.setScore (score.getScore()+25)
numCaveiras = numCaveiras + 1
end
local greenPoof
greenPoof = display.newImageRect( "imagens/bola.png", 30, 30 )
greenPoof.alpha = 1.0
greenPoof.isVisible = false
gameGroup:insert( greenPoof )
-- Poof code below --
if poofTween then transition.cancel( poofTween ); end
greenPoof.x = self.x; greenPoof.y = self.y
greenPoof.alpha = 0
greenPoof.isVisible = true
local fadePoof = function()
transition.to( greenPoof, { time=300, alpha=0 } )
local complete1 = function (e)
greenPoof:removeSelf()
end
tempoDestroi = timer.performWithDelay( 300, complete1, 1)
end
poofTween = transition.to( greenPoof, { time=100, alpha=1.0, onComplete=fadePoof } )
self.parent:remove( self )
self = nil
end
this is my code for collision when a object collide with ground or my cauldron
but i’m getting a little problem… if a object collide with the ground or caldroun before previous, the local complete1 = function (e)
greenPoof:removeSelf()
end dont work and the greenpoof still there and dont remove after that =S
I have 12 collision code, all the same… if have a way to do this work… dont know how
thanks [import]uid: 23063 topic_id: 10683 reply_id: 310683[/import]