aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-07-16 18:32:14 +0200
committermetamuffin <metamuffin@disroot.org>2024-07-16 18:32:14 +0200
commit4064c56783bd78b96b0e79d5a7b15b1fb0d8edad (patch)
treefb595c112c60886732b459ba5e2453440379cc50
parent511199443a419f549aeb500d7b013baef10152de (diff)
downloadhurrycurry-4064c56783bd78b96b0e79d5a7b15b1fb0d8edad.tar
hurrycurry-4064c56783bd78b96b0e79d5a7b15b1fb0d8edad.tar.bz2
hurrycurry-4064c56783bd78b96b0e79d5a7b15b1fb0d8edad.tar.zst
fix z-order problems partially
-rw-r--r--light-client/src/render/sprite.rs6
-rw-r--r--light-client/src/tilemap.rs2
2 files changed, 4 insertions, 4 deletions
diff --git a/light-client/src/render/sprite.rs b/light-client/src/render/sprite.rs
index 13ede525..c19f8392 100644
--- a/light-client/src/render/sprite.rs
+++ b/light-client/src/render/sprite.rs
@@ -10,13 +10,13 @@ pub struct Sprite {
impl Sprite {
pub fn new(src: Rect, anchor: Vec2, elevation: f32) -> Self {
let relative_dst = FRect::new(
- -anchor.x - (src.w as f32) / 32. / 2.,
- -anchor.y - (src.h as f32) / 24.,
+ anchor.x - (src.w as f32) / 32. / 2.,
+ anchor.y - (src.h as f32) / 24.,
(src.w as f32) / 32.,
(src.h as f32) / 24.,
);
Self {
- z_offset: -relative_dst.h + anchor.y - elevation,
+ z_offset: elevation,
src,
relative_dst,
}
diff --git a/light-client/src/tilemap.rs b/light-client/src/tilemap.rs
index cf8c5eef..e7341efa 100644
--- a/light-client/src/tilemap.rs
+++ b/light-client/src/tilemap.rs
@@ -77,7 +77,7 @@ impl Tilemap {
let src = self.tile_srcs[tile.0][idx];
self.tiles
- .insert(pos, Sprite::new_tile(src).at(pos.as_vec2() + 0.5));
+ .insert(pos, Sprite::new_tile(src).at(pos.as_vec2()));
}
pub fn draw(&self, ctx: &mut SpriteRenderer) {