Ok so when I call cancelBomb() wht does it only delete one bomb please?
if I just spawn one bomb it works fine.
[lua]
createBomb = function()
local bomb = display.newRect(0, 0, 2, 10)
bomb.x = enemyYellow[1].x
bomb.y = enemyYellow[1].y
local params = {isBullet = true,isSensor = true, friction = 0,bounce = 0, }
bomb.isBodyActive = true
bomb.myName = ‘bomb’
physics.addBody(bomb, params)
bomb:addEventListener(“collision”, bomb)
bomb:applyForce(0, 0.005, bomb.x, bomb.y)
cancelBomb = function()
if bombSpawnTimer then timer.cancel(bombSpawnTimer) bombSpawnTimer = nil end
bomb:removeSelf()
bomb = nil
end
end
spawnBomb = function()
if enemyActive then
bombSpawnTimer = timer.performWithDelay(1000,createBomb,2)
else
end
end
spawnBomb()
[/lua]