summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/map.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/map.c b/src/map.c
index 09db505..78d5d05 100644
--- a/src/map.c
+++ b/src/map.c
@@ -575,7 +575,7 @@ _db_tmx_object_start(void *pv, const char *name, const char **attr)
if (db_xml_check_tag(name, "object")) {
db_xml_get_int_attr(p, attr, "gid", &map->obj_gid, 1);
db_xml_get_int_attr(p, attr, "x", &x, 1);
- db_xml_get_int_attr(p, attr, "x", &y, 1);
+ db_xml_get_int_attr(p, attr, "y", &y, 1);
db_xml_get_int_attr(p, attr, "width", &w, 1);
db_xml_get_int_attr(p, attr, "height", &h, 1);
if (w != h) {
@@ -583,8 +583,8 @@ _db_tmx_object_start(void *pv, const char *name, const char **attr)
XML_StopParser(p, XML_FALSE);
return;
}
- map->obj_x = (x + w) / 2;
- map->obj_y = (y + h) / 2;
+ map->obj_x = x + w / 2;
+ map->obj_y = y - h / 2; /* Object origin is BOTTOM left */
map->obj_r = w / 2;
db_xml_node_push(p, map, _db_tmx_object_properties_start,
_db_tmx_object_end, NULL);