Example usage for com.badlogic.gdx.maps.tiled TiledMap getProperties

List of usage examples for com.badlogic.gdx.maps.tiled TiledMap getProperties

Introduction

In this page you can find the example usage for com.badlogic.gdx.maps.tiled TiledMap getProperties.

Prototype

public MapProperties getProperties() 

Source Link

Usage

From source file:com.betmansmall.game.gameLogic.mapLoader.MapLoader.java

License:Apache License

/** Loads the map data, given the XML root element and an {@link ImageResolver} used to return the tileset Textures
 * @param root the XML root element//w w  w  . j  a va 2s. com
 * @param tmxFile the Filehandle of the tmx file
 * @param imageResolver the {@link ImageResolver}
 * @return the {@link TiledMap} */
protected TiledMap loadTilemap(Element root, FileHandle tmxFile, ImageResolver imageResolver) {
    TiledMap map = new TiledMap();

    String mapOrientation = root.getAttribute("orientation", null);
    int mapWidth = root.getIntAttribute("width", 0);
    int mapHeight = root.getIntAttribute("height", 0);
    int tileWidth = root.getIntAttribute("tilewidth", 0);
    int tileHeight = root.getIntAttribute("tileheight", 0);
    int hexSideLength = root.getIntAttribute("hexsidelength", 0);
    String staggerAxis = root.getAttribute("staggeraxis", null);
    String staggerIndex = root.getAttribute("staggerindex", null);
    String mapBackgroundColor = root.getAttribute("backgroundcolor", null);

    MapProperties mapProperties = map.getProperties();
    if (mapOrientation != null) {
        mapProperties.put("orientation", mapOrientation);
    }
    mapProperties.put("width", mapWidth);
    mapProperties.put("height", mapHeight);
    mapProperties.put("tilewidth", tileWidth);
    mapProperties.put("tileheight", tileHeight);
    mapProperties.put("hexsidelength", hexSideLength);
    if (staggerAxis != null) {
        mapProperties.put("staggeraxis", staggerAxis);
    }
    if (staggerIndex != null) {
        mapProperties.put("staggerindex", staggerIndex);
    }
    if (mapBackgroundColor != null) {
        mapProperties.put("backgroundcolor", mapBackgroundColor);
    }
    mapTileWidth = tileWidth;
    mapTileHeight = tileHeight;
    mapWidthInPixels = mapWidth * tileWidth;
    mapHeightInPixels = mapHeight * tileHeight;

    if (mapOrientation != null) {
        if ("staggered".equals(mapOrientation)) {
            if (mapHeight > 1) {
                mapWidthInPixels += tileWidth / 2;
                mapHeightInPixels = mapHeightInPixels / 2 + tileHeight / 2;
            }
        }
    }

    Element properties = root.getChildByName("properties");
    if (properties != null) {
        loadProperties(map.getProperties(), properties);
    }
    Array<Element> tilesets = root.getChildrenByName("tileset");
    for (Element element : tilesets) {
        loadTileSet(map, element, tmxFile, imageResolver);
        root.removeChild(element);
    }
    for (int i = 0, j = root.getChildCount(); i < j; i++) {
        Element element = root.getChild(i);
        String name = element.getName();
        if (name.equals("layer")) {
            loadTileLayer(map, element);
        } else if (name.equals("objectgroup")) {
            loadObjectGroup(map, element);
        } else if (name.equals("imagelayer")) {
            loadImageLayer(map, element, tmxFile, imageResolver);
        }
    }
    return map;
}

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  www  .  ja  v a 2 s . co 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:com.skettios.loader.TmxMapLoaderFixed.java

License:Apache License

/**
 * Loads the map data, given the XML root element and an {@link ImageResolver} used to return the tileset Textures
 *
 * @param root          the XML root element
 * @param tmxFile       the Filehandle of the tmx file
 * @param imageResolver the {@link ImageResolver}
 * @return the {@link TiledMap}/*from  ww w  . j  a  v a 2  s.c o  m*/
 */
