// Constructor takes the default values from its tile type public Tile(SS13 game, TileType tileType, TileMap parent) { super(); this.tileType = tileType; this.passable = tileType.passable(); TextureRegion tileRegion = game.getAtlas(tileType.atlas()).findRegion(tileType.defaultTileImage()); UV = new Vector2(tileRegion.getU(), tileRegion.getV()); UV2 = new Vector2(tileRegion.getU2(), tileRegion.getV2()); this.texture = game.getAtlas(tileType.atlas()).findRegion(tileType.defaultTileImage()).getTexture(); this.parentGrid = parent; }
// Constructor with custom defined values public Tile(SS13 game, TileType tileType, boolean passible, String textureName, TileMap parent) { super(); this.tileType = tileType; this.passable = passible; TextureRegion tileRegion = game.getAtlas(tileType.atlas()).findRegion(textureName); this.texture = tileRegion.getTexture(); this.parentGrid = parent; UV = new Vector2(tileRegion.getU(), tileRegion.getV()); UV2 = new Vector2(tileRegion.getU2(), tileRegion.getV2()); }
public void setTexture(SS13 game, String newTexture) { TextureRegion tileRegion = game.getAtlas(tileType.atlas()).findRegion(newTexture); UV = new Vector2(tileRegion.getU(), tileRegion.getV()); UV2 = new Vector2(tileRegion.getU2(), tileRegion.getV2()); this.texture = tileRegion.getTexture(); }