Enhance blood stain mechanics: add dynamic blood surface generation and integrate blood stains into game rendering
This commit is contained in:
@@ -71,14 +71,12 @@ class Timer(Bomb):
|
||||
for victim in self.game.unit_positions.get((x, y), []):
|
||||
if victim.id in self.game.units:
|
||||
if victim.partial_move >= 0.5:
|
||||
print(f"Victim {victim.id} at {x}, {y} dies")
|
||||
victim.die(score=score)
|
||||
if score < 160:
|
||||
score *= 2
|
||||
for victim in self.game.unit_positions_before.get((x, y), []):
|
||||
if victim.id in self.game.units:
|
||||
if victim.partial_move < 0.5:
|
||||
print(f"Victim {victim.id} at {x}, {y} dies")
|
||||
victim.die(score=score)
|
||||
if score < 160:
|
||||
score *= 2
|
||||
|
||||
+8
-2
@@ -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()
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ class Unit(ABC):
|
||||
"""Handle collisions with other units. Default implementation does nothing."""
|
||||
pass
|
||||
|
||||
def die(self):
|
||||
def die(self, score=None):
|
||||
"""Remove unit from game and handle basic cleanup."""
|
||||
if self.id in self.game.units:
|
||||
self.game.units.pop(self.id)
|
||||
|
||||
Reference in New Issue
Block a user