Another newbie question

OK so i am setting up timers and i have one that counts down but i cant get the other one to get down. Here are the codes i am using for both of them.

timer 1 (works)

1
2
3
4
5
6
7
8
9
10
11
12
13
local countdowntxt = display.newText(time_remain, 0, 0, "Times New Roman", 16*2);
countdowntxt.xScale = 1; countdowntxt.yScale = 1;
countdowntxt:setReferencePoint(display.CenterRightReferencePoint);
countdowntxt.x = _W-20; countdowntxt.y = _H-20;
 
local function countDown(e)
        time_remain = time_remain - 1;
        countdowntxt.text = time_remain;
end
 
if(o == total_mints) then 
                gametmr = timer.performWithDelay(1000, countDown, 1814400)
        end

OK on line 16 is when the second timer code starts

Is this all of the code?

I don't see where o,time_remain2, total_mints, or time_remain are given any starting values.

and adding < /code > tag will end the code areas.

Hey there, have fixed up the tags in your post.

You want to use < code > as you were before the code but at the end, do < /code > to go back to normal text. (Without the spaces of course.)

As Screaming Leaf said it would help to see some more code.

I do see a typo that may be causing the problem, however that should have printed in the terminal. (Are you using the terminal?)

Anyway, line 12 - you write "counDown" rather than "countDown".

Peach :)

Yes i am using the console and i had noticed that typo a few minutes after i posted the post. And i am not using a starting value for 0 or total_mints, cause i all i want to do is make the timer run and it seems to do that without those values but here are the codes for time_remain and time_remain2.

1
2
time_remain = 1814400
time_remain2 = 30240

Oh just adding 0 = 1 and total_mints = 1 got it to work ^_^ thank you for your help and i'm sure i will be back with mroe questions later.

Glad all is well now - I look forward to seeing your other questions around the forum.

Peach :)

Thank you again.

views:1604 update:2011/12/31 9:35:10
corona forums © 2003-2011