[Add] Some stones to the tileset made by Moosader.
[Fix] Empty tiles causing game to crash.
This commit is contained in:
parent
84bfde227a
commit
ac0b5785a3
Binary file not shown.
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 26 KiB |
@ -4,11 +4,16 @@
|
||||
<property name="BGM" value="../Data/Music/journey_to_the_east_rocks.ogg"/>
|
||||
</properties>
|
||||
<tileset firstgid="1" name="AwesomeTileset" tilewidth="64" tileheight="64">
|
||||
<image source="../Img/AwesomeTileset.png" width="256" height="64"/>
|
||||
<image source="../Img/AwesomeTileset.png" width="256" height="128"/>
|
||||
</tileset>
|
||||
<layer name="Tile Layer 1" width="20" height="20">
|
||||
<data encoding="base64" compression="zlib">
|
||||
eJxjYWBgYMSCmdAwTJwFh3oQZsYjz4SDPRDmIWNi/ItNPcw8XHaRg2lhHjOa2aTS2NxHLTOHQviNmjdq3nAyj9oYABbJAjU=
|
||||
</data>
|
||||
</layer>
|
||||
<layer name="Tile Layer 2" width="20" height="20">
|
||||
<data encoding="base64" compression="zlib">
|
||||
eJxjYKAdYEXjs5FpDrn6KDGfHDth/mXDIobOJtY9xOqhBFAjfOnhzlEwCkbB4AIAbfMASQ==
|
||||
</data>
|
||||
</layer>
|
||||
</map>
|
||||
|
@ -33,9 +33,11 @@ void Layer::Draw(int xOffset, int yOffset) {
|
||||
for(int x = 0; x < _width; x++) {
|
||||
for(int y = 0; y < _height; y++) {
|
||||
MapTile& tile = GetTile(x, y);
|
||||
if(tile.tileset != NULL) {
|
||||
tile.tileset->DrawTile(tile.id, Vec2((float)x * _tileWidth, (float)y * _tileHeight));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -73,9 +73,13 @@ bool Level::Load(const std::string& filename) {
|
||||
const Tmx::Tileset* tmxTileset = map.FindTileset(tmxTile.gid);
|
||||
|
||||
MapTile tile;
|
||||
if(tmxTile.gid != 0) {
|
||||
tile.id = tmxTile.gid - tmxTileset->GetFirstGid();
|
||||
tile.tileset = tilesetMap.find(tmxTileset)->second;
|
||||
|
||||
} else {
|
||||
tile.id = 0;
|
||||
tile.tileset = NULL;
|
||||
}
|
||||
layer->SetTile(x, y, tile);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user