当前位置: 首页>>代码示例>>Java>>正文


Java TiledMapTile.getProperties方法代码示例

本文整理汇总了Java中com.badlogic.gdx.maps.tiled.TiledMapTile.getProperties方法的典型用法代码示例。如果您正苦于以下问题:Java TiledMapTile.getProperties方法的具体用法?Java TiledMapTile.getProperties怎么用?Java TiledMapTile.getProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.maps.tiled.TiledMapTile的用法示例。


在下文中一共展示了TiledMapTile.getProperties方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import com.badlogic.gdx.maps.tiled.TiledMapTile; //导入方法依赖的package包/类
@Override
protected void initialize() {
    super.initialize();
    cableMask = mapSystem.getMask("cable-type");

    for (TiledMapTileSet tileSet : mapSystem.map.getTileSets()) {
        for (TiledMapTile tile : tileSet) {
            MapProperties properties = tile.getProperties();
            if (properties.containsKey("cable-type")) {
                if ((Boolean) properties.get("cable-state")) {
                    tilesOn.put((Integer) properties.get("cable-type"), tile);
                } else {
                    tilesOff.put((Integer) properties.get("cable-type"), tile);
                }
            }
        }
    }
}
 
开发者ID:DaanVanYperen,项目名称:odb-artax,代码行数:19,代码来源:PowerSystem.java

示例2: update

import com.badlogic.gdx.maps.tiled.TiledMapTile; //导入方法依赖的package包/类
@Override
public void update(final long elapsedTime) {
    timeInAnimation = (timeInAnimation + elapsedTime) % getTotalAnimationTimeMs();
    final int frameIndex = (int) (timeInAnimation / timePerFrameMs);
    TiledMapTile currentTile = tileFrames.get(indexOrder[frameIndex]);
    for (MapLayer layer : tiledMap.getLayers()) {
        TiledMapTileLayer tiledMapLayer = (TiledMapTileLayer) layer;
        for (int x = 0; x < tiledMapLayer.getWidth(); x++) {
            for (int y = 0; y < tiledMapLayer.getHeight(); y++) {
                final TiledMapTileLayer.Cell cell = tiledMapLayer.getCell(x, y);
                if (cell != null) {
                    TiledMapTile tile = cell.getTile();
                    final MapProperties tileProperties = tile.getProperties();
                    if (tileProperties.containsKey(JRPG_TILE_ANIMATION_ID)
                            && tileProperties.get(JRPG_TILE_ANIMATION_ID).equals(id)) {
                        cell.setTile(currentTile);
                    }
                }
            }
        }
    }
}
 
开发者ID:JayStGelais,项目名称:jrpg-engine,代码行数:23,代码来源:TileAnimation.java

示例3: fromTileMapTile

import com.badlogic.gdx.maps.tiled.TiledMapTile; //导入方法依赖的package包/类
/**
 * Creates a {@link Tile} from a {@link TiledMapTile}.
 *
 * @param tiledMapTile the tiledMapTile from which to read from
 * @param x            coordinate
 * @param y            coordinate
 * @return the created Tile
 */
public static Tile fromTileMapTile(TiledMapTile tiledMapTile, int x, int y) {
    MapProperties mapProperties = tiledMapTile.getProperties();

    Tile tile = new Tile(x, y);

    if (mapProperties.get("untraversable") != null)
        tile.setTraversable(mapProperties.get("untraversable", Boolean.class));

    return tile;
}
 
开发者ID:EtherWorks,项目名称:arcadelegends-gg,代码行数:19,代码来源:Tile.java

示例4: findTileFrames

import com.badlogic.gdx.maps.tiled.TiledMapTile; //导入方法依赖的package包/类
private void findTileFrames() {
    for (TiledMapTileSet tileSet : tiledMap.getTileSets()) {
        for (TiledMapTile tile : tileSet) {
            final MapProperties tileProperties = tile.getProperties();
            if (tileProperties.containsKey(JRPG_TILE_ANIMATION_ID)
                    && tileProperties.get(JRPG_TILE_ANIMATION_ID).equals(id)) {
                tileFrames.put(tileProperties.get(JRPG_TILE_ANIMATION_INDEX, Integer.class), tile);
            }
        }
    }
}
 
开发者ID:JayStGelais,项目名称:jrpg-engine,代码行数:12,代码来源:TileAnimation.java

示例5: populateStateMap

import com.badlogic.gdx.maps.tiled.TiledMapTile; //导入方法依赖的package包/类
private void populateStateMap(int x, int y, State state, int layerIndex, TiledMapTileLayer layer,
      TiledMapConfig config) {
   Cell cell = layer.getCell(x, y);
   MapProperties layerProperties = layer.getProperties();
   boolean collisionLayer = Boolean
         .valueOf(layerProperties.get(config.get(Constants.COLLISION), "false", String.class));
   CellState cellState = state.getState(x, y, layerIndex);
   // Inherit the collision from the previous layer, if and only if
   // the current layer is non-collision by default
   if (layerIndex > 0 && !collisionLayer && state.getState(x, y, layerIndex - 1).isCollision()) {
      cellState.setCollision(true);
   } else if (cell != null) {
      TiledMapTile tile = cell.getTile();
      if (tile != null) {
         MapProperties properties = tile.getProperties();
         cellState.setProperties(properties);
         if (properties.containsKey(Constants.COLLISION)) {
            boolean collision = Boolean.valueOf(properties.get(Constants.COLLISION, String.class));
            cellState.setCollision(collision);
         } else {
            cellState.setCollision(DEFAULT_COLLISION);
         }
      } else {
         cellState.setCollision(DEFAULT_COLLISION);
      }
   } else {
      cellState.setCollision(DEFAULT_COLLISION);
   }
}
 
开发者ID:bitbrain,项目名称:braingdx,代码行数:30,代码来源:StatePopulator.java

示例6: loadNavigationLayer

import com.badlogic.gdx.maps.tiled.TiledMapTile; //导入方法依赖的package包/类
private void loadNavigationLayer(TiledMap map, Element element, String layerName){
    int width = element.getIntAttribute("width", 0);
    int height = element.getIntAttribute("height", 0);
    
    int[] ids = getTileIds(element, width, height);
    TiledMapTileSets tilesets = map.getTileSets();
    GridCell[][] nodes = new GridCell[width][height];
    for (int y = 0; y < height; y++) {
        for (int x = 0; x < width; x++) {
            int id = ids[y * width + x];
            TiledMapTile tile = tilesets.getTile(id & ~MASK_CLEAR);
            
            GridCell cell = new GridCell(x, height - 1 - y, false);
            if (tile != null) {
                MapProperties tileProp = tile.getProperties();
                
                String walkableProp = tileProp.get(navigationProperty, navigationClosedValue, String.class);
                cell.setWalkable( !walkableProp.equals(navigationClosedValue) );
            }
            nodes[cell.getX()][cell.getY()] = cell;
        }
    }
    
    NavigationTiledMapLayer layer = new NavigationTiledMapLayer(nodes);
    layer.setName(layerName);
    layer.setVisible(false);

    Element properties = element.getChildByName("properties");
    if (properties != null) {
        loadProperties(layer.getProperties(), properties);
    }
    map.getLayers().add(layer);
}
 
开发者ID:kibertoad,项目名称:swampmachine,代码行数:34,代码来源:NavTmxMapLoader.java


注:本文中的com.badlogic.gdx.maps.tiled.TiledMapTile.getProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。