Author |
Message |
Toma_L
|
Posted: Sun May 11, 2008 10:12 am Post subject: Analog Clock? |
|
|
Okay, so I'm having trouble with making an analog clock. What i have so far is getting the current time from the computer.
code: |
var timeOfDay :string
timr ( timeOfDay )
put timeofDay
... |
then i know that once i have the current time i have to separate out each value for the hours, minutes and seconds.
code: |
var hours:string
hours :=timeOfDay(1..2)
|
My teacher said to also use the strint(n) function...
like an example..
code: |
var hours :string
var nHour :int
hours := timeOfDay (1..2)
nHour :=strint (hours) |
What i'm having trouble with is making the actual clock, like the circle.. and the hour, minute, and second hands.
Help would be appreciated. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Insectoid
|
Posted: Sun May 11, 2008 12:21 pm Post subject: RE:Analog Clock? |
|
|
Have you tried making an analog clock by itself, without the actual time? I sugest drawing a circle, and then using Draw.Arc for the hands.
I did my clock with several nested loops (the 'second hand' loop inside the 'minute hand' loop inside the 'hour hand' loop inside the main loop). I'll post it when I'm at school tomorrow.
oh, and 1 second = 360 / 60. |
|
|
|
|
|
Toma_L
|
Posted: Sun May 11, 2008 12:43 pm Post subject: RE:Analog Clock? |
|
|
Thank you so much! I'm going to try that. I'm new at this so that will help me. |
|
|
|
|
|
Toma_L
|
Posted: Sun May 11, 2008 1:21 pm Post subject: RE:Analog Clock? |
|
|
I made the hands and the circle. Now I'm having trouble with the looping. |
|
|
|
|
|
zylum
|
Posted: Sun May 11, 2008 6:02 pm Post subject: RE:Analog Clock? |
|
|
There should only be one loop - no nested loops. Simply get the current time (in the loop) and update each had accordingly. Make the delay of the loop one second so that you don't update unnecessarily. |
|
|
|
|
|
Toma_L
|
Posted: Sun May 11, 2008 7:54 pm Post subject: RE:Analog Clock? |
|
|
Thanks! Yeah, I only made one loop. I just finished. |
|
|
|
|
|
|