protected TiledMap loadTilemap(Element root, FileHandle tmxFile, ImageResolver imageResolver) {
    TiledMap map = new TiledMap();

    String mapOrientation = root.getAttribute("orientation", null);
    int mapWidth = root.getIntAttribute("width", 0);
    int mapHeight = root.getIntAttribute("height", 0);
    int tileWidth = root.getIntAttribute("tilewidth", 0);
    int tileHeight = root.getIntAttribute("tileheight", 0);
    String mapBackgroundColor = root.getAttribute("backgroundcolor", null);

    MapProperties mapProperties = map.getProperties();
    if (mapOrientation != null) {
        mapProperties.put("orientation", mapOrientation);
    }
    mapProperties.put("width", mapWidth);
    mapProperties.put("height", mapHeight);
    mapProperties.put("tilewidth", tileWidth);
    mapProperties.put("tileheight", tileHeight);
    if (mapBackgroundColor != null) {
        mapProperties.put("backgroundcolor", mapBackgroundColor);
    }
    mapTileWidth = tileWidth;
    mapTileHeight = tileHeight;
    mapWidthInPixels = mapWidth * tileWidth;
    mapHeightInPixels = mapHeight * tileHeight;

    if (mapOrientation != null) {
        if ("staggered".equals(mapOrientation)) {
            if (mapHeight > 1) {
                mapWidthInPixels += tileWidth / 2;
                mapHeightInPixels = mapHeightInPixels / 2 + tileHeight / 2;
            }
        }
    }

    Element properties = root.getChildByName("properties");
    if (properties != null) {
        loadProperties(map.getProperties(), properties);
    }
    Array<Element> tilesets = root.getChildrenByName("tileset");
    for (Element element : tilesets) {
        loadTileSet(map, element, tmxFile, imageResolver);
        root.removeChild(element);
    }
    for (int i = 0, j = root.getChildCount(); i < j; i++) {
        Element element = root.getChild(i);
        String name = element.getName();
        if (name.equals("layer")) {
            loadTileLayer(map, element);
        } else if (name.equals("objectgroup")) {
            loadObjectGroup(map, element);
        } else if (name.equals("imagelayer")) {
            loadImageLayer(map, element, tmxFile, imageResolver);
        }
    }
    return map;
}

From source file:com.trueMagic.maps.sectionDefinition.MapSection.java

public MapSection(TiledMap map) {
    this.map = map;
    this.ground = (TiledMapTileLayer) map.getLayers().get("Ground");

    openings = new ArrayList<SectionOpening>();

    MapProperties properties = map.getProperties();

    String isBossString = properties.get("isBoss", String.class);
    isBoss = isBossString.equalsIgnoreCase("true");

    String biomeString = properties.get("biome", String.class);
    biome = SectionBiome.valueOf(biomeString);

    parseOpenings(properties.get("openings", String.class), openings);

}

From source file:de.bitowl.advent.game2.MyAtlasTmxMapLoader.java

License:Apache License

protected TiledMap loadMap(Element root, FileHandle tmxFile, AtlasResolver resolver,
        AtlasTiledMapLoaderParameters parameter) {
    TiledMap map = new TiledMap();

    String mapOrientation = root.getAttribute("orientation", null);
    int mapWidth = root.getIntAttribute("width", 0);
    int mapHeight = root.getIntAttribute("height", 0);
    int tileWidth = root.getIntAttribute("tilewidth", 0);
    int tileHeight = root.getIntAttribute("tileheight", 0);
    String mapBackgroundColor = root.getAttribute("backgroundcolor", null);

    MapProperties mapProperties = map.getProperties();
    if (mapOrientation != null) {
        mapProperties.put("orientation", mapOrientation);
    }/*  ww  w .  j  a v  a2  s .c om*/
    mapProperties.put("width", mapWidth);
    mapProperties.put("height", mapHeight);
    mapProperties.put("tilewidth", tileWidth);
    mapProperties.put("tileheight", tileHeight);
    if (mapBackgroundColor != null) {
        mapProperties.put("backgroundcolor", mapBackgroundColor);
    }

    mapTileWidth = tileWidth;
    mapTileHeight = tileHeight;
    mapWidthInPixels = mapWidth * tileWidth;
    mapHeightInPixels = mapHeight * tileHeight;

    for (int i = 0, j = root.getChildCount(); i < j; i++) {
        Element element = root.getChild(i);
        String elementName = element.getName();
        if (elementName.equals("properties")) {
            loadProperties(map.getProperties(), element);
        } else if (elementName.equals("tileset")) {
            loadTileset(map, element, tmxFile, resolver, parameter);
        } else if (elementName.equals("layer")) {
            loadTileLayer(map, element);
        } else if (elementName.equals("objectgroup")) {
            loadObjectGroup(map, element);
        }
    }
    return map;
}

