(Underdepths) Pass 5
This commit is contained in:
53 files changed
+5020
No files matched your search
@@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Fairly-framed screenshots for visual verification of the polish pass.
|
||||
|
||||
Reveals each floor (so explored-dim vs torch-lit is visible) and positions the
|
||||
player within sight of the key features (stairs, item+enemy, dragon).
|
||||
"""
|
||||
from __future__ import annotations
|
||||
import os, sys
|
||||
os.environ.setdefault("SDL_VIDEODRIVER", "dummy"); os.environ.setdefault("SDL_AUDIODRIVER", "dummy")
|
||||
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))); sys.path.insert(0, ROOT)
|
||||
import pygame; pygame.init()
|
||||
from main import new_game, SCREEN_W, SCREEN_H
|
||||
from data import enemies as E, items as I
|
||||
from engine.fov import compute_fov
|
||||
from data.constants import SIGHT_RADIUS
|
||||
from render.renderer import Renderer
|
||||
from render.camera import Camera
|
||||
|
||||
SHOTS = os.path.join(ROOT, ".shots"); os.makedirs(SHOTS, exist_ok=True)
|
||||
R = Renderer(); cam = Camera()
|
||||
|
||||
def reveal(gm):
|
||||
for y in range(gm.height):
|
||||
for x in range(gm.width):
|
||||
gm.explored[y][x] = True
|
||||
|
||||
def shoot(s, name):
|
||||
surf = pygame.Surface((SCREEN_W, SCREEN_H))
|
||||
cam.reset((s.player.x, s.player.y))
|
||||
off = cam.offset_for((SCREEN_W, SCREEN_H), (s.player.x, s.player.y))
|
||||
R.render(surf, s, camera_xy=off)
|
||||
p = os.path.join(SHOTS, name); pygame.image.save(surf, p); print(" saved", p)
|
||||
|
||||
# --- Scene 1: floor 0, player next to stairs, an item at feet, a goblin nearby ---
|
||||
s = new_game(seed=7); gm = s.dungeon[0]; reveal(gm)
|
||||
sx, sy = gm.stairs_down
|
||||
# stand on a walkable neighbor of stairs
|
||||
for (nx, ny) in ((sx-1, sy), (sx+1, sy), (sx, sy-1), (sx, sy+1)):
|
||||
if gm.walkable(nx, ny): s.player.x, s.player.y = nx, ny; break
|
||||
# place item under player + a goblin 2 tiles away
|
||||
gm.entities.append(I.make_item("short_sword", s.player.x, s.player.y))
|
||||
gx, gy = s.player.x, s.player.y
|
||||
for (ex, ey) in ((gx+2, gy), (gx-2, gy), (gx, gy+2)):
|
||||
if gm.walkable(ex, ey): gm.entities.append(E.make_enemy("goblin", ex, ey)); break
|
||||
shoot(s, "scene_stairs.png")
|
||||
|
||||
# --- Scene 2: a mid floor with a couple of distinct enemy types + an item ---
|
||||
s2 = new_game(seed=21); gm2 = s2.dungeon[4]; reveal(gm2); s2.current_floor = 4
|
||||
# center player on a walkable tile near middle
|
||||
px = py = 0
|
||||
for y in range(gm2.height):
|
||||
for x in range(gm2.width):
|
||||
if gm2.walkable(x, y): px, py = x, y; break
|
||||
if px: break
|
||||
s2.player.x, s2.player.y = px, py
|
||||
for i, (k, dx, dy) in enumerate([("skeleton_archer",2,0),("orc_warrior",-2,0),("wraith",0,2),("green_slime",0,-2)]):
|
||||
tx, ty = px+dx, py+dy
|
||||
if gm2.walkable(tx, ty): gm2.entities.append(E.make_enemy(k, tx, ty))
|
||||
gm2.entities.append(I.make_item("healing_potion", px, py))
|
||||
shoot(s2, "scene_enemies.png")
|
||||
|
||||
# --- Scene 3: floor 9 dragon, player within sight radius ---
|
||||
s3 = new_game(seed=3); gm3 = s3.dungeon[9]; reveal(gm3); s3.current_floor = 9
|
||||
dragon = next((e for e in gm3.entities if getattr(e, "kind","")=="ancient_dragon"), None)
|
||||
if dragon is None:
|
||||
dragon = E.make_enemy("ancient_dragon", 10, 7); gm3.entities.append(dragon)
|
||||
# place player within sight radius of the dragon
|
||||
for (dx, dy) in [(-5,0),(-6,0),(-4,0),(0,-5),(0,-6)]:
|
||||
tx, ty = dragon.x+dx, dragon.y+dy
|
||||
if 0<=tx<gm3.width and 0<=ty<gm3.height and gm3.walkable(tx, ty):
|
||||
s3.player.x, s3.player.y = tx, ty; break
|
||||
shoot(s3, "scene_dragon.png")
|
||||
print("done.")
|
||||
Reference in new issue
Block a user