From 0b3f4d7ab07dd9430bd34d423d73eada2d77b3dc Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 25 Mar 2021 18:57:35 -0400 Subject: map: Fix object coordinates --- 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); -- cgit v0.9.1