From source file:de.bitowl.advent.game2.MyAtlasTmxMapLoader.java

License:Apache License

protected void loadTileset(TiledMap map, Element element, FileHandle tmxFile, AtlasResolver resolver,
        AtlasTiledMapLoaderParameters parameter) {
    if (element.getName().equals("tileset")) {
        String name = element.get("name", null);
        int firstgid = element.getIntAttribute("firstgid", 1);
        int tilewidth = element.getIntAttribute("tilewidth", 0);
        int tileheight = element.getIntAttribute("tileheight", 0);
        int spacing = element.getIntAttribute("spacing", 0);
        int margin = element.getIntAttribute("margin", 0);
        String source = element.getAttribute("source", null);

        String imageSource = "";
        int imageWidth = 0, imageHeight = 0;

        FileHandle image = null;// www .  j av  a  2 s.c  om
        if (source != null) {
            FileHandle tsx = getRelativeFileHandle(tmxFile, source);
            try {
                element = xml.parse(tsx);
                name = element.get("name", null);
                tilewidth = element.getIntAttribute("tilewidth", 0);
                tileheight = element.getIntAttribute("tileheight", 0);
                spacing = element.getIntAttribute("spacing", 0);
                margin = element.getIntAttribute("margin", 0);
                imageSource = element.getChildByName("image").getAttribute("source");
                imageWidth = element.getChildByName("image").getIntAttribute("width", 0);
                imageHeight = element.getChildByName("image").getIntAttribute("height", 0);
            } catch (IOException e) {
                throw new GdxRuntimeException("Error parsing external tileset.");
            }
        } else {
            imageSource = element.getChildByName("image").getAttribute("source");
            imageWidth = element.getChildByName("image").getIntAttribute("width", 0);
            imageHeight = element.getChildByName("image").getIntAttribute("height", 0);
        }

        if (!map.getProperties().containsKey("atlas")) {
            throw new GdxRuntimeException("The map is missing the 'atlas' property");
        }

        // get the TextureAtlas for this tileset
        FileHandle atlasHandle = getRelativeFileHandle(tmxFile, map.getProperties().get("atlas", String.class));
        atlasHandle = resolve(atlasHandle.path());
        TextureAtlas atlas = resolver.getAtlas(atlasHandle.path());
        //String regionsName = atlasHandle.nameWithoutExtension();
        String regionsName = name;

        if (parameter != null && parameter.forceTextureFilters) {
            for (Texture texture : atlas.getTextures()) {
                trackedTextures.add(texture);
            }
        }

        TiledMapTileSet tileset = new TiledMapTileSet();
        MapProperties props = tileset.getProperties();
        tileset.setName(name);
        props.put("firstgid", firstgid);
        props.put("imagesource", imageSource);
        props.put("imagewidth", imageWidth);
        props.put("imageheight", imageHeight);
        props.put("tilewidth", tilewidth);
        props.put("tileheight", tileheight);
        props.put("margin", margin);
        props.put("spacing", spacing);

        Array<AtlasRegion> regions = atlas.findRegions(regionsName);
        System.out.println(regions.size);
        for (AtlasRegion region : regions) {
            // handle unused tile ids
            if (region != null) {
                StaticTiledMapTile tile = new StaticTiledMapTile(region);

                if (!yUp) {
                    region.flip(false, true);
                }

                int tileid = firstgid + region.index;
                tile.setId(tileid);
                tileset.putTile(tileid, tile);
                System.out.println("put tile " + tileid);
            }
        }

        Array<Element> tileElements = element.getChildrenByName("tile");

        for (Element tileElement : tileElements) {
            int localtid = tileElement.getIntAttribute("id", 0);
            TiledMapTile tile = tileset.getTile(firstgid + localtid);
            if (tile != null) {
                String terrain = tileElement.getAttribute("terrain", null);
                if (terrain != null) {
                    tile.getProperties().put("terrain", terrain);
                }
                String probability = tileElement.getAttribute("probability", null);
                if (probability != null) {
                    tile.getProperties().put("probability", probability);
                }
                Element properties = tileElement.getChildByName("properties");
                if (properties != null) {
                    loadProperties(tile.getProperties(), properties);
                }
            }
        }

        Element properties = element.getChildByName("properties");
        if (properties != null) {
            loadProperties(tileset.getProperties(), properties);
        }
        System.out.println("add tileset to map: " + tileset.getName());
        map.getTileSets().addTileSet(tileset);
    }
}

