DEADSOFTWARE

Move items to JSON
[cavedroid.git] / core / src / ru / deadsoftware / cavedroid / game / objects / Item.java
index 3d082bf4d8ef46b3232d1ec61eb68633113e6a3f..a619a1babfdcfd94e3c76a2fb86261d88f00055d 100644 (file)
@@ -1,37 +1,33 @@
 package ru.deadsoftware.cavedroid.game.objects;
 
-public class Item {
+import com.badlogic.gdx.graphics.g2d.Sprite;
 
-    private int tex;
-    private int type; // 0 - block, 1 - tool, 2 - other
-    private int block;
-    private String name;
+public class Item {
 
-    public Item(String name, int tex, int type) {
-        this(name, tex, type, -1);
-    }
+    private String name, type;
+    private Sprite tex;
 
-    public Item(String name, int tex, int type, int block) {
+    public Item(String name, String type, Sprite tex) {
         this.name = name;
-        this.tex = tex;
         this.type = type;
-        this.block = block;
+        this.tex = tex;
+        if (this.tex != null) this.tex.flip(false, true);
     }
 
-    public int getTex() {
+    public Sprite getTex() {
         return tex;
     }
 
-    public int getType() {
+    public String getType() {
         return type;
     }
 
-    public int getBlock() {
-        return block;
+    public boolean isBlock() {
+        return type.equals("block");
     }
 
     public String getName() {
         return name;
     }
 
-}
+}
\ No newline at end of file