diff --git a/core/src/ru/deadsoftware/cavedroid/game/mobs/FallingGravel.java b/core/src/ru/deadsoftware/cavedroid/game/mobs/FallingGravel.java
index fb567049394d79329a7ced59fb7a770c1224f2e3..e80f91b5e70987b2697fe9005a2d10d6e1841248 100644 (file)
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Vector2;
-import org.jetbrains.annotations.NotNull;
-import ru.deadsoftware.cavedroid.misc.Assets;
-
-import static ru.deadsoftware.cavedroid.GameScreen.GP;
+import ru.deadsoftware.cavedroid.game.GameItems;
+import ru.deadsoftware.cavedroid.game.GameItemsHolder;
+import ru.deadsoftware.cavedroid.game.world.GameWorld;
/**
* Falling gravel is actually a mob, that spawns in place of gravel when there is no block under it,
/**
* Creates a FallingGravel mob at coordinates
+ *
* @param x X in pixels
* @param y Y in pixels
*/
public FallingGravel(float x, float y) {
- super(x, y, 16, 16, Direction.LEFT, Type.GRAVEL);
- move = new Vector2(0, 1);
+ super(x, y, 16, 16, Direction.LEFT, Type.GRAVEL, Integer.MAX_VALUE);
+ mVelocity = new Vector2(0, 1);
+ }
+
+ @Override
+ public float getSpeed() {
+ return 0;
+ }
+
+ @Override
+ public void jump() {
+ // no-op
}
@Override
- public void ai() {
- if (move.isZero()) {
- GP.world.setForeMap(getMapX(), getMiddleMapY(), 11);
+ public void ai(GameWorld gameWorld, GameItemsHolder gameItemsHolder, float delta) {
+ if (mVelocity.isZero()) {
+ gameWorld.setForeMap(getMapX(), getMiddleMapY(), gameItemsHolder.getBlock("gravel"));
kill();
}
}
}
@Override
- public void draw(@NotNull SpriteBatch spriteBatch, float x, float y) {
- spriteBatch.draw(Assets.gravelSprite, x, y);
+ public void draw(SpriteBatch spriteBatch, float x, float y, float delta) {
+ spriteBatch.draw(GameItems.getBlockTex(11), x, y);
}
}