From source file:DungeonCleanerGame.GameMapPkg.MapParsers.MapLightParser.java

private void parseMapLight(TiledMap tiledMap) {
    boolean mapLight = Boolean.parseBoolean((String) tiledMap.getProperties().get("mapLight"));
    if (mapLight) {
        float ambrientLight = Float.parseFloat((String) tiledMap.getProperties().get("ambrientLight"));
        DevRandEngine.getInstance().gamePhysics().getRayhandler().setAmbientLight(ambrientLight);
    } else {//w w  w .ja  va  2  s  .  co  m
        DevRandEngine.getInstance().gamePhysics().getRayhandler().setShadows(false);
    }
}

From source file:genuini.world.WorldManager.java

private void loadMap(GameScreen screen, String mapName) {
    // TmxMapLoader.Parameters
    TmxMapLoader.Parameters params = new TmxMapLoader.Parameters();
    params.textureMinFilter = Texture.TextureFilter.Linear;
    params.textureMagFilter = Texture.TextureFilter.Nearest;

    //Load map//from  www. ja  v  a2  s  .  c o  m
    String mapPath = "maps/" + mapName + ".tmx";
    TiledMap map = new TmxMapLoader().load(mapPath, params);
    screen.setMap(map);

    // Retrieve map properties
    MapProperties properties = map.getProperties();

    screen.setTMR(new OrthogonalTiledMapRenderer(map));

    terrainLayer = (TiledMapTileLayer) map.getLayers().get("terrain");
    objectLayer = map.getLayers().get("objects");
    accessPointsLayer = map.getLayers().get("accessPoints");
    mobSpawnPointsLayer = map.getLayers().get("mobSpawnPoints");
    tileMapWidth = properties.get("width", Integer.class);
    tileMapHeight = properties.get("height", Integer.class);
    tileSize = (int) terrainLayer.getTileHeight();

}

From source file:headmade.arttag.utils.MapUtils.java

License:Apache License

