I am trying to make an egg spawn every XX seconds from where the user clicks the screen. I want the player to be able to make multiple spawners. My problem is that when the player creates more than one, the eggs only spawn from the last place clicked, not from their original location. So think of the game Plants vs. Zombies and how the plants shoot a seed every XX seconds from their location. Thats basically what I’m trying to do. Here is part of my code:
[lua]function shootEgg(tX, tY, power)
– Spawn egg
local egg = display.newCircle(tX, tY, 10)
– Add bullet physics
physics.addBody( egg, { density= 10.0, friction= 0.3, bounce=0.00 } )
egg.isBullet = true
egg:applyForce( power*20, 0, egg.x, egg.y )
return egg
end
function 123()
timers[1][2] = timer.performWithDelay(2000, shootEgg(x_here, y_here, power_here), 0)
end[/lua]
So it works correctly for the first iteration, but does not continue afterwards. If I take the parameters out of the timer, it iterates through fine but doesn’t carry the parameters which I need. [import]uid: 63320 topic_id: 15899 reply_id: 315899[/import]

