Tabnine Logo
TiledMapTileSet.getTile
Code IndexAdd Tabnine to your IDE (free)

How to use
getTile
method
in
com.badlogic.gdx.maps.tiled.TiledMapTileSet

Best Java code snippets using com.badlogic.gdx.maps.tiled.TiledMapTileSet.getTile (Showing top 16 results out of 315)

origin: libgdx/libgdx

/** @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;
}
origin: libgdx/libgdx

/** @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;
}
origin: libgdx/libgdx

} 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")));
origin: libgdx/libgdx

} 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")));
origin: libgdx/libgdx

TiledMapTile tile = tileset.getTile(1);
String tileCustomValue = tile.getProperties().get(TILE_PROPERTY_NAME, String.class);
if (!TILE_PROPERTY_VALUE.equals(tileCustomValue)) {
origin: libgdx/libgdx

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"));
origin: libgdx/libgdx

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"));
origin: libgdx/libgdx

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"));
origin: libgdx/libgdx

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"));
origin: stackoverflow.com

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));
origin: com.badlogicgames.gdx/gdx

/** @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;
}
origin: com.badlogicgames.gdx/gdx

} 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")));
origin: BrentAureli/SuperMario

  @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);
    }
  }
}
origin: com.badlogicgames.gdx/gdx

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"));
origin: manuelbua/uracer-kotd

TiledMapTile tile = tileset.getTile(tileid);
if (tile == null) {
  Element imageElement = tileElement.getChildByName("image");
origin: com.badlogicgames.gdx/gdx

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"));
com.badlogic.gdx.maps.tiledTiledMapTileSetgetTile

Javadoc

Gets the TiledMapTile that has the given id.

Popular methods of TiledMapTileSet

  • getProperties
  • getName
  • <init>
    Creates empty tileset
  • putTile
    Adds or replaces tile with that id
  • setName
  • size

Popular in Java

  • Running tasks concurrently on multiple threads
  • getResourceAsStream (ClassLoader)
  • onRequestPermissionsResult (Fragment)
  • scheduleAtFixedRate (Timer)
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now