DEADSOFTWARE

Fix hitting animation
[cavedroid.git] / core / src / ru / deadsoftware / cavedroid / game / world / GameWorld.java
index 31d842b331e85768e3ff9369c26e93c0160c361b..43fc1641033616ec6645795ead6daed286dc82e3 100644 (file)
@@ -1,6 +1,7 @@
 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;
@@ -13,7 +14,6 @@ import ru.deadsoftware.cavedroid.game.objects.DropController;
 
 import javax.annotation.CheckForNull;
 import javax.inject.Inject;
-import java.util.Timer;
 
 @GameScope
 public class GameWorld implements Disposable {
@@ -63,7 +63,7 @@ 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() {
@@ -213,7 +213,7 @@ public class GameWorld implements Disposable {
         if (getForeMap(x, y) == 10) {
             if (!hasForeAt(x, y + 1) || !getForeMapBlock(x, y + 1).hasCollision()) {
                 setForeMap(x, y, 0);
-                mMobsController.addMob(FallingSand.class, x * 16, y * 16);
+                mMobsController.addMob(new FallingSand(x * 16, y * 16));
                 updateBlock(x, y - 1);
             }
         }
@@ -221,7 +221,7 @@ public class GameWorld implements Disposable {
         if (getForeMap(x, y) == 11) {
             if (!hasForeAt(x, y + 1) || !getForeMapBlock(x, y + 1).hasCollision()) {
                 setForeMap(x, y, 0);
-                mMobsController.addMob(FallingGravel.class, x * 16, y * 16);
+                mMobsController.addMob(new FallingGravel(x * 16, y * 16));
                 updateBlock(x, y - 1);
             }
         }
@@ -254,6 +254,6 @@ public class GameWorld implements Disposable {
 
     @Override
     public void dispose() {
-        mGameFluidsTimer.cancel();
+        mGameFluidsThread.cancel();
     }
 }
\ No newline at end of file