How to display a count down clock that starts from a random number?
therobinsonbros@gmail.com
Member Posts: 34
I'm trying to make a clock that count down by the seconds, but I want it to pick a random number out of 10sec - 30sec to start from then count down to 0.
So when I reset my game it should pick a new number each time, but no higher then 30sec and no lower then 10sec.
So when I reset my game it should pick a new number each time, but no higher then 30sec and no lower then 10sec.
Comments
http://speedy.sh/kGMX3/timerr.rar
First make a game attribute (timer)
Next make a rule-game.timer=random(1,20)
Inside that rule add 20 more rules.
Rule
Game.timer=1
Timer for 10 secs (and add what you want in the timers)
Next rule
Game.timer=2
Timer for 11 secs (and add what you want in the timers)
And so on and so on.
That should do the trick if I get back to my computer and your still having troubles let me know and I'll do a sample for you.
Good luck hope I didn't confuse you more then when you started.
Display Text:
abs(prec(game.my timer,2))
change attribute:
set: game.start time to: game.time
Rule:
if game.my timer >0
Do:
constrain attribute:
constrain: game. my timer to 15-(game.time-game.start time)
This is how I should do it.
First make a boolean attribute (start timer) and a integer attribute (timer)
Rule
If game.start timer is true AND if game.timer is 0
Do
Change game.timer to random(10,30)
Interpolate game.timer to 0
In game.timer seconds
The attribute game.start timer is not something you really need. Its just to start the timer
You can have a button
If touch is pressed
Do
Change game.start timer to true
And it starts the timer
I cant help you with the code abs(prec(game.my timer,2)) because I dont know what abs and prec does so if someone can tell me (I though @Socks gave you this rule) would be really appreciated
Hope this helped
✮ FREE templates at GSinvention ✮
✮ Available for hire! support@gsinvention.com ✮
So if game.my timer is -3.1258699, abs(prec(game.my timer,2)) will return 3.12.
See http://cookbook.gamesalad.com/definitions for more.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User