Right now i have a text-based game that deals with turns, but i want to upgrade it to a timer system so that when the timer hits 0 then you gain 1 or 2 of whatever action you were doing. Also if you know how to make it randomly pick whether u get 1 item or 2 items could you please elaborate on how to do that? Thank you to all responses.
Looking for a simpler JavaScript timer
413 views Asked by Mason At
2
There are 2 answers
0
On
Hope you will get from here.
http://www.elated.com/articles/javascript-timers-with-settimeout-and-setinterval/
Happy Coding.....
You can use
setTimeout()
for delaying actions for a set period of time, orsetInterval()
if you wish to run it periodically on a given interval.For getting a random number either 1 or 2 you can use
random()
: