0

ゲームでモグラの波動を0.8秒ごとに変化させようとしています。(私のゲームは単に「もぐらたたき、練習用です)」です。

波を変更する私のコード:

double TIME = 0.8;

if (Next) { //If 0.8 seconds is up
        if (Over == false) { //make sure the game hasn't ended
            start = (int) (cTime/1000); //cTime is the milisecond since game started
            String wave = MolesWaves.RandomWave(); //getting the new wave data 
            initWave(wave); 
            Next = false; //disallow the game from changing wave
        }
    }
    else {
        if (((cTime/1000) - start) >= TIME) { //changing speed
            System.out.println("Test: " + ((cTime/1000)-start));
            Next = true; //allow game to change waves
        }
    }

からSystem.out.println("Test: " + ((cTime/1000)-start));、これは出力ログから取得したものです。

Test: 0.802
Test: 0.817
Test: 0.833
Test: 0.852
Test: 0.867
Test: 0.883
Test: 0.9
Test: 0.917
Test: 0.933
Test: 0.95
Test: 0.967
Test: 0.983
Test: 1.0

問題は、波が毎秒13回変化し、しばらく毎秒になるとスイッチングを停止し、再び開始することです。
の値が でTIMEある場合1、すべて問題ありません。波は1秒ごとに変化します。
難易度選択 (イージー、ミディアム、ハード...) を実装しようとしているので、0.8 を使用しています。難しいほど、波の変化が速くなります。

上記のコードが問題の原因ですか? もしそうなら、私のためにこれを解決してください。

4

1 に答える 1