Saturday 15 August 2015

lua - spawning objects not removing after leaving scene -


just

Hi my items are not removed after leaving the view, I have tried to remove the purification and footage, but the objects Will sponging in any other view?

  Local badclout1 = {} local bad1Group = display.newGroup () local ceremony spawnBC1 () local badclouts1 = display.newImage ( "BCloud1.png") badclouts1.x = math.random (0 now it's just the standard) physics.addBody (badclouts1, "dynamic", {density = 0.1, bounce = 0.1, friction = 0.2, radius = 45}) badclouts1.name = "BCloud1" badclouts1.bodyType = "Science Related "badclouts1. isSensor = true badclouts1.y = math.random (-100, -50) badclouts1.index = # badclout1 + 1 bad1Group: insert (badclouts1) badclouts1.rotation = math.random (-10,10) - Rotate object badclouts1: setLinearVelocity (0, math.random (speeda1, speedb1)) - badclout1 drop down [badclouts1.index] = badclouts1 tmrSpawn1 = timer.performWithDelay (math.random (spawna, spawnb), spawnBC1) return badclouts1 end tmrSpawn1 = timer. PerformWithDelay for I (math.random (1000, 10000), spawnBC1) Local function removeBomb (), in pairs (badclout1), we do badclout1 [i] .y & gt 1000 then badclout1 [i]: removeSelf () badclout1 [ i] = nil end end end runtime: addEventListener ( "enterFrame", Nikalenbomb)   

is there something in my code which puts it on the screen?

to your performWithDelay function timer.cancel (tmrSpawn1) < / Code> to be canceled. Because you are calling it again and again, it will continue until you cancel it.

No comments:

Post a Comment