Timeout-Fix: Levelzeit 0 loest Sterbeanimation + Leben-Abzug aus, Respawn mit frischer Zeit

This commit is contained in:
2026-07-26 10:48:46 +02:00
parent 696e3c1d8e
commit b9532758cb
2 changed files with 19 additions and 1 deletions
+10 -1
View File
@@ -780,6 +780,15 @@ def run_level(clock, assets, audio_paths, map_name='W1L1'):
vx=55.0 * player.facing, t=0.0))
keys = pygame.key.get_pressed()
time_left = info['time'] - (time.monotonic() - start)
# Zeit abgelaufen -> wie Herzen leer: Sterbeanimation, Leben -1
# (Stefans Fund: "bei 0 wird mir kein Leben abgezogen")
if dying is None and time_left <= 0:
hearts = 0
player.hurt_t = 0.0
player.force_slot = SLOT_DEATH
dying = dict(t=0.0, vy=-260.0,
drop_y=player.y - 40.0, drop_vy=-30.0)
if dying is None:
player.update(level, dt, keys)
else:
@@ -800,6 +809,7 @@ def run_level(clock, assets, audio_paths, map_name='W1L1'):
player.x, player.y = spawn_px
player.vy = 0.0
player.spawn_t = SPAWN_ANIM_SECONDS
start = time.monotonic() # neuer Versuch = frische Levelzeit
# Tuer-Sequenz: offen zeigen (Figur schaut rein), nach 1s die Aktion
if door_open_t is not None:
@@ -908,7 +918,6 @@ def run_level(clock, assets, audio_paths, map_name='W1L1'):
overlay.fill(WATER_TINT)
canvas.blit(overlay, (0, top))
time_left = info['time'] - (time.monotonic() - start)
hud.draw(canvas, VIEW_H, player.d, cookies=0, score=0,
hearts=hearts, lives=lives, time_left=time_left)