1
General / Parsing "Collection of Images" with json doesn't work
« on: November 26, 2017, 04:53:54 pm »
Hi, so I have a Tiled map, I have a "based on a tileset image" tileset, and a "Collection of Images" tileset with a few images of different sizes inside.
Everything works fine, but not for the "Collection of Images" tileset and parsing this with json to our game.
Here is the layer loader from json to cpp. It loads the layer and it works fine, if I add something to the map from "Collection of Images" tileset, it is ignored. I can still collide with it, but it isn't shown.
The crates in the images are from the "Collection of Images" tileset
but in-game these are gone, but the player can still collide with them...
I bet there is some code missing. if anyone can help that would be greatly appreciated.
I have attached the json map file if needed.
Everything works fine, but not for the "Collection of Images" tileset and parsing this with json to our game.
Here is the layer loader from json to cpp. It loads the layer and it works fine, if I add something to the map from "Collection of Images" tileset, it is ignored. I can still collide with it, but it isn't shown.
void MapMaker::loadLayer(Json::Value &layer, std::list<Object *> &objects, TileSize tileSize) {
MapLayer *tmp = new MapLayer(tileSize);
tmp->width = layer["width"].asInt();
tmp->height = layer["height"].asInt();
memset(tmp->tileMap, 0, sizeof(tmp->tileMap));
for(size_t i = 0; i < layer["data"].size(); ++i)
tmp->tileMap[i] = layer["data"][(int)i].asInt();
tmp->isCollisionLayer = layer["properties"]["Collision"].asBool();
objects.push_back(tmp);
}
MapLayer *tmp = new MapLayer(tileSize);
tmp->width = layer["width"].asInt();
tmp->height = layer["height"].asInt();
memset(tmp->tileMap, 0, sizeof(tmp->tileMap));
for(size_t i = 0; i < layer["data"].size(); ++i)
tmp->tileMap[i] = layer["data"][(int)i].asInt();
tmp->isCollisionLayer = layer["properties"]["Collision"].asBool();
objects.push_back(tmp);
}
The crates in the images are from the "Collection of Images" tileset
but in-game these are gone, but the player can still collide with them...
I bet there is some code missing. if anyone can help that would be greatly appreciated.
I have attached the json map file if needed.