Skip to content

Commit

Permalink
grid 2/n
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaganx0 committed Sep 5, 2023
1 parent 63a3310 commit 049a3bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand All @@ -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();
}

/**
Expand Down Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}

Expand Down

0 comments on commit 049a3bb

Please sign in to comment.