Linked Questions

Popular Questions

libgdx Timer countdown implmentation

Asked by At

I want to create efficienty timer in LibGDX framework, that will count the time left for my character. The doSmth() method should be called as many times as some flag is set to true. I know that the third parametr of Timer is that, how many times should it trigger. For now one Im calling the method recursive, but I dont think it is the efficient way.

 public void updateTimer(){
        new Timer().scheduleTask(new Timer.Task() {
    @Override
    public void run() {
      doSmth();
     updateTimer();
    }
},1);
            }

Related Questions