
-----------------------------------
nate
Fri Mar 28, 2003 5:36 pm

TIMERS FOR GAMES!!!
-----------------------------------
I am making this Sniper game and I want to have a timer so that if you do not kill the person in a certain amount of time you will lose or something but I was wondering if anyone could give my the code for a TIMER    :!:

Also If anyone can give me good Ideas that would impress my teacher that would be greatly appreciated

Thanks
-Nate

MOD EDIT: Moved  to turing help

-----------------------------------
Asok
Fri Mar 28, 2003 6:18 pm


-----------------------------------
Time.Elapsed

you can check usage in the Turing help file.

-----------------------------------
Dan
Fri Mar 28, 2003 6:27 pm


-----------------------------------
there are a few difrent ways you  could do this.

the  simpisted  being, puting  a  couter in a loop.

but if you whont to use real time then i whod use the time comands

ex.


var oldtime:int := Time.Sec

loop
locatexy(maxx div 2, maxy div 2)
put Time.Sec - oldtime
end loop


-----------------------------------
haujobb
Mon Mar 31, 2003 9:00 pm


-----------------------------------
you would have to put it in a process:

var time : int := 30

process countDown ()
      delay(1000)
      time := time - 1
end countDown

then:

fork countDown ()

you might have to include time as an argument, im to lazy to remember....

-----------------------------------
azndragon
Mon Mar 31, 2003 11:16 pm


-----------------------------------
If you wanted to include the timer as an arguement, use this:

process timer (seconds : int)
    delay (seconds * 1000)
    cls
    put "Bye"
end timer

fork timer(2)
put "Hi"

That just displays hi, and after 2 seconds, displays bye.
