
-----------------------------------
Gunz
Sat Jan 01, 2011 1:11 pm

Timer Help
-----------------------------------
What is it you are trying to achieve?
I want to display a timer for my game.

What is the problem you are having?
Once my level finishes the timer that was being displayed keeps counting down, even once I get into the main menu

When I use a variable in which I store an int, I cant use Font.Text to display it, and when I use an string, I can't subtract by 10, So I decided to not use any at all and just display each number (e.g 180..170..160) after a delay.
How can I stop this?
Please Help!!!

-----------------------------------
ProgrammingFun
Sat Jan 01, 2011 1:29 pm

RE:Timer Help
-----------------------------------
You should add some if structure to stop the timer:

if %level ends
      %reset the timer
end if


-----------------------------------
TerranceN
Sat Jan 01, 2011 1:36 pm

RE:Timer Help
-----------------------------------
Use an int, and to use Draw.Text you can convert that int to a string using intstr. Say your int was called counter, you could draw it like:


Draw.Text(intstr(counter), 0, 0, defFontID, black)


Theres conversions between most (if not all) variable types, their names are usually [current type][type you want], hence intstr. The only exception I know of is from real to int which is called round instead.

-----------------------------------
Gunz
Sat Jan 01, 2011 2:51 pm

Re: Timer Help
-----------------------------------
Thanks ALOT!!!
The conversation thingy works and I can display it properly!!!!
:D :D :D
