/** @param id id of the {@link TiledMapTile} to get. * @return tile with matching id, null if it doesn't exist */ public TiledMapTile getTile (int id) { // The purpose of backward iteration here is to maintain backwards compatibility // with maps created with earlier versions of a shared tileset. The assumption // is that the tilesets are in order of ascending firstgid, and by backward // iterating precedence for conflicts is given to later tilesets in the list, // which are likely to be the earlier version of any given gid. // See TiledMapModifiedExternalTilesetTest for example of this issue. for (int i = tilesets.size-1; i >= 0; i--) { TiledMapTileSet tileset = tilesets.get(i); TiledMapTile tile = tileset.getTile(id); if (tile != null) { return tile; } } return null; }
/** @param id id of the {@link TiledMapTile} to get. * @return tile with matching id, null if it doesn't exist */ public TiledMapTile getTile (int id) { // The purpose of backward iteration here is to maintain backwards compatibility // with maps created with earlier versions of a shared tileset. The assumption // is that the tilesets are in order of ascending firstgid, and by backward // iterating precedence for conflicts is given to later tilesets in the list, // which are likely to be the earlier version of any given gid. // See TiledMapModifiedExternalTilesetTest for example of this issue. for (int i = tilesets.size-1; i >= 0; i--) { TiledMapTileSet tileset = tilesets.get(i); TiledMapTile tile = tileset.getTile(id); if (tile != null) { return tile; } } return null; }
} else if (name.equals("Static")) { Cell cell = new Cell(); cell.setTile(currentTileSet.getTile(firstgid + currentChild.getIntAttribute("Index"))); layer.setCell(x++, y, cell); } else if (name.equals("Animated")) { firstgid = currentTileSet.getProperties().get("firstgid", Integer.class); } else if (frameName.equals("Static")) { frameTiles.add((StaticTiledMapTile)currentTileSet.getTile(firstgid + frame.getIntAttribute("Index")));
} else if (name.equals("Static")) { Cell cell = new Cell(); cell.setTile(currentTileSet.getTile(firstgid + currentChild.getIntAttribute("Index"))); layer.setCell(x++, y, cell); } else if (name.equals("Animated")) { firstgid = currentTileSet.getProperties().get("firstgid", Integer.class); } else if (frameName.equals("Static")) { frameTiles.add((StaticTiledMapTile)currentTileSet.getTile(firstgid + frame.getIntAttribute("Index")));
TiledMapTile tile = tileset.getTile(1); String tileCustomValue = tile.getProperties().get(TILE_PROPERTY_NAME, String.class); if (!TILE_PROPERTY_VALUE.equals(tileCustomValue)) {
TiledMapTile tile = tileset.getTile(tileid); if (tile == null) { Element imageElement = tileElement.getChildByName("image"); TiledMapTile tile = tileset.getTile(firstgid + localtid); if (tile != null) { Element animationElement = tileElement.getChildByName("animation"); IntArray intervals = new IntArray(); for (Element frameElement: animationElement.getChildrenByName("frame")) { staticTiles.add((StaticTiledMapTile) tileset.getTile(firstgid + frameElement.getIntAttribute("tileid"))); intervals.add(frameElement.getIntAttribute("duration"));
TiledMapTile tile = tileset.getTile(tileid); if (tile == null) { Element imageElement = tileElement.getChildByName("image"); TiledMapTile tile = tileset.getTile(firstgid + localtid); if (tile != null) { Element animationElement = tileElement.getChildByName("animation"); IntArray intervals = new IntArray(); for (Element frameElement: animationElement.getChildrenByName("frame")) { staticTiles.add((StaticTiledMapTile) tileset.getTile(firstgid + frameElement.getIntAttribute("tileid"))); intervals.add(frameElement.getIntAttribute("duration"));
TiledMapTile tile = tileset.getTile(firstgid + localtid); if (tile != null) { Element animationElement = tileElement.getChildByName("animation"); IntArray intervals = new IntArray(); for (Element frameElement: animationElement.getChildrenByName("frame")) { staticTiles.add((StaticTiledMapTile) tileset.getTile(firstgid + frameElement.getIntAttribute("tileid"))); intervals.add(frameElement.getIntAttribute("duration"));
TiledMapTile tile = tileset.getTile(firstgid + localtid); if (tile != null) { Element animationElement = tileElement.getChildByName("animation"); IntArray intervals = new IntArray(); for (Element frameElement: animationElement.getChildrenByName("frame")) { staticTiles.add((StaticTiledMapTile) tileset.getTile(firstgid + frameElement.getIntAttribute("tileid"))); intervals.add(frameElement.getIntAttribute("duration"));
TiledMapTileLayer layer = (TiledMapTileLayer) map.getLayers().get(0); TiledMapTileSet tileset = map.getTileSets().getTileSet(0); Array<StaticTiledMapTile> at = new Array<StaticTiledMapTile>(); if (tileset.getTile(0) != null) at.add((StaticTiledMapTile) tileset.getTile(0)); if (tileset.getTile(1) != null) at.add((StaticTiledMapTile) tileset.getTile(1)); if (tileset.getTile(2) != null) at.add((StaticTiledMapTile) tileset.getTile(2)); if (tileset.getTile(3) != null) at.add((StaticTiledMapTile) tileset.getTile(3)); layer.getCell(2, 2).setTile(new AnimatedTiledMapTile(0.3f, at));
/** @param id id of the {@link TiledMapTile} to get. * @return tile with matching id, null if it doesn't exist */ public TiledMapTile getTile (int id) { // The purpose of backward iteration here is to maintain backwards compatibility // with maps created with earlier versions of a shared tileset. The assumption // is that the tilesets are in order of ascending firstgid, and by backward // iterating precedence for conflicts is given to later tilesets in the list, // which are likely to be the earlier version of any given gid. // See TiledMapModifiedExternalTilesetTest for example of this issue. for (int i = tilesets.size-1; i >= 0; i--) { TiledMapTileSet tileset = tilesets.get(i); TiledMapTile tile = tileset.getTile(id); if (tile != null) { return tile; } } return null; }
} else if (name.equals("Static")) { Cell cell = new Cell(); cell.setTile(currentTileSet.getTile(firstgid + currentChild.getIntAttribute("Index"))); layer.setCell(x++, y, cell); } else if (name.equals("Animated")) { firstgid = currentTileSet.getProperties().get("firstgid", Integer.class); } else if (frameName.equals("Static")) { frameTiles.add((StaticTiledMapTile)currentTileSet.getTile(firstgid + frame.getIntAttribute("Index")));
@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); } } }
TiledMapTile tile = tileset.getTile(tileid); if (tile == null) { Element imageElement = tileElement.getChildByName("image"); TiledMapTile tile = tileset.getTile(firstgid + localtid); if (tile != null) { Element animationElement = tileElement.getChildByName("animation"); IntArray intervals = new IntArray(); for (Element frameElement: animationElement.getChildrenByName("frame")) { staticTiles.add((StaticTiledMapTile) tileset.getTile(firstgid + frameElement.getIntAttribute("tileid"))); intervals.add(frameElement.getIntAttribute("duration"));
TiledMapTile tile = tileset.getTile(tileid); if (tile == null) { Element imageElement = tileElement.getChildByName("image");
TiledMapTile tile = tileset.getTile(firstgid + localtid); if (tile != null) { Element animationElement = tileElement.getChildByName("animation"); IntArray intervals = new IntArray(); for (Element frameElement: animationElement.getChildrenByName("frame")) { staticTiles.add((StaticTiledMapTile) tileset.getTile(firstgid + frameElement.getIntAttribute("tileid"))); intervals.add(frameElement.getIntAttribute("duration"));