I'd like to know how i can add 1 to my int every second until it reaches a certain number in this case 15.
But i would only want the int to start increasing once i have pressed a button.
@Override
public void touchUp(InputEvent event, float x, float y,
int pointer, int button) {
login.addAction(Actions.moveTo(0, 310, 1));
loginClicked = true;
if(loginClicked == true && loginTimer == 15){
login.addAction(Actions.moveTo(0, 430, 1));
}
}
});
There is my code as you can see i am making something move then after 15 seconds if it remains untouched i want it too move back.
You can use a Timer:
int delay = 5000; // delay for 5 sec.
int period = 1000; // repeat every sec.
int count = 0;
Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask()
{
public void run()
{
// Your code
count++;
}
}, delay, period);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With