Hi,
I have set up a spawning feature in my game and it works great but as the levels progress I want more beach balls to fall sooner. Ex. one ball is spawned then soon after that another is spawned so it more are falling to make it tougher and not just one…then another…then another etc.
Here’s a part of the code that makes multiple objects fall but there’s a problem with it…
timer.performWithDelay( 100, spawnBall, 2 )
when I have it set to 2 it spawns them both at once and, because of my collision code, it detects a collision and then goes crazy by spawning all of the beach balls on the screen.
if event.other.name == "pig" then
timer.performWithDelay(100, function() self:removeSelf() end)
elseif event.other.name == "extraLine" then
timer.performWithDelay(100, function() self:removeSelf() end)
elseif event.other.name == "line" then
timer.performWithDelay(100, function() self:removeSelf() end)
And it throws up errors saying…
…rs/dannykilkenny/Desktop/Adam’s Apple - Fixed/L7.lua:134: ERROR: Attempt to remove an object that’s already been removed from the stage or whose parent/ancestor group has already been removed.
stack traceback:
[C]: ?
[C]: in function ‘removeSelf’
…rs/dannykilkenny/Desktop/Adam’s Apple - Fixed/L7.lua:134: in function ‘_listener’
?: in function <?:446>
?: in function <?:215>
Any Ideas? [import]uid: 59140 topic_id: 18311 reply_id: 318311[/import]
do you think I’m going to have to rework the entire code? [import]uid: 59140 topic_id: 18311 reply_id: 70268[/import]
[import]uid: 52491 topic_id: 18311 reply_id: 70287[/import]