Add missing collisions to buildings

This commit is contained in:
2023-11-12 11:24:59 +01:00
parent 10e47a6ad4
commit df5e65f9d7
3 changed files with 809 additions and 29 deletions

View File

@@ -173,34 +173,218 @@
}, },
{ {
"id":6, "id":6,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"mine" "type":"mine"
}, },
{ {
"id":7, "id":7,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"mine" "type":"mine"
}, },
{ {
"id":8, "id":8,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"baracks" "type":"baracks"
}, },
{ {
"id":9, "id":9,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"baracks" "type":"baracks"
}, },
{ {
"id":10, "id":10,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"orchard" "type":"orchard"
}, },
{ {
"id":11, "id":11,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"orchard" "type":"orchard"
}, },
{ {
"id":12, "id":12,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"animal_farm" "type":"animal_farm"
}, },
{ {
"id":13, "id":13,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"animal_farm" "type":"animal_farm"
}, },
{ {
@@ -298,34 +482,229 @@
}, },
{ {
"id":38, "id":38,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"mine" "type":"mine"
}, },
{ {
"id":39, "id":39,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"mine" "type":"mine"
}, },
{ {
"id":40, "id":40,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"baracks" "type":"baracks"
}, },
{ {
"id":41, "id":41,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"baracks" "type":"baracks"
}, },
{ {
"id":42, "id":42,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
},
{
"height":16,
"id":2,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"orchard" "type":"orchard"
}, },
{ {
"id":43, "id":43,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"orchard" "type":"orchard"
}, },
{ {
"id":44, "id":44,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"animal_farm" "type":"animal_farm"
}, },
{ {
"id":45, "id":45,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"animal_farm" "type":"animal_farm"
}, },
{ {
@@ -415,22 +794,148 @@
}, },
{ {
"id":67, "id":67,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"smithy" "type":"smithy"
}, },
{ {
"id":68, "id":68,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"smithy" "type":"smithy"
}, },
{ {
"id":72, "id":72,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"workshop" "type":"workshop"
}, },
{ {
"id":73, "id":73,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"workshop" "type":"workshop"
}, },
{ {
"id":74, "id":74,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
},
{
"height":16,
"id":2,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"farm" "type":"farm"
}, },
{ {
@@ -439,30 +944,191 @@
}, },
{ {
"id":97, "id":97,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"wall" "type":"wall"
}, },
{ {
"id":98, "id":98,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"gatehouse" "type":"gatehouse"
}, },
{ {
"id":128, "id":128,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"tower" "type":"tower"
}, },
{ {
"id":129, "id":129,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"tower" "type":"tower"
}, },
{ {
"id":130, "id":130,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"small_tower" "type":"small_tower"
}, },
{ {
"id":160, "id":160,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"tower" "type":"tower"
}, },
{ {
"id":161, "id":161,
"objectgroup":
{
"draworder":"index",
"id":2,
"name":"",
"objects":[
{
"height":16,
"id":1,
"name":"",
"rotation":0,
"type":"",
"visible":true,
"width":16,
"x":0,
"y":0
}],
"opacity":1,
"type":"objectgroup",
"visible":true,
"x":0,
"y":0
},
"type":"tower" "type":"tower"
}], }],
"tilewidth":16, "tilewidth":16,

View File

