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

Username:   Password: 
 RegisterRegister   
 Displaying a timer for a game
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh pageAdd this topic to your bookmarks (CTRL-D) View next topic
Author Message
Talion




PostPosted: Tue Dec 05, 2006 2:25 pm   Post subject: Displaying a timer for a game

I'm making a game and i'm having difficulty with making a timer. It isn't so much how to make the timer work, I've done that, but rather it is making the timer visible.

I have two variables for time, minutes and seconds. when seconds reach 0 it goes to 59 and at 59 minutes drops by one, and it ends if seconds and minute both reach zero. I was just wondering how I should display the timer? Definitely not just using a put statement, and Font.Draw wont just take a varible instead of text. I distinctly remember having done this before but I haven't programmed in a good while so bare with me.

So just to clarify that I'd like to know how to display variables in a game without using put (which lame)

Any suggestions or psuedo code examples? I'd really appreciate it.
 
Sponsor
Sponsor
Sponsor
sponsor
ericfourfour




PostPosted: Tue Dec 05, 2006 3:15 pm   Post subject: (No subject)

Look up intstr and realstr. They convert numbers to strings so you can use them with Font.Draw.
 
Clayton




PostPosted: Tue Dec 05, 2006 3:53 pm   Post subject: (No subject)

Just to expand a bit...

intstr takes an integer parameter and makes it a string while realstr takes a real parameter and makes it a string

some pseudo code for you:

Pseudo:

start time
do whatever
check to make change for minutes to seconds etc
end time
Font.Draw(hours + minutes + seconds)
rinse and repeat
 
Talion




PostPosted: Wed Dec 06, 2006 10:34 am   Post subject: (No subject)

hm alright thanks a lot i'll look into that.
 
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh pageAdd this topic to your bookmarks (CTRL-D) View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: