feat: add LPC-style rat assets, sprite generation scripts, and grid extraction tools
This commit is contained in:
+7
-3
@@ -195,8 +195,9 @@ class Rat(Unit):
|
||||
if not self.game.map.is_empty(cell_x, cell_y):
|
||||
return
|
||||
|
||||
# Use pre-calculated positions
|
||||
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)
|
||||
# bbox already updated in _update_render_position()
|
||||
#self.game.render_engine.draw_rectangle(self.bbox[0], self.bbox[1], self.bbox[2] - self.bbox[0], self.bbox[3] - self.bbox[1], "unit")
|
||||
|
||||
@@ -215,13 +216,16 @@ class Rat(Unit):
|
||||
if width <= 0 or height <= 0:
|
||||
return False
|
||||
|
||||
frame = min(3, int(self.partial_move * 4))
|
||||
actual_source_x = source_x + (frame * image_size[0])
|
||||
|
||||
self.game.render_engine.draw_image(
|
||||
self.render_x if draw_x is None else draw_x,
|
||||
self.render_y if draw_y is None else draw_y,
|
||||
image,
|
||||
anchor="nw",
|
||||
tag="unit",
|
||||
source_rect=(source_x, source_y, width, height),
|
||||
source_rect=(actual_source_x, source_y, width, height),
|
||||
dest_size=(width, height),
|
||||
)
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user