@@ -286,7 +286,7 @@ void render(float dt, Game *game) {
DrawRectangleLines(tileX * 16, tileY * 16, sizeX * 16, sizeY * 16, placeColor); DrawRectangleLines(tileX * 16, tileY * 16, sizeX * 16, sizeY * 16, placeColor);
if (canPlace && IsMouseButtonDown(MOUSE_BUTTON_LEFT)) { if (canPlace && IsMouseButtonDown(MOUSE_BUTTON_LEFT) && !io->WantCaptureMouse) {
placeBuilding(&game->map, selectedBuilding, tileX, tileY, sizeX, sizeY); placeBuilding(&game->map, selectedBuilding, tileX, tileY, sizeX, sizeY);
} }

View File

@@ -34,14 +34,46 @@
<object id="1" x="0" y="0" width="16" height="16"/> <object id="1" x="0" y="0" width="16" height="16"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="6" type="mine"/> <tile id="6" type="mine">
<tile id="7" type="mine"/> <objectgroup draworder="index" id="2">
<tile id="8" type="baracks"/> <object id="1" x="0" y="0" width="16" height="16"/>
<tile id="9" type="baracks"/> </objectgroup>
<tile id="10" type="orchard"/> </tile>
<tile id="11" type="orchard"/> <tile id="7" type="mine">
<tile id="12" type="animal_farm"/> <objectgroup draworder="index" id="2">
<tile id="13" type="animal_farm"/> <object id="1" x="0" y="0" width="16" height="16"/>
</objectgroup>
</tile>
<tile id="8" type="baracks">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/>
</objectgroup>
</tile>
<tile id="9" type="baracks">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/>
</objectgroup>
</tile>
<tile id="10" type="orchard">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/>
</objectgroup>
</tile>
<tile id="11" type="orchard">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/>
</objectgroup>
</tile>
<tile id="12" type="animal_farm">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/>
</objectgroup>
</tile>
<tile id="13" type="animal_farm">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/>
</objectgroup>
</tile>
<tile id="31" type="player_red"/> <tile id="31" type="player_red"/>
<tile id="32" type="keep"> <tile id="32" type="keep">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
@@ -60,14 +92,47 @@
</tile> </tile>
<tile id="35" type="fletcher"/> <tile id="35" type="fletcher"/>
<tile id="36" type="fletcher"/> <tile id="36" type="fletcher"/>
<tile id="38" type="mine"/> <tile id="38" type="mine">
<tile id="39" type="mine"/> <objectgroup draworder="index" id="2">
<tile id="40" type="baracks"/> <object id="1" x="0" y="0" width="16" height="16"/>
<tile id="41" type="baracks"/> </objectgroup>
<tile id="42" type="orchard"/> </tile>
<tile id="43" type="orchard"/> <tile id="39" type="mine">
<tile id="44" type="animal_farm"/> <objectgroup draworder="index" id="2">
<tile id="45" type="animal_farm"/> <object id="1" x="0" y="0" width="16" height="16"/>
</objectgroup>
</tile>
<tile id="40" type="baracks">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/>
</objectgroup>
</tile>
<tile id="41" type="baracks">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/>
</objectgroup>
</tile>
<tile id="42" type="orchard">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/>
<object id="2" x="0" y="0" width="16" height="16"/>
</objectgroup>
</tile>
<tile id="43" type="orchard">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/>
</objectgroup>
</tile>
<tile id="44" type="animal_farm">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/>
</objectgroup>
</tile>
<tile id="45" type="animal_farm">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/>
</objectgroup>
</tile>
<tile id="63" type="player_blue"/> <tile id="63" type="player_blue"/>
<tile id="64" type="keep"> <tile id="64" type="keep">
<objectgroup draworder="index" id="2"> <objectgroup draworder="index" id="2">
@@ -84,17 +149,66 @@
<object id="1" x="0" y="0" width="16" height="16"/> <object id="1" x="0" y="0" width="16" height="16"/>
</objectgroup> </objectgroup>
</tile> </tile>
<tile id="67" type="smithy"/> <tile id="67" type="smithy">
<tile id="68" type="smithy"/> <objectgroup draworder="index" id="2">
<tile id="72" type="workshop"/> <object id="1" x="0" y="0" width="16" height="16"/>
<tile id="73" type="workshop"/> </objectgroup>
<tile id="74" type="farm"/> </tile>
<tile id="68" type="smithy">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/>
</objectgroup>
</tile>
<tile id="72" type="workshop">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/>
</objectgroup>
</tile>
<tile id="73" type="workshop">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/>
</objectgroup>
</tile>
<tile id="74" type="farm">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/>
<object id="2" x="0" y="0" width="16" height="16"/>
</objectgroup>
</tile>
<tile id="96" type="road"/> <tile id="96" type="road"/>
<tile id="97" type="wall"/> <tile id="97" type="wall">
<tile id="98" type="gatehouse"/> <objectgroup draworder="index" id="2">
<tile id="128" type="tower"/> <object id="1" x="0" y="0" width="16" height="16"/>
<tile id="129" type="tower"/> </objectgroup>
<tile id="130" type="small_tower"/> </tile>
<tile id="160" type="tower"/> <tile id="98" type="gatehouse">
<tile id="161" type="tower"/> <objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/>
</objectgroup>
</tile>
<tile id="128" type="tower">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/>
</objectgroup>
</tile>
<tile id="129" type="tower">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/>
</objectgroup>
</tile>
<tile id="130" type="small_tower">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/>
</objectgroup>
</tile>
<tile id="160" type="tower">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/>
</objectgroup>
</tile>
<tile id="161" type="tower">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="16" height="16"/>
</objectgroup>
</tile>
</tileset> </tileset>