[code]local onImageCollision = function ( self, event )
if( self.type == “gelo” and event.other.type == “cauldron” ) then
score.setScore (score.getScore()+5)
system.vibrate()
if podeSlow then
slowScreen = timer.performWithDelay(10,SlowScreen,1)
end
end
if( self.type == “clock” and event.other.type == “cauldron” ) then
score.setScore (score.getScore()+15)
tempo.setTempo (tempo.getTempo()+15)
numRelogios = numRelogios + 1
system.vibrate()
end
if( self.type == “potion” and event.other.type == “cauldron” ) then
score.setScore (score.getScore()+10)
system.vibrate()
if reverseLigado == false then
Orevertecontroles = timer.performWithDelay(10,ReverteControles,1)
end
end
if( self.type == “potion2” and event.other.type == “cauldron” ) then
score.setScore (score.getScore()+20)
system.vibrate()
if podeReduzirVelocidade then
reduzirVelocidadeScreen = timer.performWithDelay(10,reduzirVelocidade,1)
end
end
if( self.type == “pena” and event.other.type == “cauldron” ) then
score.setScore (score.getScore()+10)
end
if( self.type == “morcego” and event.other.type == “cauldron” ) then
score.setScore (score.getScore()+25)
end
if( self.type == “gato” and event.other.type == “cauldron” ) then
score.setScore (score.getScore()+5)
end
if( self.type == “chapeu” and event.other.type == “cauldron” ) then
score.setScore (score.getScore()+20)
numHats = numHats + 1
end
if( self.type == “aranha” and event.other.type == “cauldron” ) then
score.setScore (score.getScore()+50)
end
if( self.type == “abobora” and event.other.type == “cauldron” ) then
score.setScore (score.getScore()+15)
end
if( self.type == “caveira” and event.other.type == “cauldron” ) then
score.setScore (score.getScore()+25)
numCaveiras = numCaveiras + 1
end
if( self.type == “caveira2” and event.other.type == “cauldron” ) then
score.setScore (score.getScore()+60)
numCaveiras = numCaveiras + 1
system.vibrate()
if podeFast then
fastScreen = timer.performWithDelay(10,FastScreen,1)
end
end
– Poof code below –
if poofTween then transition.cancel( poofTween ); end
greenPoof[a].x = self.x; greenPoof[a].y = self.y
greenPoof[a].alpha = 0
greenPoof[a].isVisible = true
local complete1 = function (e)
greenPoof[a]:removeSelf()
end
local fadePoof = function(e)
transition.to( greenPoof[a], { time=300, alpha=0, onComplete = complete1 } )
end
poofTween = transition.to( greenPoof[a], { time=100, alpha=1.0, onComplete=fadePoof } )
self.parent:remove( self )
self = nil
end
function E_bomb1Spawn(e)
a = a + 1
objetos[a] = itens.novoItem()
objetos[a].x = 150
greenPoof[a] = display.newImageRect( “imagens/bola.png”, 30, 30 )
greenPoof[a].alpha = 1.0
greenPoof[a].isVisible = false
gameGroup:insert( greenPoof[a] )
–physics.addBody( objetos[a], “dynamic”, { density=1, bounce=0, friction=0.5 } )
hudGroup:insert( objetos[a] )
objetos[a].collision = onImageCollision
objetos[a]:addEventListener(“collision”, objetos[a])
instance2:addEventListener(“collision”, instance2)
end
[/code]
in my game, when a object collide with the ground, he break up
and after 300 miliseconds he removeSelf… but my problem is to do this… what happen when 2 objects collide in the ground, the first object begin the transition to fade in and removeself, but when the second object collide, he stop the first objects removeSelf function
I try to make this “greenPoof” a array and set this to have a ID, one for each object… but i dont know why this isnt working
[code]a = a + 1
objetos[a] = itens.novoItem()
objetos[a].x = 150
greenPoof[a] = display.newImageRect( “imagens/bola.png”, 30, 30 )
greenPoof[a].alpha = 1.0
greenPoof[a].isVisible = false
gameGroup:insert( greenPoof[a] )
[/code] [import]uid: 23063 topic_id: 10765 reply_id: 39177[/import]