Skip to content

Commit

Permalink
fix: objects position for Diamond Isometric maps
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien-bon committed Sep 3, 2024
1 parent e3f4e53 commit 839110b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 839110b

Please sign in to comment.