0
votes

Hi I am developing game based on timing, What I want is my game will be of 100 seconds and time will be decreased every second, in between suppose user completed game in 40 seconds then the remaining seconds will be added to the score at that time also time will decrease but it needs to be decrease 1 in 10 mills seconds.

I searched on Google and I found the following code,

new CountDownTimer(30000, 1000) {

     public void onTick(long millisUntilFinished) {
         mTextField.setText("seconds remaining: " + millisUntilFinished / 1000);
     }

           public void onFinish() {
                mTextField.setText("done!");
            }
}.start();

Using this code decreasing 1 in every second, how can I decrease 1 in 10 millisecond?

for reference you can check This game

1
nano second is one billionth (10-9) of a second, not sure that you need such that precision.gio
@gio : i just want decreasing fasaterRajesh Panchal
1/1000th of a second is fast enough, i think: new CountDownTimer(30000, 1) {.Phantômaxx
@DerGolem 0.001 sec ? have you seen a game with a frame rate of 1000 fps? see gio's answerpskink
@pskink Well, the OP asked for nanoseconds!! Since nanoseconds are not achievable, the closest solution is 1 milli. Read the questions, before blindly criticing.Phantômaxx

1 Answers

2
votes

Change 2nd param for that.

new CountDownTimer(30000, 1000)

for example, speed of 25 frames per second is 40 milliseconds (it's 1s/25frames). It is enough for any your requirements.