java util timer

Joined
Jun 17, 2010
Messages
1
Reaction score
0
I have just switched from using java swing timers because I had two or more running and they constantly crashing each other and have moved to using java util timer.

I have succesfully converted all of them into java util timers but I have founds some new problems in the game I'm developing.

The main one is when the attack timer is running and you switch a weapon, the weapon might have a slower/faster delay so the delay needs to change. For example you have a fast weapon attacking then you switch to a slow weapon, the delay should change from 2000 to about 4000. My idea is when your attacking and you switch weapons, the attacking is set to stop next time the timer runs unless you click on the player where you continue attacking with the changed delay.

The reason the attacking is set to stop when the time hits is because I dont want players to keep switching between the two weapons and having the 100ms initial delay between each attack.

A simple way for me to describe this is pretty much this:

While a java util timer is running on a delay of about 1000 ms, how would you change it to about 2000 *While it is still running*.
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top