Hey first time posting about code so please say if you need more information than what i give you...
I'm having trouble with a timer, am trying to wait 2 secs then add 5 to Defender.Bullets but they are a delay on this and it bugs out if i keep clicking this. It works properly if i wait a couple of seconds after its been implemented.
Here is the code
new java.util.Timer().schedule(
new java.util.TimerTask() {
@Override
public void run() {
Defender.bullets = 5;
}
}, 2000 (I have tried to put a delay here but didn't seem to work either)
);
The code has supposed to reload bullets which is up the right hand side of the screen but looks like the "Defender.bullets = 5;" keep going even after the 2 secs...
This is my first time using Timer, so not sure if this is done correctly.
Any information is appreciated
Thanks for your time