Countdown Clock
TheT
Member Posts: 80
Hey,
I wonder if it is possible to have a countdown clock like 1:20:59 (minutes:seconds:milliseconds) that can be displayed on screen. I know how to make it display on the scren, however I have issues with the math of it. I was looking through the forum first and found this post: http://gamesalad.com/forums/topic.php?id=576#post-3100
but it was no good for me, because the code snippit from codemonkey seems to crash the entire GS on play. Hope I can get some help on this. Also is there a symbol for "attaching" variables together for the display text thing, like "1"&:&"20"&:&"59" ("" variable, : -> text, attach char: &)
Thanks!
I wonder if it is possible to have a countdown clock like 1:20:59 (minutes:seconds:milliseconds) that can be displayed on screen. I know how to make it display on the scren, however I have issues with the math of it. I was looking through the forum first and found this post: http://gamesalad.com/forums/topic.php?id=576#post-3100
but it was no good for me, because the code snippit from codemonkey seems to crash the entire GS on play. Hope I can get some help on this. Also is there a symbol for "attaching" variables together for the display text thing, like "1"&:&"20"&:&"59" ("" variable, : -> text, attach char: &)
Thanks!
Comments
1) Did you make sure you double check what you copied there?
2) Are you pulling attributes from the expression editor when it has something like self.myTime?
3) Are you using the expression editor?
4) the '..' is what is used for concatenation.
2) Not sure what you mean by that, but I have tried the same exact code with self.timer and with another global variable CountDown, didn't work
3) Yes, I used the editor
4) I noticed already another time that when I used the .., the game just crashes (just tried it again, did the same thing)
Also should be near the top of the shared games.
Don't know why it didn't work before with the other code, but well, thanks
Tenths of a second isn't too bad. Just add this at the end of the seconds.
..(floor( game.Time *10))%10
Here is my chunk of code if someone once needs a countdown timer with /10 seconds:
..floor( game.CountDown - game.Time *10)%10
Hey, codemonkey, how's about /100 seconds, would that also eat much resources ?
Maybe, like this: ..floor( game.CountDown - game.Time *100)%10
(% is for how many places are displayed isn't it ?)
Maybe we should make a wiki out of this post
100th of a second after the 10th of a second function started crashing for me. Its just a lot of redrawing. so I would not recommend it.
It didn't really look good with the /100, but the /10 is great ! Anyways, Thanks a lot for your help
PS: CountDown already is in seconds, so it works