X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=core%2Fsrc%2Fru%2Fdeadsoftware%2Fcavedroid%2Fgame%2Fmobs%2FFallingGravel.java;h=fb567049394d79329a7ced59fb7a770c1224f2e3;hb=17c1be4c02b27fefa1bf6abd0547ac7e9743d493;hp=fe4e46af1b855628fcf96836fe01c4d2f998c8bc;hpb=44bd000cd15bf9713453a279840e133416fea998;p=cavedroid.git diff --git a/core/src/ru/deadsoftware/cavedroid/game/mobs/FallingGravel.java b/core/src/ru/deadsoftware/cavedroid/game/mobs/FallingGravel.java index fe4e46a..fb56704 100644 --- a/core/src/ru/deadsoftware/cavedroid/game/mobs/FallingGravel.java +++ b/core/src/ru/deadsoftware/cavedroid/game/mobs/FallingGravel.java @@ -2,9 +2,11 @@ package ru.deadsoftware.cavedroid.game.mobs; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Vector2; -import ru.deadsoftware.cavedroid.game.GameItems; +import org.jetbrains.annotations.NotNull; import ru.deadsoftware.cavedroid.misc.Assets; +import static ru.deadsoftware.cavedroid.GameScreen.GP; + /** * Falling gravel is actually a mob, that spawns in place of gravel when there is no block under it, * falls down to the next block and becomes a block of gravel again. @@ -17,12 +19,16 @@ public class FallingGravel extends Mob { * @param y Y in pixels */ public FallingGravel(float x, float y) { - super(x, y, 16, 16, 0); - mov = new Vector2(0, 1); + super(x, y, 16, 16, Direction.LEFT, Type.GRAVEL); + move = new Vector2(0, 1); } @Override public void ai() { + if (move.isZero()) { + GP.world.setForeMap(getMapX(), getMiddleMapY(), 11); + kill(); + } } @Override @@ -30,13 +36,8 @@ public class FallingGravel extends Mob { } @Override - public void draw(SpriteBatch spriteBatch, float x, float y) { - spriteBatch.draw(Assets.fallingGravelSprite, x, y); - } - - @Override - public int getType() { - return 11; + public void draw(@NotNull SpriteBatch spriteBatch, float x, float y) { + spriteBatch.draw(Assets.gravelSprite, x, y); } }