Hi, I’m new to corona and in my game I have the following function:
local function stelle()
local starTable = {}
function initStar()
local star1 = {}
star1.imgpath = "star1.png";
star1.movementSpeed = 10000;
table.insert(starTable, star1);
local star2 = {}
star2.imgpath = "star2.png";
star2.movementSpeed = 12000;
table.insert(starTable, star2);
local star3 = {}
star3.imgpath = "star3.png";
star3.movementSpeed = 14000;
table.insert(starTable, star3);
end --END initStar()
function getRandomStar()
local temp = starTable[math.random(1, #starTable)]
local randomStar = display.newImage(temp.imgpath)
randomStar.myName = "star"
randomStar.movementSpeed = temp.movementSpeed;
randomStar.x = math.random(0,\_W)
randomStar.y = -50
randomStar.rotation = math.random(0,360)
starMove = transition.to(randomStar, {
time=randomStar.movementSpeed,
y=\_H,
onComplete = function(self) self.parent:remove(self); self = nil; end
})
end
function startGame()
starTimer1 = timer.performWithDelay(1700,getRandomStar, 0)
starTimer2 = timer.performWithDelay(2300,getRandomStar, 0)
starTimer3 = timer.performWithDelay(2700,getRandomStar, 0)
end
initStar()
startGame()
end
tmr = timer.performWithDelay (75000, stelle, 0)
As you can see, this function starts 75 seconds after my game is started, now I would like to stop this function (I have to stop “tmr” I suppose) for example 15 seconds later. How can I do that?
Thanks a lot!!
[import]uid: 111398 topic_id: 32293 reply_id: 332293[/import]