Computer Science Canada

Displaying a timer for a game

Author:  Talion [ 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.

Author:  ericfourfour [ Tue Dec 05, 2006 3:15 pm ]
Post subject: 

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

Author:  Clayton [ Tue Dec 05, 2006 3:53 pm ]
Post 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

Author:  Talion [ Wed Dec 06, 2006 10:34 am ]
Post subject: 

hm alright thanks a lot i'll look into that.


: