Tweak colliders depth and collider rendering

This commit is contained in:
2023-11-09 09:41:27 +01:00
parent 913a365a21
commit ced7aa2ea5
4 changed files with 30 additions and 32 deletions

View File

@@ -72,15 +72,15 @@
"name":"", "name":"",
"objects":[ "objects":[
{ {
"height":16, "height":13,
"id":1, "id":1,
"name":"", "name":"",
"rotation":0, "rotation":0,
"type":"", "type":"",
"visible":true, "visible":true,
"width":16, "width":13,
"x":0, "x":3,
"y":0 "y":3
}], }],
"opacity":1, "opacity":1,
"type":"objectgroup", "type":"objectgroup",
@@ -99,7 +99,7 @@
"name":"", "name":"",
"objects":[ "objects":[
{ {
"height":16, "height":13,
"id":1, "id":1,
"name":"", "name":"",
"rotation":0, "rotation":0,
@@ -107,7 +107,7 @@
"visible":true, "visible":true,
"width":16, "width":16,
"x":0, "x":0,
"y":0 "y":3
}], }],
"opacity":1, "opacity":1,
"type":"objectgroup", "type":"objectgroup",
@@ -126,15 +126,15 @@
"name":"", "name":"",
"objects":[ "objects":[
{ {
"height":16, "height":13,
"id":1, "id":1,
"name":"", "name":"",
"rotation":0, "rotation":0,
"type":"", "type":"",
"visible":true, "visible":true,
"width":16, "width":13,
"x":0, "x":0,
"y":0 "y":3
}], }],
"opacity":1, "opacity":1,
"type":"objectgroup", "type":"objectgroup",
@@ -293,8 +293,8 @@
"rotation":0, "rotation":0,
"type":"", "type":"",
"visible":true, "visible":true,
"width":16, "width":13,
"x":0, "x":3,
"y":0 "y":0
}], }],
"opacity":1, "opacity":1,
@@ -358,7 +358,7 @@
"rotation":0, "rotation":0,
"type":"", "type":"",
"visible":true, "visible":true,
"width":16, "width":13,
"x":0, "x":0,
"y":0 "y":0
}], }],
@@ -544,14 +544,14 @@
"name":"", "name":"",
"objects":[ "objects":[
{ {
"height":16, "height":13,
"id":1, "id":1,
"name":"", "name":"",
"rotation":0, "rotation":0,
"type":"", "type":"",
"visible":true, "visible":true,
"width":16, "width":13,
"x":0, "x":3,
"y":0 "y":0
}], }],
"opacity":1, "opacity":1,
@@ -571,7 +571,7 @@
"name":"", "name":"",
"objects":[ "objects":[
{ {
"height":16, "height":13,
"id":1, "id":1,
"name":"", "name":"",
"rotation":0, "rotation":0,
@@ -598,13 +598,13 @@
"name":"", "name":"",
"objects":[ "objects":[
{ {
"height":16, "height":13,
"id":1, "id":1,
"name":"", "name":"",
"rotation":0, "rotation":0,
"type":"", "type":"",
"visible":true, "visible":true,
"width":16, "width":13,
"x":0, "x":0,
"y":0 "y":0
}], }],

View File

@@ -258,17 +258,15 @@ void bzTileMapDrawColliders(BzTileMap *map) {
switch (shape.type) { switch (shape.type) {
case BZ_TILE_SHAPE_NONE: case BZ_TILE_SHAPE_NONE:
break; default:
case BZ_TILE_SHAPE_POINT:
DrawCircle(posX, posY, 1.0f, color);
break; break;
case BZ_TILE_SHAPE_RECT: case BZ_TILE_SHAPE_RECT:
DrawRectangle(posX, posY, sizeX, sizeY, color); DrawRectangleLines(posX, posY, sizeX, sizeY, color);
break; break;
case BZ_TILE_SHAPE_ELLIPSE: case BZ_TILE_SHAPE_ELLIPSE:
sizeX *= 0.5f; sizeX *= 0.5f;
sizeY *= 0.5f; sizeY *= 0.5f;
DrawEllipse(posX + sizeX, posY + sizeY, sizeX, sizeY, color); DrawEllipseLines(posX + sizeX, posY + sizeY, sizeX, sizeY, color);
break; break;
} }
} }

View File

@@ -6,7 +6,7 @@
#define BZ_MAX_MAP_LAYERS 8 #define BZ_MAX_MAP_LAYERS 8
#define BZ_MAX_MAP_TILESETS 8 #define BZ_MAX_MAP_TILESETS 8
#define BZ_MAP_COLLIDER_DEPTH 3 #define BZ_MAP_COLLIDER_DEPTH 2
typedef struct BzTileLayer { typedef struct BzTileLayer {

View File

@@ -18,17 +18,17 @@
</tile> </tile>
<tile id="190" type="river"> <tile id="190" type="river">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/> <object id="1" x="3" y="3" width="13" height="13"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="191" type="river"> <tile id="191" type="river">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/> <object id="1" x="0" y="3" width="16" height="13"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="192" type="river"> <tile id="192" type="river">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/> <object id="1" x="0" y="3" width="13" height="13"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="194" type="river"> <tile id="194" type="river">
@@ -63,7 +63,7 @@
</tile> </tile>
<tile id="217" type="river"> <tile id="217" type="river">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/> <object id="1" x="3" y="0" width="13" height="16"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="218" type="river"> <tile id="218" type="river">
@@ -74,7 +74,7 @@
<tile id="219" type="river"> <tile id="219" type="river">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/> <object id="1" x="0" y="0" width="16" height="16"/>
<object id="2" x="0" y="0" width="16" height="16"/> <object id="2" x="0" y="0" width="13" height="16"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="220" type="river"/> <tile id="220" type="river"/>
@@ -115,17 +115,17 @@
</tile> </tile>
<tile id="244" type="river"> <tile id="244" type="river">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/> <object id="1" x="3" y="0" width="13" height="13"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="245" type="river"> <tile id="245" type="river">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/> <object id="1" x="0" y="0" width="16" height="13"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="246" type="river"> <tile id="246" type="river">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/> <object id="1" x="0" y="0" width="13" height="13"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="248" type="river"> <tile id="248" type="river">