summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 115eb3d)
raw | patch | inline | side by side (parent: 115eb3d)
author | fred-boy <fredboy@protonmail.com> | |
Sat, 28 Sep 2019 17:42:30 +0000 (00:42 +0700) | ||
committer | fred-boy <fredboy@protonmail.com> | |
Sun, 29 Sep 2019 04:39:18 +0000 (11:39 +0700) |
diff --git a/core/src/ru/deadsoftware/cavedroid/game/mobs/FallingGravel.java b/core/src/ru/deadsoftware/cavedroid/game/mobs/FallingGravel.java
index fe4e46af1b855628fcf96836fe01c4d2f998c8bc..7b23d4d619b785177c7bbbe2c25453aaadd7d022 100644 (file)
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Vector2;
-import ru.deadsoftware.cavedroid.game.GameItems;
import ru.deadsoftware.cavedroid.misc.Assets;
/**
@Override
public void draw(SpriteBatch spriteBatch, float x, float y) {
- spriteBatch.draw(Assets.fallingGravelSprite, x, y);
+ spriteBatch.draw(Assets.gravelSprite, x, y);
}
@Override
diff --git a/core/src/ru/deadsoftware/cavedroid/game/mobs/FallingSand.java b/core/src/ru/deadsoftware/cavedroid/game/mobs/FallingSand.java
index 315fcfc6a92fa3e2cf8f53122d6c518c50ad1358..ac20ffb9bd82574ffbc4692b661c550f05fa81f8 100644 (file)
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Vector2;
-import ru.deadsoftware.cavedroid.game.GameItems;
import ru.deadsoftware.cavedroid.misc.Assets;
/**
@Override
public void draw(SpriteBatch spriteBatch, float x, float y) {
- spriteBatch.draw(Assets.fallingSandSprite, x, y);
+ spriteBatch.draw(Assets.sandSprite, x, y);
}
@Override
diff --git a/core/src/ru/deadsoftware/cavedroid/misc/Assets.java b/core/src/ru/deadsoftware/cavedroid/misc/Assets.java
index d86d3f8a17942e2a1d0301e0c7f2ec8399aee166..944dec0cac70dd82b77d5c9a6d2f782b9e64f81b 100644 (file)
public static final JsonReader jsonReader = new JsonReader();
private static final GlyphLayout glyphLayout = new GlyphLayout();
-
- static BitmapFont minecraftFont;
+ static final BitmapFont minecraftFont = new BitmapFont(Gdx.files.internal("font.fnt"), true);;
public static final Sprite[][] playerSprite = new Sprite[2][4];
public static final Sprite[][] pigSprite = new Sprite[2][2];
- public static Sprite fallingSandSprite;
- public static Sprite fallingGravelSprite;
public static final HashMap<String, TextureRegion> textureRegions = new HashMap<>();
public static final ArrayMap<String, Rectangle> guiMap = new ArrayMap<>();
+ public static final Sprite sandSprite = flippedSprite(new Texture((Gdx.files.internal("textures/blocks/sand.png"))));
+ public static final Sprite gravelSprite = flippedSprite(new Texture((Gdx.files.internal("textures/blocks/gravel.png"))));
private static TextureRegion flippedRegion(Texture texture, int x, int y, int width, int height) {
return new TextureRegion(texture, x, y + height, width, -height);
pigSprite[1][1] = flippedSprite(new TextureRegion(pigTex, 16, 26, 12, 12));
}
- private static void loadFallingBlocks() {
- fallingSandSprite = flippedSprite(new Texture((Gdx.files.internal("textures/blocks/sand.png"))));
- fallingGravelSprite = flippedSprite(new Texture((Gdx.files.internal("textures/blocks/gravel.png"))));
- }
-
/**
* Loads texture names and sizes from <b>json/texture_regions.json</b>, cuts them to TextureRegions
* and puts to {@link #textureRegions} HashMap
}
public static void load() {
- minecraftFont = new BitmapFont(Gdx.files.internal("font.fnt"), true);
minecraftFont.getData().setScale(.375f);
loadPlayer();
loadPig();
- loadFallingBlocks();
loadJSON();
}