Format code with black

This commit is contained in:
James Campbell
2026-08-01 12:19:46 -04:00
parent b0ad9610be
commit f29d8c953c
16 changed files with 459 additions and 311 deletions

View File

@@ -55,8 +55,8 @@ class Level:
# by the Game). (0, 0) in normal play, so nothing moves.
self.render_offset = (0, 0)
self.solids = [] # list[pygame.Rect] — full blocking
self.oneways = [] # list[pygame.Rect] — blocking only from above
self.solids = [] # list[pygame.Rect] — full blocking
self.oneways = [] # list[pygame.Rect] — blocking only from above
self.spawn = (self.tile, self.tile)
self.goal_rect = pygame.Rect(self.width - self.tile, 0, self.tile, self.tile)
@@ -144,8 +144,10 @@ class Level:
for rect in self.oneways:
surface.blit(oneway_img, rect.move(ox, oy))
surface.blit(assets.get("goal", self.goal_rect.w, self.goal_rect.h),
self.goal_rect.move(ox, oy))
surface.blit(
assets.get("goal", self.goal_rect.w, self.goal_rect.h),
self.goal_rect.move(ox, oy),
)
for tr in self.traps:
tr.render(surface, assets)
@@ -173,10 +175,12 @@ class Level:
# Shade the off-screen overscan so the real play area reads clearly.
view = pygame.Rect(ox, oy, self.width, self.height)
shade = (10, 12, 20, 130)
for band in (pygame.Rect(0, 0, sw, oy), # above
pygame.Rect(0, view.bottom, sw, sh - view.bottom), # below
pygame.Rect(0, oy, ox, self.height), # left
pygame.Rect(view.right, oy, sw - view.right, self.height)): # right
for band in (
pygame.Rect(0, 0, sw, oy), # above
pygame.Rect(0, view.bottom, sw, sh - view.bottom), # below
pygame.Rect(0, oy, ox, self.height), # left
pygame.Rect(view.right, oy, sw - view.right, self.height),
): # right
if band.w > 0 and band.h > 0:
overlay.fill(shade, band)
@@ -190,14 +194,16 @@ class Level:
pygame.draw.line(overlay, line, (0, k * t), (sw, k * t))
label = (150, 162, 190)
for k in range(sw // t):
overlay.blit(Level._grid_font.render(str(k - mx), True, label),
(k * t + 2, 1))
overlay.blit(
Level._grid_font.render(str(k - mx), True, label), (k * t + 2, 1)
)
for k in range(sh // t):
overlay.blit(Level._grid_font.render(str(k - my), True, label),
(1, k * t + 1))
overlay.blit(
Level._grid_font.render(str(k - my), True, label), (1, k * t + 1)
)
# Outline the actual runtime viewport (the level's true bounds).
if (mx or my):
if mx or my:
pygame.draw.rect(overlay, (95, 210, 235, 200), view, 2)
surface.blit(overlay, (0, 0))