
-----------------------------------
WhatAmIDoing
Tue Apr 20, 2004 1:34 pm

Timer
-----------------------------------
i was bored and trying to make a good looking timer  
setscreen ("graphics:200;100")
var Min, Sec, Hrs, MSec : int := 0
colorback (black)
cls
color (brightgreen)
loop

    Sec += 1
    if Sec = 60 then
        Sec := 0
        Min += 1
    end if
    if Min = 60 then
        Min := 0
        Hrs += 1
    end if
    locate (1, 1)
    put Hrs, " HRS"
    locate (1, 10)
    put Min, " MIN"
    locate (1, 20)
    put Sec, " SEC"
    delay(1000)
end loop

-----------------------------------
Delos
Tue Apr 20, 2004 4:45 pm


-----------------------------------
Delays are bad.  They are bad because there are never working.  Always, never working.  Why?  Because they are bad, always.  And different!  On all computers, so always, never.  Bad and bad.  "Good!" they say, "We are" they say, then they jump at me and beat me down with sticks.  And they are bad like techno with bagpipes.  Always!

Yeah, try Time.Elapsed instead.  


And for those who do not recognize the speach impediment pattern above, it is the classic Depressed Persian Tow Truck Man, from Mad TV.

-----------------------------------
Tony
Tue Apr 20, 2004 6:48 pm


-----------------------------------
Delos is right. You shouldn't be using delays. And when you are (to slow game down for example) - don't hardcode them, use variables instead and adjust the delay based on CPU speed

-----------------------------------
Delos
Tue Apr 20, 2004 6:49 pm


-----------------------------------
...and adjust the delay based on CPU speed...

Tony, is there any way of doing this without having the User enter their CPU speed manually???

-----------------------------------
Tony
Tue Apr 20, 2004 7:08 pm


-----------------------------------
well I was refering to [url=http://www.compsci.ca/v2/viewtopic.php?t=859]FPS implemination

-----------------------------------
WhatAmIDoing
Wed Apr 21, 2004 7:52 am


-----------------------------------
ok i'll try to implement that into but i still not completly sure of how it works.  any way thanks for the tip.
