Ordenacion 3D correcta para evitar 'montaje de objetos'

This commit is contained in:
luisgulo 2026-10-04 15:26:44 +02:00
parent cd43dc8e3e
commit 8bfff12745
2 changed files with 6 additions and 2 deletions

View File

@ -171,8 +171,12 @@ class Entity:
screen_x, screen_y = grid_to_iso(self.gx, self.gy, self.gz)
sprite = sprite_mgr.get_sprite(self.sprite_name, self.filename)
# Centrar horizontalmente respecto a la casilla
draw_x = screen_x + camera_offset_x - (sprite.get_width() // 2)
draw_y = screen_y + camera_offset_y - (sprite.get_height() // 2)
# Anclar en la BASE de la casilla (no en el centro) para que no se "hunda"
draw_y = (
screen_y + camera_offset_y - sprite.get_height() + (TILE_HEIGHT // 2)
)
surface.blit(sprite, (draw_x, draw_y))
@ -512,7 +516,7 @@ class Game:
all_drawables = self.entities + self.bullets + self.spares
sorted_entities = sorted(
all_drawables, key=lambda e: e.gy, reverse=True
all_drawables, key=lambda e: e.gy + e.gx
)
for entity in sorted_entities:
entity.draw(

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB