X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=core%2Fsrc%2Fru%2Fdeadsoftware%2Fcavedroid%2Fgame%2Fmobs%2FFallingGravel.java;h=e80f91b5e70987b2697fe9005a2d10d6e1841248;hb=1c004c0ce7e183e773b5b486295c25e39732e899;hp=fb567049394d79329a7ced59fb7a770c1224f2e3;hpb=17c1be4c02b27fefa1bf6abd0547ac7e9743d493;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 fb56704..e80f91b 100644 --- a/core/src/ru/deadsoftware/cavedroid/game/mobs/FallingGravel.java +++ b/core/src/ru/deadsoftware/cavedroid/game/mobs/FallingGravel.java @@ -2,10 +2,9 @@ package ru.deadsoftware.cavedroid.game.mobs; 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, @@ -15,18 +14,29 @@ public class FallingGravel extends Mob { /** * 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(); } } @@ -36,8 +46,8 @@ public class FallingGravel extends Mob { } @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); } }