Fixed tile objects rendering

This commit is contained in:
2023-11-11 09:35:05 +01:00
parent afb8e93f15
commit 10e47a6ad4
5 changed files with 33 additions and 4 deletions

View File

@@ -8,6 +8,27 @@
"tilecount":4096,
"tiledversion":"1.10.2",
"tileheight":16,
"tiles":[
{
"id":0,
"type":"worker"
},
{
"id":1,
"type":"worker"
},
{
"id":2,
"type":"worker"
},
{
"id":3,
"type":"worker"
},
{
"id":64,
"type":"axe"
}],
"tilewidth":16,
"type":"tileset",
"version":"1.10"

View File

@@ -384,8 +384,8 @@
"type":"",
"visible":true,
"width":10,
"x":1095.25,
"y":405.75
"x":1155.52083333333,
"y":473.416666666667
}],
"opacity":1,
"type":"objectgroup",

View File

@@ -347,7 +347,7 @@ static void drawObjectLayer(BzTileObjectGroup *objectLayer, BzTileset *tileset)
case BZ_TILE_SHAPE_RECT:
if (object.gid) {
Rectangle rec = bzTilesetGetTileRegion(tileset, object.gid);
Rectangle dest = {shape.x, shape.y, shape.sizeX, shape.sizeY};
Rectangle dest = {shape.x, shape.y - shape.sizeY, shape.sizeX, shape.sizeY};
DrawTexturePro(tileset->tiles, rec, dest, (Vector2) {0.0f, 0.0f}, 0.0f, WHITE);
} else {
DrawRectangle(shape.x, shape.y, shape.sizeX, shape.sizeY, color);

View File

@@ -1,4 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.2" name="entities" tilewidth="16" tileheight="16" tilecount="4096" columns="64">
<editorsettings>
<export target="../assets/entities.tsj" format="json"/>
</editorsettings>
<image source="../assets/entities.png" width="1024" height="1024"/>
<tile id="0" type="worker"/>
<tile id="1" type="worker"/>
<tile id="2" type="worker"/>
<tile id="3" type="worker"/>
<tile id="64" type="axe"/>
</tileset>

View File

@@ -331,7 +331,7 @@
</data>
</layer>
<objectgroup id="31" name="Entities">
<object id="19728" gid="1322" x="1095.25" y="405.75" width="10" height="10"/>
<object id="19728" gid="1322" x="1155.52" y="473.417" width="10" height="10"/>
</objectgroup>
<objectgroup id="28" name="Game">
<object id="19726" name="camera" x="1048" y="476">