Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/Team-3-maps-main' into Team-5--E…
Browse files Browse the repository at this point in the history
…conomy
  • Loading branch information
Hasakev committed Sep 6, 2023
2 parents 967c1e8 + f9802dd commit 7dcd272
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
Binary file added source/core/assets/images/ingamebg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public class ForestGameArea extends GameArea {

// Required to load assets before using them
private static final String[] forestTextures = {
"images/ingamebg.png",
"images/projectiles/projectile.png",
"images/box_boy_leaf.png",
"images/background/building1.png",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer;
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer.Cell;
import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer;
import com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile;
import com.badlogic.gdx.math.GridPoint2;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
Expand Down Expand Up @@ -98,19 +99,34 @@ private TiledMapRenderer createRenderer(TiledMap tiledMap, float tileScale) {
}
}

private TiledMap createForestDemoTiles(
GridPoint2 tileSize, TextureRegion grass) {
private TiledMap createForestDemoTiles(GridPoint2 tileSize, TextureRegion grass) {
TiledMap tiledMap = new TiledMap();
TerrainTile grassTile = new TerrainTile(grass);
TiledMapTileLayer layer = new TiledMapTileLayer(MAP_SIZE.x, MAP_SIZE.y, tileSize.x, tileSize.y);

// Create base grass
fillTiles(layer, MAP_SIZE, grassTile);
// Create a background layer
TiledMapTileLayer backgroundLayer = new TiledMapTileLayer(20, 8, tileSize.x, tileSize.y);
TextureRegion backgroundTextureRegion = new TextureRegion(ServiceLocator.getResourceService().getAsset("images/ingamebg.png", Texture.class));

// Create a single cell for the entire background image
Cell cell = new Cell();
cell.setTile(new StaticTiledMapTile(backgroundTextureRegion));
backgroundLayer.setCell(0, 0, cell);

tiledMap.getLayers().add(backgroundLayer);

// Create a grass layer
TerrainTile grassTile = new TerrainTile(grass);
TiledMapTileLayer grassLayer = new TiledMapTileLayer(20, 8, tileSize.x, tileSize.y);
fillTiles(grassLayer, new GridPoint2(20, 8), grassTile);
tiledMap.getLayers().add(grassLayer);

tiledMap.getLayers().add(layer);
return tiledMap;
}






private static void fillTiles(TiledMapTileLayer layer, GridPoint2 mapSize, TerrainTile tile) {
BitmapFont font = new BitmapFont();
TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
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, 5f);
private static final Vector2 CAMERA_POSITION = new Vector2(10f, 5.64f);

private final GdxGame game;
private final Renderer renderer;
Expand Down

0 comments on commit 7dcd272

Please sign in to comment.