Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 TIMERS FOR GAMES!!!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
nate




PostPosted: Fri Mar 28, 2003 5:36 pm   Post subject: 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 Exclamation

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
Sponsor
Sponsor
Sponsor
sponsor
Asok




PostPosted: Fri Mar 28, 2003 6:18 pm   Post subject: (No subject)

code:
Time.Elapsed


you can check usage in the Turing help file.
Dan




PostPosted: Fri Mar 28, 2003 6:27 pm   Post subject: (No subject)

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.

code:

var oldtime:int := Time.Sec

loop
locatexy(maxx div 2, maxy div 2)
put Time.Sec - oldtime
end loop
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
haujobb




PostPosted: Mon Mar 31, 2003 9:00 pm   Post subject: (No subject)

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




PostPosted: Mon Mar 31, 2003 11:16 pm   Post subject: (No subject)

If you wanted to include the timer as an arguement, use this:

code:
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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: