From 839110b0dbe1748eb6e827c16e149dc3b6f9435e Mon Sep 17 00:00:00 2001 From: Adrien BON <63343541+adrien-bon@users.noreply.github.com> Date: Tue, 3 Sep 2024 20:20:37 +0000 Subject: [PATCH] fix: objects position for Diamond Isometric maps --- src/loader.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/loader.rs b/src/loader.rs index 5455521..4671454 100644 --- a/src/loader.rs +++ b/src/loader.rs @@ -849,6 +849,16 @@ fn load_objects_layer( object_data.x - grid_size.x / 2., map_size.y as f32 * grid_size.y * 0.75 + grid_size.y / 4. - object_data.y, ), + TilemapType::Isometric(IsoCoordSystem::Diamond) => Vec2::new( + ((object_data.x - object_data.y) / grid_size.y + map_size.y as f32) * grid_size.x + / 2., + (map_size.y as f32 + - object_data.x / grid_size.y + - object_data.y / grid_size.y + - 1.) + * grid_size.y + / 2., + ), _ => Vec2::new( object_data.x, map_size.y as f32 * grid_size.y - object_data.y,