diff --git a/source/core/src/main/com/csse3200/game/areas/terrain/TerrainFactory.java b/source/core/src/main/com/csse3200/game/areas/terrain/TerrainFactory.java index eb4d6727f..8899f9757 100644 --- a/source/core/src/main/com/csse3200/game/areas/terrain/TerrainFactory.java +++ b/source/core/src/main/com/csse3200/game/areas/terrain/TerrainFactory.java @@ -30,7 +30,7 @@ public class TerrainFactory { private static final GridPoint2 MAP_SIZE = new GridPoint2(40, 21); - private final OrthographicCamera camera; + private static OrthographicCamera camera; private final TerrainOrientation orientation; @@ -44,6 +44,10 @@ public class TerrainFactory { */ public TerrainFactory(CameraComponent cameraComponent) { this(cameraComponent, TerrainOrientation.ORTHOGONAL); + camera.position.set(viewportWidth / 2f, viewportHeight / 2f , 10); + Viewport viewport = new ScreenViewport(camera); + viewport.update(viewportWidth, viewportHeight, true); + camera.update(); } /** @@ -109,30 +113,17 @@ private TiledMap createForestDemoTiles( return tiledMap; } - - private static void fillTiles(TiledMapTileLayer layer, GridPoint2 mapSize, TerrainTile tile) { mapSize.x= 20; mapSize.y= 8; - - - for (int x = 0; x < mapSize.x; x++) { for (int y = 0; y < mapSize.y; y++) { Cell cell = new Cell(); cell.setTile(tile); layer.setCell(x, y, cell); - - } } } - - /** - * This enum should contain the different terrains in your game, e.g. forest, cave, home, all with - * the same oerientation. But for demonstration purposes, the base code has the same level in 3 - * different orientations. - */ public enum TerrainType { FOREST_DEMO } diff --git a/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java b/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java index a188a1073..2b4404edd 100644 --- a/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java +++ b/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java @@ -51,7 +51,7 @@ public class MainGameScreen extends ScreenAdapter { private static final Logger logger = LoggerFactory.getLogger(MainGameScreen.class); private static final String[] mainGameTextures = {"images/heart.png"}; - private static final Vector2 CAMERA_POSITION = new Vector2(10f, 7.5f); + private static final Vector2 CAMERA_POSITION = new Vector2(10f, 5f); private final GdxGame game; private final Renderer renderer; @@ -188,7 +188,7 @@ private void loadAssets() { logger.debug("Loading assets"); ResourceService resourceService = ServiceLocator.getResourceService(); resourceService.loadTextures(mainGameTextures); - backgroundTexture = new Texture("images/background/background1.png"); // Load the background image + backgroundTexture = new Texture("images/Dusty_MoonBG.png"); // Load the background image ServiceLocator.getResourceService().loadAll(); }