♻️REFACTOR: Mejoras en la viabilidad para desarrollo

This commit is contained in:
Diego De la Viuda Llorente committed 2026-10-29 13:23:46 +01:00
1 parent 5aba6c7b47
commit fd0118d964
98 files changed
+5985 -3024

No files matched your search

+19 -20
View File
@@ -1,9 +1,8 @@
"""Regenerate Level 02's original pixel-art PNGs with Pillow.
"""Regenera los PNG originales de Level02 con Pillow.
Usage: python tools/generate_city_art.py
Only development-time Pillow is required. Godot uses the exported PNGs directly.
Everything is drawn on a low-resolution pixel grid, then resized with NEAREST.
"""
Uso: python tools/generate_city_art.py
Pillow solo se necesita para regenerar arte; Godot utiliza los PNG exportados.
Se dibuja sobre una cuadricula de baja resolucion y se amplia con NEAREST."""
from __future__ import annotations
@@ -14,7 +13,7 @@ from PIL import Image, ImageDraw, ImageFont
ROOT = Path(__file__).resolve().parents[1] / 'assets' / 'city'
ROOT.mkdir(parents=True, exist_ok=True)
SCALE = 2
W, H = 512, 640 # 1024x1280 world units after nearest-neighbour enlargement.
W, H = 512, 640 # 1024x1280 unidades tras ampliar sin suavizado.
INK = '#171d31'
SKY = ['#181e38', '#242844', '#32334f', '#4d4159', '#67505d']
FAR = ['#2b3048', '#30354e', '#353a53', '#3c3c54']
@@ -55,7 +54,7 @@ def windows(d, x0, top, x1, bottom, rng, lit_probability, tiny=False):
d.rectangle((xx - 1, yy + wh + 1, xx + ww + 1, yy + wh + 2), fill='#35384c')
# The base is fully opaque. No transparent gaps appear while jumping high.
# El fondo es totalmente opaco para evitar huecos transparentes al saltar alto.
sky = Image.new('RGB', (W, H), SKY[-1]); d = ImageDraw.Draw(sky)
for yy in range(H):
s = yy / H
@@ -72,13 +71,13 @@ for i in range(110):
x,y = rng.randrange(W), rng.randrange(0,275)
color = rng.choice(('#aaafc8','#888fad','#797f9d'))
d.rectangle((x,y,x+(i%19==0),y+(i%23==0)),fill=color)
# Offset glow and a pale disk: deliberately subdued so it never steals focus.
# Resplandor desplazado y disco palido: tenues para no distraer del juego.
for rad, col in [(55,'#524b69'), (42,'#655a74'),(30,'#847588'),(22,'#c2a39e')]:
d.ellipse((410-rad,178-rad,410+rad,178+rad), fill=col)
save(sky,'sky.png')
# Cloud silhouettes: one independent, slowly drifting parallax layer.
# Siluetas de nubes: capa de parallax independiente con desplazamiento lento.
clouds = image(); d=ImageDraw.Draw(clouds); rng=random.Random(97)
for cx,cy,rw,rh in [(90,218,65,18),(300,340,82,19),(482,280,55,17),(196,419,67,17)]:
for k in range(9):
@@ -94,7 +93,7 @@ for cx,cy,rw,rh in [(90,218,65,18),(300,340,82,19),(482,280,55,17),(196,419,67,1
save(clouds,'clouds.png')
# Silhouette skyline: repeatable at the 1024-unit horizontal seam.
# Siluetas de edificios repetibles en la union horizontal de 1024 unidades.
far=image(); d=ImageDraw.Draw(far); rng=random.Random(190)
x=0
while x<W:
@@ -109,7 +108,7 @@ while x<W:
save(far,'skyline_far.png')
# Mid-range neighbourhood: roofs, gutters, some illuminated windows.
# Barrio intermedio: tejados, canalones y algunas ventanas iluminadas.
mid=image(); d=ImageDraw.Draw(mid); rng=random.Random(317)
x=0
while x<W:
@@ -119,7 +118,7 @@ while x<W:
d.rectangle((x-2,y-7,xx+3,y),fill='#252b42')
d.rectangle((x+5,y-12,x+17,y-8),fill='#363b50')
windows(d,x,y,xx,H,rng,.34)
# Awnings and air-conditioning boxes establish a recognisable city profile.
# Toldos y aparatos de aire acondicionado dan una silueta urbana reconocible.
if ww>85:
d.rectangle((x+ww//2-15,y-17,x+ww//2+23,y-8),fill='#36394e')
d.rectangle((x+ww//2-12,y-24,x+ww//2+20,y-18),fill='#5f6074')
@@ -127,8 +126,8 @@ while x<W:
save(mid,'skyline_mid.png')
# Facades are separate reusable transparent PNGs. They can be moved individually
# in the level editor without needing to regenerate a single huge background.
# Las fachadas son PNG transparentes reutilizables. Se colocan individualmente
# en el editor sin regenerar una imagen enorme de todo el fondo.
font=ImageFont.truetype(str(FONT_PATH), 11) if FONT_PATH.exists() else ImageFont.load_default()
styles=[
('SALA RUIDO', 108, 245, '#565369', '#8f596a'),
@@ -140,7 +139,7 @@ styles=[
]
for idx,(sign,bw,bh,main,accent) in enumerate(styles):
rng=random.Random(900+idx); img=Image.new('RGBA',(bw,bh),(0,0,0,0)); dd=ImageDraw.Draw(img)
# Main mass and pixel masonry.
# Volumen principal y ladrillos pixelados.
dd.rectangle((3,11,bw-3,bh-1),fill=main)
dd.rectangle((0,7,bw-1,13),fill='#30364b')
dd.rectangle((4,14,bw-6,17),fill='#787388')
@@ -148,7 +147,7 @@ for idx,(sign,bw,bh,main,accent) in enumerate(styles):
for xx in range(7+(yy//12%2)*5,bw-7,19):
dd.line((xx, yy,xx+11,yy),fill='#6a657a',width=1)
windows(dd,2,15,bw-3,bh,rng,.45)
# Shop front, rolling shutters, and a neon venue sign.
# Escaparate, persianas enrollables y cartel de neon.
dd.rectangle((8,bh-49,bw-9,bh-2),fill='#30344b')
dd.rectangle((bw//2-15,bh-45,bw//2+14,bh-3),fill='#515064')
dd.rectangle((bw//2-12,bh-43,bw//2+11,bh-6),fill='#242a40')
@@ -160,9 +159,9 @@ for idx,(sign,bw,bh,main,accent) in enumerate(styles):
if signw>20:
bbox=dd.textbbox((0,0),sign,font=font)
tw=bbox[2]-bbox[0]
# Pixel text is clipped intentionally if a deliberately long sign occurs.
# Los textos demasiado largos se recortan deliberadamente.
dd.text(((bw-tw)//2,32),sign,font=font,fill='#f7ca85')
# Vent pipe, satellite/radio antenna, fire exit.
# Ventilacion, antena y salida de incendios.
dd.rectangle((bw-20,1,bw-16,11),fill='#31384d')
dd.rectangle((bw-26,1,bw-9,3),fill='#747082')
dd.rectangle((bw-10,bh//2,bw-4,bh//2+41),fill='#3a4056')
@@ -171,7 +170,7 @@ for idx,(sign,bw,bh,main,accent) in enumerate(styles):
save(img,f'facade_{idx+1:02d}.png')
# Game terrain tiles, also authored pixel-by-pixel. Each is seamless in X/Y.
# Texturas de terreno dibujadas pixel a pixel y repetibles en X/Y.
road=Image.new('RGBA',(64,64),'#292f40');d=ImageDraw.Draw(road);rng=random.Random(87)
for gy in range(0,64,16):
for gx in range(0,64,32):
@@ -203,7 +202,7 @@ for y in (13,34,55):
d.rectangle((0,77,23,79),fill='#202838')
save(barrier,'barrier.png')
# A compact pavement prop, reused sparingly in the actual scene.
# Decoracion compacta de acera, repetida con moderacion en la escena.
lamp=Image.new('RGBA',(48,176),(0,0,0,0));d=ImageDraw.Draw(lamp)
d.rectangle((25,27,28,175),fill='#373e56')
d.rectangle((17,24,34,31),fill='#4f5267')