List of usage examples for com.badlogic.gdx.maps MapLayer setVisible
public void setVisible(boolean visible)
From source file:com.jupiter.europa.world.Level.java
License:Open Source License
private void setMap(TiledMap map) { this.map = map; // Get metrics this.tileWidth = map.getProperties().get(TILE_WIDTH_KEY, Integer.class); this.tileHeight = map.getProperties().get(TILE_HEIGHT_KEY, Integer.class); this.mapWidth = map.getProperties().get(MAP_WIDTH_KEY, Integer.class); this.mapHeight = map.getProperties().get(MAP_HEIGHT_KEY, Integer.class); this.pixelWidth = this.getTileWidth() * this.getMapWidth(); this.pixelHeight = this.getTileHeight() * this.getMapHeight(); // Set all layers visible, except for the informational layers for (MapLayer layer : this.map.getLayers()) { String layerName = layer.getName(); if (layerName.equalsIgnoreCase(ENTITY_LAYER_NAME)) { // Get the entity layer from the map this.entityLayer = new EntityLayer(layer, new Size(this.getMapWidth(), this.getMapHeight()), this); } else if (layerName.equalsIgnoreCase(COLLISION_LAYER_NAME)) { this.collision = this.getCollisionFrom(layer); } else if (layerName.equalsIgnoreCase(ZONE_LAYER_NAME)) { } else {//from ww w . j av a2 s . c o m layer.setVisible(true); } } // Get the type of music from the map if (map.getProperties().containsKey(MUSIC_PROPERTY)) { this.musicType = map.getProperties().get(MUSIC_PROPERTY, String.class); } }
From source file:org.csproduction.descendant.screen.GameScreen.java
private void createMap() { MapLayer layer = map.getLayers().get("collision"); layer.setVisible(false); BodyDef bdef = new BodyDef(); bdef.type = BodyType.StaticBody;/*from w w w . ja v a 2 s . c o m*/ FixtureDef fdef = new FixtureDef(); fdef.filter.categoryBits = BIT_GROUND; fdef.filter.maskBits = BIT_PLAYER | BIT_PLAYER2 | BIT_SPELL | BIT_SPELL2; fdef.friction = 1f; PolygonShape s = new PolygonShape(); for (MapObject mo : layer.getObjects()) { boolean[] groundArray = new boolean[2]; float x = (Float) mo.getProperties().get("x"); float y = (Float) mo.getProperties().get("y"); float width = (Float) mo.getProperties().get("width"); float height = (Float) mo.getProperties().get("height"); bdef.position.set((x + width / 2) / PPM, (y + height / 2) / PPM); s.setAsBox(width / 2 / PPM, height / 2 / PPM); fdef.shape = s; world.createBody(bdef).createFixture(fdef).setUserData(groundArray); } s.dispose(); int tileSize = (Integer) map.getProperties().get("tilewidth"); int mapWidth = (Integer) map.getProperties().get("width") * tileSize; int mapHeight = (Integer) map.getProperties().get("height") * tileSize; gameCam.setBounds(0, mapWidth, 0, mapHeight); }