MapProperties properties = object.getProperties(); if (properties.containsKey("has_text")) { String textToSet= (String) properties.get("has_text"); float x = (Float) properties.get("x"); float y = (Float) properties.get("y"); //Now create you can create the label, you have text(seted in tmx editor) //and x,y are coordinates of the rectangle. }
private void generate(Array<TiledMapTileLayer> layers, String propertyKey) { for (TiledMapTileLayer layer : layers) { for (int ty = 0; ty < height; ty++) { for (int tx = 0; tx < width; tx++) { final TiledMapTileLayer.Cell cell = layer.getCell(tx, ty); if ( cell != null && cell.getTile() != null && cell.getTile().getProperties().containsKey(propertyKey)) { v[ty][tx] = true; } } } } } }
public void generate(Array<TiledMapTileLayer> layers, String propertyKey) { for (int ty = 0; ty < height; ty++) { for (int tx = 0; tx < width; tx++) { v[ty][tx] = false; } } for (TiledMapTileLayer layer : layers) { for (int ty = 0; ty < height; ty++) { for (int tx = 0; tx < width; tx++) { final TiledMapTileLayer.Cell cell = layer.getCell(tx, ty); if (cell != null && cell.getTile() != null && cell.getTile().getProperties().containsKey(propertyKey)) { v[ty][tx] = true; } } } } } }
public void generate(Array<TiledMapTileLayer> layers, String propertyKey) { for (int ty = 0; ty < height; ty++) { for (int tx = 0; tx < width; tx++) { v[ty][tx] = false; } } for (TiledMapTileLayer layer : layers) { for (int ty = 0; ty < height; ty++) { for (int tx = 0; tx < width; tx++) { final TiledMapTileLayer.Cell cell = layer.getCell(tx, ty); if (cell != null && cell.getTile() != null && cell.getTile().getProperties().containsKey(propertyKey)) { v[ty][tx] = true; } } } } } }
/** * Spawn map entities. */ protected void setup() { for (TiledMapTileLayer layer : layers) { for (int ty = 0; ty < height; ty++) { for (int tx = 0; tx < width; tx++) { final TiledMapTileLayer.Cell cell = layer.getCell(tx, ty); if (cell != null) { final MapProperties properties = cell.getTile().getProperties(); if (properties.containsKey("entity")) { entityFactorySystem.createEntity((String)properties.get("entity"), tx * tileWidth, ty * tileHeight, properties); layer.setCell(tx, ty, null); } } } } } }
/** * Spawn map entities. */ protected void setup() { for (TiledMapTileLayer layer : layers) { for (int ty = 0; ty < height; ty++) { for (int tx = 0; tx < width; tx++) { final TiledMapTileLayer.Cell cell = layer.getCell(tx, ty); if (cell != null) { final MapProperties properties = cell.getTile().getProperties(); if (properties.containsKey("entity")) { entityFactorySystem.createEntity((String)properties.get("entity"), tx * tileWidth, ty * tileHeight, properties); layer.setCell(tx, ty, null); } } } } } }
/** * Spawn map entities. */ protected void setup() { for (TiledMapTileLayer layer : layers) { for (int ty = 0; ty < height; ty++) { for (int tx = 0; tx < width; tx++) { final TiledMapTileLayer.Cell cell = layer.getCell(tx, ty); if (cell != null) { final MapProperties properties = cell.getTile().getProperties(); if (properties.containsKey("entity")) { entityFactorySystem.createEntity((String)properties.get("entity"), tx * tileWidth, ty * tileHeight, properties); layer.setCell(tx, ty, null); } } } } } }
@Override public void onHeadHit(Mario mario) { if(getCell().getTile().getId() == BLANK_COIN) MarioBros.manager.get("audio/sounds/bump.wav", Sound.class).play(); else { if(object.getProperties().containsKey("mushroom")) { screen.spawnItem(new ItemDef(new Vector2(body.getPosition().x, body.getPosition().y + 16 / MarioBros.PPM), Mushroom.class)); MarioBros.manager.get("audio/sounds/powerup_spawn.wav", Sound.class).play(); } else MarioBros.manager.get("audio/sounds/coin.wav", Sound.class).play(); getCell().setTile(tileSet.getTile(BLANK_COIN)); Hud.addScore(100); } } }