Increase the frequency of something as the game moves on

Hi all

I’m trying to figure out how to increase the speed of a function call using timer.performWithDelay as the game moves on

So far I have this:
[lua]local function spawner()
timez = 400 - r
if timez <= 10 then
timez = 10
end
timer.performWithDelay(timez, spawnTriangle, 1)
end

timer.performWithDelay(390,spawner,0)

– r is increased by 1 in the spawnTriangle function [/lua]
However, this doesn’t work as all it does it reduce the time between function calls to the 390 (+10) of the initial timer.

I tried it with just one timer, something like

[lua]timer.performWithDelay(timez,spawnTriangle,0);

– and again having r increase by 1 in the spawnTriangle function[/lua]

but this doesn’t reduce the timez variable.

Is there any way of doing this?

I can explain further if I haven’t been clear.

Thanks

Max
[import]uid: 24641 topic_id: 34771 reply_id: 334771[/import]

try this code:

[code]
local timez = 400

local function spawnTriangle()
timez = timez - 1
if timez <= 10 then
timez = 10
end
print(timez)
timer.performWithDelay(timez, spawnTriangle, 1)
end

local tim2 = timer.performWithDelay(390, spawnTriangle, 1)
[/code] [import]uid: 193524 topic_id: 34771 reply_id: 138179[/import]

try this code:

[code]
local timez = 400

local function spawnTriangle()
timez = timez - 1
if timez <= 10 then
timez = 10
end
print(timez)
timer.performWithDelay(timez, spawnTriangle, 1)
end

local tim2 = timer.performWithDelay(390, spawnTriangle, 1)
[/code] [import]uid: 193524 topic_id: 34771 reply_id: 138179[/import]