So, as many else I’m trying to spawn stuff with timer.performWithDelay. Instead of enemies, I have houses that spawns as my scrolling game moves along.
Spawning is taken care of, I just can’t get them to delay between each house.
I’ve taken code from other threads here in the forum and I’ve dissected to all my abilities but I can’t just understand what I’m doing wrong.
This is the spawning function:
function create\_house()
local ent = math.random(1,3) -- random enemy type
local houseImage = display.newImage("house" .. ent .. ".png")
houseImage.x = 308
houseImage.y = 108 -- the object already has X and Y
transition.to(houseImage, { time=6000, 0, x=houseImage.contentWidth - 30 } )
return houseImage
end
and this is the code I’m using to delay:
local newHouse = create\_house()
timer.performWithDelay(7000,newHouse, 10)
and I’ve put it in my move() function that moves the entire scene forward. I think that’s the problem to be honest since move() is called so many times my latter code gets called repeatedly so it doesn’t matter what delay I’m using.
Any ideas where to put the delay code? [import]uid: 21652 topic_id: 13493 reply_id: 313493[/import]