in TMXLayer.addTileByGlobalTileID(...) TileId==0 is handled this way:
- Code: Select all
if (pGlobalTileID == 0) {
tmxTileTextureRegion = null;
} else {
tmxTileTextureRegion = tmxTiledMap.getTextureRegionFromGlobalTileID(pGlobalTileID);
}
//...
if (this.mTexture == null) {
this.mTexture = tmxTileTextureRegion.getTexture();
super.initBlendFunction(this.mTexture);
} else {
if (this.mTexture != tmxTileTextureRegion.getTexture()) {
throw new AndEngineRuntimeException("All TMXTiles in a TMXLayer need to be in the same TMXTileSet.");
}
}
The problematic case is:
pGlobalTileID == 0 and this.mTexture == null
This causes a NullPointerException at the call tmxTileTextureRegion.getTexture() because tmxTileTextureRegion is previously set to null.
I was looking around to find a solution to this case, but i did'nt found one yet. As far as I can see a texture is always required. Maybe a transparent default texture can be a solution for tiles not having any tileset.
