Enhance blood stain mechanics: add dynamic blood surface generation and integrate blood stains into game rendering

This commit is contained in:
Matteo Benedetto
2025-08-13 23:30:43 +02:00
parent 689b21bf65
commit 243bb6d9bd
6 changed files with 155 additions and 15 deletions
+8 -2
View File
@@ -91,12 +91,18 @@ class Rat(Unit):
def die(self, unit=None, score=10):
"""Handle rat death and spawn points."""
target_unit = unit if unit else self
death_position = target_unit.position_before
# Use base class cleanup
if target_unit.id in self.game.units:
self.game.units.pop(target_unit.id)
# Rat-specific behavior: spawn points
self.game.spawn_unit(Point, target_unit.position_before, value=score)
# Rat-specific behavior: spawn points
self.game.spawn_unit(Point, death_position, value=score)
# Add blood stain directly to background
self.game.add_blood_stain(death_position)
def draw(self):
start_perf = self.game.render_engine.get_perf_counter()
direction = self.calculate_rat_direction()