Sign in to follow this  
Moose6912

Countdown timer

Recommended Posts

benryves    1999
How often does the thread execute? I'm assuming you've got the thread timed so the game code "ticks" once every so often. If it's "ticking" every 10ms, just have a counter that starts at 0 and is incremented every "tick", wait for it to hit 100 then reset it and decrement your countdown variable.

Share this post


Link to post
Share on other sites
McMcDonald    122
Hi!

Try this:

long t,current_time;

somewhere start your timer:
t = System.currentTimeMillis() + 30000;

....
in your game loop:

current_time = t - System.currentTimeMillis();

Regards
McMc

P.S. It's the first time i use my profile signature.... i am not sure about how it looks like.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this