Timer Countdown question

allc1865allc1865 Member, PRO Posts: 777
Hello everyone ;) :)
I've created a timer that counts down, but I wanted to know how to make it count down from minutes. For example, 1:40, or 5:00 minutes. So far I only have it so it counts down from 10 seconds or so.
Thanks for any help :)

Best Answers

Answers

  • allc1865allc1865 Member, PRO Posts: 777
    @Manto1, thanks for your reply!
    What kind of attribute is it? Real? Boolean?
    Thanks! ;)
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    @Manto1, thanks for your reply!
    What kind of attribute is it? Real? Boolean?
    Thanks! ;)
    Integer, Index or Real would work. Boolean is a true and false variable type.

  • allc1865allc1865 Member, PRO Posts: 777
    Okay. That's what I have.
    I would create a Real attribute and call it Minutes*60?
    I'm just trying to understand.
    Thanks :)
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    Okay. That's what I have.
    I would create a Real attribute and call it Minutes*60?
    I'm just trying to understand.
    Thanks :)
    Manto1 was saying replace Minutes in his example with the number of minutes you want it to be i.e. if you want it to last for 5 minutes you would say

    Change Attribute: game.gameTimer = 5 * 60

    If you want 3 minutes you'd say

    Change Attribute: game.gameTimer = 3 * 60
  • allc1865allc1865 Member, PRO Posts: 777
    Okay. So I would create an attribute. Do I set it to anything in this area here?

    image
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    Although calling it time will probably work I'd recommend against it because there's already a built in attribute called Time. Call it gameTime or timer etc.

    And yes leave it as 0, you set it with a Change Attribute before running the Timer loop example Manto1 provided.
  • allc1865allc1865 Member, PRO Posts: 777
    Thank you that worked! :) ;) Any way to make it positive? It's counting negative right now.

    image
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    Do you mean it's counting down from a positive number and then going into a negative number once it reaches zero? Add a rule to stop it from going below zero or set your timer attribute as Index. Index attributes are positive numbers only.
  • allc1865allc1865 Member, PRO Posts: 777
    Okay thanks, @KevinCross. I'll take a look at it! :) ;)
Sign In or Register to comment.