diff options
author | P. J. McDermott <pj@pehjota.net> | 2021-03-25 18:57:35 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2021-03-25 18:57:35 (EDT) |
commit | 0b3f4d7ab07dd9430bd34d423d73eada2d77b3dc (patch) | |
tree | 30cd6df89b47dc2f3279ddad884c2bedb79da3b7 | |
parent | fed0f2cf2d47f55e1d6e16966e4983fe3c828745 (diff) | |
download | dodge-balls-0b3f4d7ab07dd9430bd34d423d73eada2d77b3dc.zip dodge-balls-0b3f4d7ab07dd9430bd34d423d73eada2d77b3dc.tar.gz dodge-balls-0b3f4d7ab07dd9430bd34d423d73eada2d77b3dc.tar.bz2 |
map: Fix object coordinates
-rw-r--r-- | src/map.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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); |