public static void loadMap(ArtTagScreen artTagScreen, String mapName) {
    if (artTagScreen.currentRoom != null) {
        unloadMap(artTagScreen);/*from  w w w .ja v a2  s .co  m*/
    }

    if (null != Player.instance.warpDirection) {
        Gdx.app.log(TAG, "Loading map " + mapName);
        if (DIRECTION_LEFT.equalsIgnoreCase(Player.instance.warpDirection)) {
            if (artTagScreen.currentRoomIndexX == 0) {
                artTagScreen.currentRoomIndexX = ArtTagScreen.MAX_ROOM_SIZE - 1;
            } else {
                artTagScreen.currentRoomIndexX--;
            }
        } else if (DIRECTION_RIGHT.equalsIgnoreCase(Player.instance.warpDirection)) {
            if (artTagScreen.currentRoomIndexX == ArtTagScreen.MAX_ROOM_SIZE - 1) {
                artTagScreen.currentRoomIndexX = 0;
            } else {
                artTagScreen.currentRoomIndexX++;
            }
        } else if (DIRECTION_TOP.equalsIgnoreCase(Player.instance.warpDirection)) {
            if (artTagScreen.currentRoomIndexY == ArtTagScreen.MAX_ROOM_SIZE - 1) {
                artTagScreen.currentRoomIndexY = 0;
            } else {
                artTagScreen.currentRoomIndexY++;
            }
        } else if (DIRECTION_BOTTOM.equalsIgnoreCase(Player.instance.warpDirection)) {
            if (artTagScreen.currentRoomIndexY == 0) {
                artTagScreen.currentRoomIndexY = ArtTagScreen.MAX_ROOM_SIZE - 1;
            } else {
                artTagScreen.currentRoomIndexY--;
            }
        }

    }

    boolean isNewRoom = true;
    if (artTagScreen.rooms[artTagScreen.currentRoomIndexX][artTagScreen.currentRoomIndexY] == null) {
        artTagScreen.currentRoom = new Room(mapName);
        artTagScreen.rooms[artTagScreen.currentRoomIndexX][artTagScreen.currentRoomIndexY] = artTagScreen.currentRoom;
    } else {
        artTagScreen.currentRoom = artTagScreen.rooms[artTagScreen.currentRoomIndexX][artTagScreen.currentRoomIndexY];
        isNewRoom = false;
    }

    final Box2DMapObjectParser parser = new Box2DMapObjectParser(ArtTag.UNIT_SCALE);
    // final Box2DMapObjectParser.Listener.Adapter listener = new Box2DMapObjectParser.Listener.Adapter() {
    //
    // @Override
    // public void created(Fixture fixture, MapObject mapObject) {
    //
    // Gdx.app.log(TAG, "mapObject.getProperties()" + fixture.getFilterData().maskBits);
    // super.created(fixture, mapObject);
    // }
    //
    // };
    // parser.setListener(listener);

    final TiledMap map = artTagScreen.currentRoom.getMap();

    final String onGameOver = map.getProperties().get(PROP_ONGAMEOVER, String.class);
    final String hideJobDesc = map.getProperties().get(PROP_ONGAMEOVER, String.class);
    artTagScreen.onGameOver = onGameOver;
    artTagScreen.isHideJobDesc = hideJobDesc == null ? false : true;

    parser.load(artTagScreen.world, map);
    if (null == artTagScreen.mapRenderer) {
        // artTagScreen.mapRenderer = new OrthogonalTiledMapRenderer(artTagScreen.map, artTagScreen.getGame().getBatch());
        artTagScreen.mapRenderer = new OrthogonalTiledMapRenderer(map, parser.getUnitScale(),
                artTagScreen.getGame().getBatch());
    } else {
        artTagScreen.mapRenderer.setMap(map);
    }

    MapLayer layer = map.getLayers().get("objects");
    for (final MapObject mapObject : layer.getObjects()) {
        if (OBJ_ART.equals(mapObject.getName())) {
            if (isNewRoom) {
                // add Art only if this a new room. If this is an old room the art was created before.
                if (mapObject instanceof RectangleMapObject) {
                    createNewArt(artTagScreen, mapObject, ((RectangleMapObject) mapObject).getRectangle(),
                            parser.getUnitScale());
                } else {
                    Gdx.app.error(TAG, OBJ_ART + " has to be a Rectangle");
                }
            }
        } else if (OBJ_WARP.equals(mapObject.getName())) {
            final Body warp = createWarp(artTagScreen, ((RectangleMapObject) mapObject).getRectangle(),
                    parser.getUnitScale());
            final String direction = mapObject.getProperties().get(PROP_DIRECTION, String.class);
            final String room = mapObject.getProperties().get(PROP_ROOM, String.class);
            warp.setUserData(new WarpVo(direction, room));
        } else if (OBJ_EXIT.equals(mapObject.getName())) {
            createExit(artTagScreen, ((RectangleMapObject) mapObject).getRectangle(), parser.getUnitScale());
        } else if (OBJ_HINT.equals(mapObject.getName())) {
            final Body hintBody = createHint(artTagScreen, ((RectangleMapObject) mapObject).getRectangle(),
                    parser.getUnitScale());
            final String hint = mapObject.getProperties().get(PROP_TEXT, String.class);
            hintBody.setUserData(hint);
        } else if (OBJ_PLAYER.equals(mapObject.getName())) {
            final Ellipse e = ((EllipseMapObject) mapObject).getEllipse();
            if (null == Player.instance.body) {
                final String direction = mapObject.getProperties().get("direction", String.class);
                if (null != Player.instance.warpDirection) {
                    if (Player.instance.warpDirection.equalsIgnoreCase(direction)) {
                        Player.instance.createBody(artTagScreen, (e.x + e.width / 2f) * parser.getUnitScale(),
                                (e.y + e.height / 2f) * parser.getUnitScale());
                        Player.instance.warpDirection = null;
                    }
                } else if (direction == null) {
                    Player.instance.createBody(artTagScreen, (e.x + e.width / 2f) * parser.getUnitScale(),
                            (e.y + e.height / 2f) * parser.getUnitScale());
                }
            }
        }
    }

    if (!isNewRoom) {
        // create ArtSensors for old Art
        for (final Art art : artTagScreen.currentRoom.getArtList()) {
            createArtSensor(artTagScreen, art);
        }
    }

    { // guards
        final HashMap<String, Guard> guards = new HashMap<String, Guard>();
        final Array<MapObject> paths = new Array<MapObject>();
        layer = map.getLayers().get("guards");
        for (final MapObject mapObject : layer.getObjects()) {
            if (mapObject.getName() != null && mapObject.getName().contains(OBJ_GUARD)) {
                final Ellipse e = ((EllipseMapObject) mapObject).getEllipse();
                final Guard g = new Guard();
                g.createBody(artTagScreen, (e.x + e.width / 2f) * parser.getUnitScale(),
                        (e.y + e.height / 2f) * parser.getUnitScale());
                guards.put(mapObject.getName().trim(), g);
            } else if (mapObject.getName() != null && mapObject.getName().contains(OBJ_PATH)) {
                paths.add(mapObject);
            } else {
                Gdx.app.log(TAG, "WTF");
            }
        }
        for (final MapObject mapObject : paths) {
            final PolylineMapObject pl = (PolylineMapObject) mapObject;
            final String ownerName = pl.getProperties().get("owner", String.class);
            final Guard g = guards.get(ownerName.trim());
            Gdx.app.log(TAG, "guards " + guards.keySet());
            if (g != null) {
                final Polyline orgPolyline = pl.getPolyline();
                final Polyline p = new Polyline(orgPolyline.getVertices());
                p.setScale(parser.getUnitScale(), parser.getUnitScale());
                p.setPosition(orgPolyline.getX() * parser.getUnitScale(),
                        orgPolyline.getY() * parser.getUnitScale());
                final float[] vertices = p.getTransformedVertices();
                for (int i = 0; i < vertices.length; i += 2) {
                    g.path.add(new Vector2(vertices[i], vertices[i + 1]));
                }
                artTagScreen.guards.add(g);
            } else {
                Gdx.app.log(TAG, "No guard for path " + ownerName);
            }
        }

    }

    layer = map.getLayers().get("lights");
    for (final MapObject mapObject : layer.getObjects()) {
        if (mapObject.getProperties().get("type", String.class).contains(LIGTH_POINT)) {
            if (mapObject instanceof EllipseMapObject) {
                createPointLight(artTagScreen, (EllipseMapObject) mapObject, parser.getUnitScale());
            } else {
                Gdx.app.error(TAG, LIGTH_POINT + " light has to be a Circle not " + mapObject);
            }
        } else if (mapObject.getProperties().get("type", String.class).contains(LIGTH_CONE)) {
            if (mapObject instanceof PolygonMapObject) {
                createConeLight(artTagScreen, (PolygonMapObject) mapObject, parser.getUnitScale());
            } else {
                Gdx.app.error(TAG, LIGTH_CONE + " light has to be a Polygon");
            }
        }
    }

}

From source file:org.saltosion.pixelprophecy.systems.RenderingSystem.java

License:Open Source License

/**
 * Used to change the map//from   w  w w .j a  v  a  2  s  . c o m
 * @param map 
 */
public final void setMap(TiledMap map) {
    mapToRender = map;
    MapProperties properties = map.getProperties();
    mapRenderer = new OrthogonalTiledMapRenderer(mapToRender, Globals.SPRITE_SCALE);
    if (properties.containsKey("ambientlight")) {
        ambientLight = Globals.parseColor(properties.get("ambientlight", String.class));
    } else {
        ambientLight = new Color(0, 0, 0, 1);
    }
    rayHandler.setAmbientLight(ambientLight);
}