(Underdepths) Prepare for Pass 4

This commit is contained in:
AlexKucera committed 2026-08-13 09:05:25 +02:00
1 parent e2a47aba6b
commit 8249da7e9b
33 files changed
+123 -4173

No files matched your search

-18
View File
@@ -1,18 +0,0 @@
"""Camera: viewport offset that follows the player, clamped to the map."""
from __future__ import annotations
from dataclasses import dataclass
@dataclass(slots=True)
class Camera:
x: int = 0
y: int = 0
def follow(self, target_x: int, target_y: int, view_w: int, view_h: int,
map_w: int, map_h: int) -> None:
self.x = target_x - view_w // 2
self.y = target_y - view_h // 2
self.x = max(0, min(self.x, max(0, map_w - view_w)))
self.y = max(0, min(self.y, max(0, map_h - view_h)))