Java Code Examples for com.badlogic.gdx.maps.tiled.TiledMapTileLayer#Cell

The following examples show how to use com.badlogic.gdx.maps.tiled.TiledMapTileLayer#Cell . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TiledMapActor.java    From Norii with Apache License 2.0 5 votes vote down vote up
public TiledMapActor(final Map tiledMap, final TiledMapTileLayer tiledLayer, final TiledMapTileLayer.Cell cell) {
	this.tiledMap = tiledMap;
	this.tiledLayer = tiledLayer;
	this.cell = cell;
	isFreeSpawn = false;
	isHovered = false;
	observers = new Array<TiledMapObserver>();
}
 
Example 2
Source File: TiledMapStage.java    From Norii with Apache License 2.0 5 votes vote down vote up
private void createActorsForLayer(TiledMapTileLayer tiledLayer) {
    for (int x = 0; x < tiledLayer.getWidth(); x++) {
        for (int y = 0; y < tiledLayer.getHeight(); y++) {
            TiledMapTileLayer.Cell cell = tiledLayer.getCell(x, y);
            TiledMapActor actor = new TiledMapActor(tiledMap, tiledLayer, cell);
            actors[x][y] = actor;
            
            initiateActor(x, y, actor);
            addEventListener(actor);
        }
    }
}
 
Example 3
Source File: FringeLayer.java    From RuinsOfRevenge with MIT License 5 votes vote down vote up
public FringeLayer(TiledMap map, TiledMapTileLayer fringeLayer) {
	this.map = map;
	this.layer = fringeLayer;
	this.tiles = new ArrayList<>();

	for (int x = 0; x < layer.getWidth(); x++) {
		for (int y = 0; y < layer.getHeight(); y++) {
			TiledMapTileLayer.Cell cell = layer.getCell(x, y);
			if (cell == null) continue;
			String yoffsetStr = cell.getTile().getProperties().get("yoffset", String.class);

			if (yoffsetStr == null || yoffsetStr.isEmpty()) {
				System.out.println("Warning - Fringe tile at [" + x + ", " + y + "] missing property <yoffset>");
			} else {
				try {
					tiles.add(new FringeTile(
							cell,
							x, y,
							Float.parseFloat(yoffsetStr)));
				} catch (NumberFormatException e) {
					System.err.println("Can't parse \"" + yoffsetStr + "\" as float: " + e);
				}
			}
		}
	}
	Collections.sort(tiles);
}
 
Example 4
Source File: FringeLayer.java    From RuinsOfRevenge with MIT License 4 votes vote down vote up
FringeTile(TiledMapTileLayer.Cell cell, int x, int y, float yoffset) {
	this.cell = cell;
	this.x = x;
	this.y = y;
	this.yoffset = yoffset;
}