diff --git a/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java b/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java index 8399a960a..14c263a17 100644 --- a/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java +++ b/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java @@ -229,11 +229,6 @@ private void spawnBuilding2() { private void spawnMountains() { ArrayList fixedPositions = new ArrayList<>(); //Generating ArrayList - fixedPositions.add(new GridPoint2(5, 8)); - fixedPositions.add(new GridPoint2(12, 4)); - fixedPositions.add(new GridPoint2(20, 10)); - fixedPositions.add(new GridPoint2(33, 17)); - for (GridPoint2 fixedPos : fixedPositions) { Entity tree = ObstacleFactory.createMountain(); spawnEntityAt(tree, fixedPos, true, false); 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 8899f9757..08210ea64 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 @@ -27,7 +27,7 @@ /** Factory for creating game terrains. */ public class TerrainFactory { - private static final GridPoint2 MAP_SIZE = new GridPoint2(40, 21); + public static final GridPoint2 MAP_SIZE = new GridPoint2(20, 8); private static OrthographicCamera camera; @@ -76,7 +76,7 @@ public TerrainComponent createTerrain(TerrainType terrainType) { case FOREST_DEMO: TextureRegion orthoGrass = new TextureRegion(resourceService.getAsset("images/terrain_use.png", Texture.class)); - return createForestDemoTerrain(0.5f, orthoGrass); + return createForestDemoTerrain(1f, orthoGrass); default: return null; @@ -114,8 +114,6 @@ private TiledMap createForestDemoTiles( } 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(); 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 2b4404edd..738e632e8 100644 --- a/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java +++ b/source/core/src/main/com/csse3200/game/screens/MainGameScreen.java @@ -75,16 +75,18 @@ public class MainGameScreen extends ScreenAdapter { public MainGameScreen(GdxGame game) { this.game = game; + camera = new OrthographicCamera(); + camera.setToOrtho(false, viewportWidth, viewportHeight); + camera.position.set(viewportWidth / 2, viewportHeight / 2, 0); + batch = new SpriteBatch(); + Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888); pixmap.setColor(1, 1, 1, 1); pixmap.fill(); whiteTexture = new Texture(pixmap); pixmap.dispose(); - camera = new OrthographicCamera(); - camera.setToOrtho(false, viewportWidth, viewportHeight); - camera.position.set(viewportWidth / 2, viewportHeight / 2, 0); Viewport viewport = new ScreenViewport(camera); stage = new Stage(viewport, new SpriteBatch()); @@ -93,8 +95,8 @@ public MainGameScreen(GdxGame game) { TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle(); textButtonStyle.font = font; textButtonStyle.fontColor = Color.WHITE; - for (int y = 0; y < 8; y++) { - for (int x = 0; x < 20; x++) { + for (int y = 0; y < TerrainFactory.MAP_SIZE.y; y++) { + for (int x = 0; x < TerrainFactory.MAP_SIZE.x; x++) { TextButton button = new TextButton("" + x + y * 20, textButtonStyle); stage.addActor(button); } @@ -135,14 +137,18 @@ public MainGameScreen(GdxGame game) { public void render(float delta) { physicsEngine.update(); ServiceLocator.getEntityService().update(); + + batch.setProjectionMatrix(camera.combined); batch.begin(); batch.draw(backgroundTexture, 0, 0, viewportWidth, viewportHeight); batch.end(); + + batch.setProjectionMatrix(camera.combined); batch.begin(); for (int i = 0; i < NUM_LANES; i++) { float yPosition = i * LANE_HEIGHT; - batch.draw(whiteTexture, 0, yPosition, viewportWidth, 2); + batch.draw(whiteTexture, 0, yPosition, viewportWidth, 5); } batch.end();