Timer Question - need help please?

allc1865allc1865 Member, PRO Posts: 777
Hey Everyone
I need help with my timer. I'm trying to create a countdown timer with a custom font. So far I have the timer and the font, but it doesn't countdown. I was wondering if anyone could help me with this?

For my timer actor I have 9 rules set up that say when self.digit = 0, change image, and so on.
I put three of those actors in the scene (I did this because I only want my time to be in the minutes, i.e, 2:00, 1:53), unlocked them and said constrain attribute > self.digit to game.time%60 and so on...

Any help will be great.
Thanks in advance! :) ;)

Best Answer

  • tatiangtatiang Posts: 11,949
    edited November 2013 Accepted Answer
    Two things confuse me:

    (1) You created and shared a template but you're... not getting this to work yet?
    (2) Is there a reason you didn't use the tried-and-true formulas here?

    Once you get the digits to count correctly, it's just a matter of constraining the actor's images to the digit expression values and naming those images 0.png, 1.png, 2.png etc.


    Also, here's a thread that discusses the OSTime Demo which is a fantastic tool for learning how to do all of this. The thread includes a link to another thread that has the download link for the demo. If for some reason that doesn't work, let me know and I can upload it for you.

Answers

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    To create a countdown timer, don't use game.Time because you'll have no control over it. Instead, change attribute game.TimeRemaining (real) to 120 [or how ever many seconds you want to count down] when you want to start the timer and then use a timer behavior set to every 0.1 seconds that changes game.TimeRemaining to game.TimeRemaining-0.1.

    You might find this demo helpful although there are others on the forums: http://forums.gamesalad.com/discussion/comment/339812/#Comment_339812
  • allc1865allc1865 Member, PRO Posts: 777
    Hello, @tatiang, thanks for your reply! I got a template off the forums, you can view it here: http://forums.gamesalad.com/discussion/45834/minutes-and-seconds-with-custom-fonts

    That counts down from 60 seconds, so I added another digit and it counts down, however I'm setting the number using the self attribute "divisor" to something like "100" or "200" which sets the it 2 minutes if I set it to 200.

    Do you mind taking a look at my file?
    https://www.dropbox.com/s/qly497b2ppffgwx/timerGame.zip
    Thanks.


  • allc1865allc1865 Member, PRO Posts: 777
    @tatiang, I see how you're doing it and that's a good way to set up timer, but I'm not sure how to include my custom font in there using those rules.
    Thanks.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I'm not sure I have time to help with custom timers. I spent about 20 hours building a real-time template that does something similar for a virtual pet app and it was not easy.

    If I get a chance tonight I'll look at your file but I can't promise anything.
  • allc1865allc1865 Member, PRO Posts: 777
    @tatiang, okay. Thanks so much! :)
  • allc1865allc1865 Member, PRO Posts: 777
    I created and shared a clock timer counting up and I can get it to count down, but I'm not sure how to get a custom font with the countdown formula I have set up.
    Yes, I'm familiar with the link that you shared here: http://forums.gamesalad.com/discussion/comment/329495/#Comment_329495
  • jorkosjorkos Member, PRO Posts: 353
    to use a custom font, rename your pngs for to the numbers 1.png 2.png etc.

    then just use a change attribute for self.image to game.timeremaining..".png" and it will change automatically....

    just search the threads for how to do this
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I just threw this together. Maybe it will be helpful... sorry I don't have more time (pun not intended).
  • allc1865allc1865 Member, PRO Posts: 777
    @tatiang, Hey, thanks for the template. I spent some time looking around at it and even was able to personalize it a bit. Thanks so much for taking the time to make this :) ;)
  • JJAZEJJAZE Member, PRO Posts: 13

    @tatiang said:
    I just threw this together. Maybe it will be helpful... sorry I don't have more time (pun not intended).

    Thanks for this! It also helps me a lot.... Your Awesome.... 8-)

Sign In or Register to comment.