From 1627f58103c7d9a0b6c7d22c4eb3dfe16f2a8139 Mon Sep 17 00:00:00 2001 From: Matteo Benedetto Date: Sat, 27 Jun 2026 18:42:46 +0200 Subject: [PATCH] Fix rat sprite strip artifact inside internal tunnel cells After merging new-newnassets, the rat sprite assets are now horizontal 4-frame sprite sheets (e.g. BMP_MALE_UP.png is 80x40 instead of 20x40). The drawing path for rats inside internal tunnel passages still called draw_image() without source_rect, so the engine rendered all 4 frames side by side as a single wide strip (the visual artifact shown in /tmp/pi-clipboard-...png). This brings the tunnel-internal rendering in line with the non-tunnel path, which already used source_rect = (frame * w, 0, w, h). --- units/rat.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/units/rat.py b/units/rat.py index fb5b8fe..df31f1d 100644 --- a/units/rat.py +++ b/units/rat.py @@ -202,7 +202,9 @@ class Rat(Unit): return # Internal tunnel passage or crossroad: draw the rat normally # so it stays visible while walking through the tunnel. - self.game.render_engine.draw_image(self.render_x, self.render_y, image, anchor="nw", tag="unit") + frame = min(3, int(self.partial_move * 4)) + source_rect = (frame * image_size[0], 0, image_size[0], image_size[1]) + self.game.render_engine.draw_image(self.render_x, self.render_y, image, anchor="nw", tag="unit", source_rect=source_rect) return if not self.game.map.is_empty(cell_x, cell_y): return