Hello,
Sorry to ask you that, but this problem make me crazy xD
Because all that i did is useless if … my map can’t appear…
I don’t think that the code is the problem, because it works with a downloaded map.
But i show it :
package Module;
import Base.Tile.TileType;
import Launcher.FurtherShade;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.tiled.TileAtlas;
import com.badlogic.gdx.graphics.g2d.tiled.TileMapRenderer;
import com.badlogic.gdx.graphics.g2d.tiled.TiledLoader;
import com.badlogic.gdx.graphics.g2d.tiled.TiledMap;
/**
*
* @author Celes Eternal
*
*/
public class Map {
/*
* Data
*
*/
//Block size
static final int BLOCK_WIDTH = 32;
static final int BLOCK_HEIGHT = 32;
//class data
private TileMapRenderer tileMapRenderer;
private TiledMap map;
private TileAtlas atlas;
private OrthographicCamera cam;
private SpriteBatch batch;
public Map(){
// Load the tmx file into map
map = TiledLoader.createMap(Gdx.files.internal("maps/tutoMap.tmx"));
// Load the tiles into atlas
atlas = new TileAtlas(map, Gdx.files.internal("tileSets/"));
// Create the renderer
tileMapRenderer = new TileMapRenderer(map, atlas, 10, 10, 32, 32);
//initialize
cam = new OrthographicCamera(Gdx.graphics.getWidth() ,
Gdx.graphics.getHeight() );
cam.translate(Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight()/2);
batch = new SpriteBatch();
this.initVirtualMap();
}
public void initVirtualMap(){
TileType [][] virtualMap = new TileType[map.width][map.height];
for (int x = 0; x < map.width; x++)
{
for (int y = 0; y < map.height; y++)
{
for (int l = 0; l < map.layers.size() ; l++)
{
int id = map.layers.get(l).tiles[y][x];
if(id!=0){
String b = map.getTileProperty(id, "Type");
Gdx.app.log(FurtherShade.LOG, b);
if (b!=null)
virtualMap[x][y] = TileType.Wall;
}
}}}
}
public void render() {
cam.zoom = 0.5f;
cam.update();
tileMapRenderer.render(cam);
}
}
I tried some differents zooms but it did nothing.
So i think that the problem result from my files.
tutoMap.tmx:
[spoiler]
<?xml version="1.0" encoding="UTF-8" standalone="no"?><map height="25" orientation="orthogonal" tileheight="32" tilewidth="32" version="1.0" width="50"><properties><property name="blended tiles" value="242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,369,370,371,372,373,374,375,376,377,379,380,381,382,383,384,385,390,391,392,393,395,399,400,401,402,403,404,405,406,407,408,411,412,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,473,474,475,476,477,478,479,480,484,485,486,487,488,489,490,491,492,493,494,495,496,505,506,507,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,530,531,532,533,534,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,553,554,555,556,557,558,559,560,561,562,563,564,565,566,568,571,572,573,574,575,576,577,578,579,580,581,582,583,584,589,590,591,592,593,597,598,600,603,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,621,622,623,624"/></properties>
<tileset firstgid="1" name="Dungeon_A4" tileheight="32" tilewidth="32">
<image height="480" source="../tileSets/Dungeon_A4.png" width="512"/>
</tileset>
<tileset firstgid="241" name="Dungeon_A5" tileheight="32" tilewidth="32">
<image height="512" source="../tileSets/Dungeon_A5.png" width="256"/>
</tileset>
<tileset firstgid="369" name="Inside_B" tileheight="32" tilewidth="32">
<image height="512" source="../tileSets/Inside_B.png" width="512"/>
</tileset>
<layer height="25" name="Background" width="50">
<data compression="gzip" encoding="base64">
H4sIAAAAAAAAC+3Ruw2AMBAD0LBE9gF2oOfT8Nm/xpGoIpAShIjhXDxda/t85ZwXERER87pD6RxPdSmd4e8bW8b+x5xszF1Yc+Vuybzxm7t/aYM7f5ZzI0zRfuH2MBDkS7XCFnUIZlgI8qWqobnQEuSz0mMHywpx0ogTAAA=
</data>
</layer>
<layer height="25" name="Wall" width="50">
<data compression="gzip" encoding="base64">
H4sIAAAAAAAAC+1YwQ2EMAzrttwGsAG3AYxLP/1UimKbNHAcliJ/itPENFI7lVI+NaYf57nG8gBu9aw1vgCj69W+ovvo87R6tho7wOh6ta/oPqw8KFr96DqWWajfo3WrfrB4/fgvP9S5x/o02g917rE+qX6o/vew+mf55+mwfni6KKx+WP55Omx/PV0U6nyydKL02HxR/+fZeXc2X/Q5i/bXAnt+UUT3xdNhzy+KbD9GIduPUXiKH6PmXzb6e62Hq98R0HcGtO67MjrH2ft/NqNznL3/Z/MBvpVIfogTAAA=
</data>
</layer>
<layer height="25" name="Decor (visuel)" width="50">
<data compression="gzip" encoding="base64">
H4sIAAAAAAAAC+3W3Q2AIAxGUXQvfxZAHckRHFl5bTB+hqQBcs9zKRa0NgTUbBu1uNnELeK6L+eg5VrF/WwudV2p66ljd9oLQJnUz2Lme7V9LhdTI/ucb329lXpUuTrVf9ofk9O5edzP0dk7gHal+czOaF4zGwAAvbsBSjgXcYgTAAA=
</data>
</layer>
<layer height="25" name="Decor (like wall)" width="50">
<data compression="gzip" encoding="base64">
H4sIAAAAAAAAC+3VsQ0AIAhEUcJauoFu4Aju3yu9iYk2iP+VVEBxJwKPkopk3c+8K3PfqvsZAJx6MRtXyMY7LcjvepA7EAs5ix9Yj0ToEusRugTwbQAnAYbxiBMAAA==
</data>
</layer>
<layer height="25" name="Decor (vision)" width="50">
<data compression="gzip" encoding="base64">
H4sIAAAAAAAAC+3OMQqAQBAEwWEfevoCz/9HbrqJoSBUQcOEkwC8W5Uc3Vlz/83Vn3d319wAAADwhQc5g2PbiBMAAA==
</data>
</layer>
</map>
[/spoiler]
and a tileSet:
Dungeon_A4 packfile
[spoiler]
Dungeon_A4.png
format: RGBA8888
filter: Nearest,Nearest
repeat: none
Dungeon
rotate: false
xy: 2, 2
size: 32, 32
orig: 32, 32
offset: 0, 0
index: 239
Dungeon
rotate: false
xy: 36, 2
size: 32, 32
orig: 32, 32
offset: 0, 0
index: 238
Dungeon
rotate: false
xy: 70, 2
size: 32, 32
orig: 32, 32
offset: 0, 0
index: 237
.......
.......
.......
Dungeon
rotate: false
xy: 444, 512
size: 32, 32
orig: 32, 32
offset: 0, 0
index: 1
Dungeon
rotate: false
xy: 478, 512
size: 32, 32
orig: 32, 32
offset: 0, 0
index: 0
[/spoiler]
And one last thing, when i make the packfile, my tileSet was blended… It’s possible to make a pake file with my current image?
Sorry to bore you,
See you