diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameItems.java b/core/src/ru/deadsoftware/cavedroid/game/GameItems.java
index 87bb3d66a0cd4c0ac3a1196dc115d8cdf4f88fa6..61b3af736653e9097b30df8f49ca1d6c0cfd280d 100644 (file)
boolean fluid = (block.has("fluid") && block.getBoolean("fluid"));
String meta = (block.has("meta") ? block.getString("meta") : "");
String texture = (block.has("texture") ? block.getString("texture") : key);
+ Sprite sprite = key.equals("none") ? null :
+ new Sprite(new Texture(Gdx.files.internal("textures/blocks/" + texture + ".png")));
+ Block newBlock = new Block(
+ left,
+ top,
+ right,
+ bottom,
+ hp,
+ drop,
+ collision,
+ background,
+ transparent,
+ blockRequired,
+ fluid,
+ meta,
+ sprite
+ );
+
blocksIds.put(key, blocks.size);
- blocks.put(key, new Block(left, top, right, bottom, hp, drop, collision,
- background, transparent, blockRequired, fluid, meta,
- key.equals("none") ? null :
- new Sprite(new Texture(Gdx.files.internal("textures/" + texture + ".png")))));
+ blocks.put(key, newBlock);
block = block.next();
}
while (item != null) {
String name = (item.has("name") ? item.getString("name") : key);
String type = (item.has("type") ? item.getString("type") : "item");
String texture = (item.has("texture") ? item.getString("texture") : key);
+ Sprite sprite = type.equals("block") ? null :
+ new Sprite(new Texture(Gdx.files.internal("textures/items/" + texture + ".png")));
itemsIds.put(key, items.size);
- items.put(key, new Item(name, type, type.equals("block") ? null :
- new Sprite(new Texture(Gdx.files.internal("textures/" + texture + ".png")))));
+ items.put(key, new Item(name, type, sprite));
item = item.next();
}
}