diff --git a/core/src/netwerkprog/game/client/game/map/MapRenderer.java b/core/src/netwerkprog/game/client/game/map/MapRenderer.java index 37457e2..a5082d7 100644 --- a/core/src/netwerkprog/game/client/game/map/MapRenderer.java +++ b/core/src/netwerkprog/game/client/game/map/MapRenderer.java @@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; +import com.badlogic.gdx.maps.tiled.TiledMapTile; import netwerkprog.game.util.graphics.Renderable; import com.badlogic.gdx.graphics.g2d.TextureRegion; @@ -22,6 +23,8 @@ public class MapRenderer implements Renderable { public static TextureRegion WALL_TILE; public static TextureRegion PATH_TILE; + private TextureRegion[][] sprites; + public MapRenderer(Map map, int tileWidth, SpriteBatch batch, OrthographicCamera camera) { this.map = map; @@ -35,10 +38,12 @@ public class MapRenderer implements Renderable { private void makeTiles() { Texture texture = new Texture(Gdx.files.internal(tilePath)); TextureRegion[][] tiles = TextureRegion.split(texture, 32, 32); + FLOOR_TILE = tiles[1][6]; WALL_TILE = tiles[0][4]; PATH_TILE = tiles[4][6]; + this.sprites = new TextureRegion[map.getHeight()][map.getWidth()]; } public int getTileWidth() { @@ -69,8 +74,8 @@ public class MapRenderer implements Renderable { batch.draw(FLOOR_TILE, x, y); } else if (map.get(row, col) == '#') { batch.draw(WALL_TILE, x, y); - } else if (map.get(row,col) == 'x') { - batch.draw(PATH_TILE,x,y); + } else if (map.get(row, col) == 'x') { + batch.draw(PATH_TILE, x, y); } x += 32; } @@ -92,4 +97,8 @@ public class MapRenderer implements Renderable { cam.update(); batch.setProjectionMatrix(cam.combined); } + + public TextureRegion[][] getSprites() { + return sprites; + } } diff --git a/core/src/netwerkprog/game/client/map/GameInputProcessor.java b/core/src/netwerkprog/game/client/map/GameInputProcessor.java index ee33d38..ebd2fcf 100644 --- a/core/src/netwerkprog/game/client/map/GameInputProcessor.java +++ b/core/src/netwerkprog/game/client/map/GameInputProcessor.java @@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.utils.TimeUtils; import netwerkprog.game.client.MainGame; +import netwerkprog.game.util.application.InputTransform; import java.util.ArrayList; import java.util.Arrays; @@ -119,6 +120,8 @@ public class GameInputProcessor implements InputProcessor { @Override public boolean touchDown(int screenX, int screenY, int pointer, int button) { + float pointerX = InputTransform.getCursorToModelX((int)game.getScreenWidth(), (int)game.getScreenWidth(),screenX); + float pointerY = InputTransform.getCursorToModelY((int)game.getScreenHeight(),(int)game.getScreenHeight(),screenY); return false; } diff --git a/core/src/netwerkprog/game/client/map/Tile.java b/core/src/netwerkprog/game/client/map/Tile.java new file mode 100644 index 0000000..1a5ed84 --- /dev/null +++ b/core/src/netwerkprog/game/client/map/Tile.java @@ -0,0 +1,20 @@ +package netwerkprog.game.client.map; + +import com.badlogic.gdx.graphics.g2d.TextureRegion; + +public class Tile { + private TextureRegion textureRegion; + private int xPos; + private int yPos; + + public Tile(TextureRegion textureRegion, int xPos, int yPos) { + this.textureRegion = textureRegion; + this.xPos = xPos; + this.yPos = yPos; + } + + public boolean contains(int x, int y) { + + return false; + } +}