summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5646018)
raw | patch | inline | side by side (parent: 5646018)
author | fredboy <fredboy@protonmail.com> | |
Fri, 19 Apr 2024 17:59:18 +0000 (00:59 +0700) | ||
committer | fredboy <fredboy@protonmail.com> | |
Fri, 19 Apr 2024 17:59:18 +0000 (00:59 +0700) |
core/src/ru/deadsoftware/cavedroid/game/world/GameFluidsThread.java | patch | blob | history | |
core/src/ru/deadsoftware/cavedroid/game/world/GameWorld.java | patch | blob | history |
diff --git a/core/src/ru/deadsoftware/cavedroid/game/world/GameFluidsThread.java b/core/src/ru/deadsoftware/cavedroid/game/world/GameFluidsThread.java
index c5eb8337b3810636f04efbe3a0126e1f1f142184..50fcef14c92ef32896859f10c79c6494c6929b69 100644 (file)
package ru.deadsoftware.cavedroid.game.world;
+import com.badlogic.gdx.utils.Timer;
import ru.deadsoftware.cavedroid.game.mobs.MobsController;
import java.util.Arrays;
-import java.util.TimerTask;
import static ru.deadsoftware.cavedroid.game.GameItems.*;
-class GameFluidsThread extends TimerTask {
+class GameFluidsThread extends Timer.Task {
- public static final int FLUID_UPDATE_INTERVAL_MS = 100;
+ public static final float FLUID_UPDATE_INTERVAL_SEC = 0.1f;
private static final int FLUID_STATES = 5;
private static final int[] WATER_IDS = {8, 60, 61, 62, 63};
diff --git a/core/src/ru/deadsoftware/cavedroid/game/world/GameWorld.java b/core/src/ru/deadsoftware/cavedroid/game/world/GameWorld.java
index 692eabcb45289a6944150b07cfc6f2dd12959d5c..43fc1641033616ec6645795ead6daed286dc82e3 100644 (file)
package ru.deadsoftware.cavedroid.game.world;
import com.badlogic.gdx.utils.Disposable;
+import com.badlogic.gdx.utils.Timer;
import kotlin.Pair;
import ru.deadsoftware.cavedroid.game.GameItems;
import ru.deadsoftware.cavedroid.game.GameScope;
import javax.annotation.CheckForNull;
import javax.inject.Inject;
-import java.util.Timer;
@GameScope
public class GameWorld implements Disposable {
mGameFluidsThread = new GameFluidsThread(this, mMobsController);
mGameFluidsTimer = new Timer();
- mGameFluidsTimer.scheduleAtFixedRate(mGameFluidsThread, 0, GameFluidsThread.FLUID_UPDATE_INTERVAL_MS);
+ mGameFluidsTimer.scheduleTask(mGameFluidsThread, 0, GameFluidsThread.FLUID_UPDATE_INTERVAL_SEC);
}
public int getWidth() {
@Override
public void dispose() {
- mGameFluidsTimer.cancel();
+ mGameFluidsThread.cancel();
}
}
\ No newline at end of file