diff --git a/core/src/com/mygdx/game/Character/InputController.java b/core/src/com/mygdx/game/Character/InputController.java index 0fa73b5..7a7ed08 100644 --- a/core/src/com/mygdx/game/Character/InputController.java +++ b/core/src/com/mygdx/game/Character/InputController.java @@ -4,15 +4,12 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.g2d.Animation; -import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.mygdx.game.Restrictions; public class InputController implements Restrictions { private OrthographicCamera cam; private Player player; - private Animation animation; - float pressTime, unpressTime; int i = 0; public InputController(OrthographicCamera cam, Player player) { diff --git a/core/src/com/mygdx/game/Character/Player.java b/core/src/com/mygdx/game/Character/Player.java index f2d04db..0b66846 100644 --- a/core/src/com/mygdx/game/Character/Player.java +++ b/core/src/com/mygdx/game/Character/Player.java @@ -8,7 +8,7 @@ import com.badlogic.gdx.utils.Array; import com.mygdx.game.Restrictions; public class Player implements Restrictions { - private int x,y = 0; + private int x,y; private String spriteName; private TextureAtlas textureAtlas; private Animation animation; @@ -43,18 +43,10 @@ public class Player implements Restrictions { return x; } - public void setX(int x) { - this.x = x; - } - public int getY() { return y; } - public void setY(int y) { - this.y = y; - } - public void addX(int x){ this.x += x; } @@ -67,10 +59,6 @@ public class Player implements Restrictions { return spriteName; } - public void setSpriteName(String tempSpriteName) { - spriteName = tempSpriteName; - } - TextureAtlas getTextureAtlas() { return textureAtlas; } diff --git a/core/src/com/mygdx/game/Dimension/Chunks.java b/core/src/com/mygdx/game/Dimension/Chunks.java index 08e7de0..e1e71e0 100644 --- a/core/src/com/mygdx/game/Dimension/Chunks.java +++ b/core/src/com/mygdx/game/Dimension/Chunks.java @@ -27,7 +27,4 @@ public class Chunks { return blocks; } - public void setBlocks(HashMap, Block> blocks) { - this.blocks = blocks; - } } diff --git a/core/src/com/mygdx/game/Dimension/Superchunks.java b/core/src/com/mygdx/game/Dimension/Superchunks.java index 33ce86f..f3e5f49 100644 --- a/core/src/com/mygdx/game/Dimension/Superchunks.java +++ b/core/src/com/mygdx/game/Dimension/Superchunks.java @@ -9,7 +9,7 @@ import static com.mygdx.game.Restrictions.CHUNK_SIZE; import static com.mygdx.game.Restrictions.SUPER_CHUNK_SIZE; public class Superchunks { - public static HashMap overworld = new HashMap<>(); + public static HashMap, Chunks> overworld = new HashMap<>(); private Superchunks() {} diff --git a/core/src/com/mygdx/game/Dimension/WorldRenderer.java b/core/src/com/mygdx/game/Dimension/WorldRenderer.java index 49853d6..7287954 100644 --- a/core/src/com/mygdx/game/Dimension/WorldRenderer.java +++ b/core/src/com/mygdx/game/Dimension/WorldRenderer.java @@ -24,7 +24,6 @@ public class WorldRenderer implements Restrictions { inputController = new InputController(this.cam, this.player); } - @SuppressWarnings("unchecked") public void drawWorld(Batch batch) { for (Pair worldpair: Superchunks.overworld.keySet()) { Chunks chunks = Superchunks.overworld.get(worldpair); diff --git a/core/src/com/mygdx/game/Main.java b/core/src/com/mygdx/game/Main.java index f302180..97e8087 100644 --- a/core/src/com/mygdx/game/Main.java +++ b/core/src/com/mygdx/game/Main.java @@ -20,36 +20,20 @@ public class Main extends ApplicationAdapter { private SpriteBatch batch; private WorldRenderer worldRenderer; private GUI gui; - private Mouse mouse; - private OrthographicCamera cam; - private Stage stage; - private Table table; private Label label; float physicsUpdateSpeed = 1/60f; //how often you want to do a physics-update, in this case every 1/60th of a sec float timeSinceLastUpdate = 0f; //accumulator - private Player player; @Override public void create () { Gdx.graphics.setWindowedMode(1024,576); - cam = new OrthographicCamera(VIEWPORT_WIDTH,VIEWPORT_HEIGHT); - - // - stage = new Stage(); - Gdx.input.setInputProcessor(stage); - - table = new Table(); - table.add(label); - table.setFillParent(true); - stage.addActor(table); - - table.setDebug(true); - + OrthographicCamera cam = new OrthographicCamera(VIEWPORT_WIDTH, VIEWPORT_HEIGHT); + drawGUI(); //Starting location of the player - player = new Player(0,0, cam); + Player player = new Player(0, 0, cam); cam.translate((float) TILE_SIZE / 2, (float) TILE_SIZE / 2); cam.zoom = 25f; @@ -57,10 +41,23 @@ public class Main extends ApplicationAdapter { Superchunks.generateWithPlayer(player); - mouse = new Mouse(player); - worldRenderer = new WorldRenderer(player, mouse,cam); + Mouse mouse = new Mouse(player); + worldRenderer = new WorldRenderer(player, mouse, cam); batch = new SpriteBatch(); - gui = new GUI(mouse,cam); + gui = new GUI(mouse, cam); + } + + public void drawGUI() { + // + Stage stage = new Stage(); + Gdx.input.setInputProcessor(stage); + + Table table = new Table(); + table.add(label); + table.setFillParent(true); + stage.addActor(table); + + table.setDebug(true); } @Override