Marcamos Zona 0 con rayas amarillas-negras
This commit is contained in:
parent
41068b3c13
commit
fb017330c2
@ -41,7 +41,6 @@ def generate_sound(sound_type):
|
||||
buffer = array.array("h")
|
||||
|
||||
if sound_type == "shoot":
|
||||
# Disparo: Tono descendente agudo rápido
|
||||
duration = 0.1
|
||||
total_samples = int(sample_rate * duration)
|
||||
for i in range(total_samples):
|
||||
@ -53,7 +52,6 @@ def generate_sound(sound_type):
|
||||
buffer.append(sample)
|
||||
|
||||
elif sound_type == "hit":
|
||||
# Choque: Golpe sordo de baja frecuencia
|
||||
duration = 0.15
|
||||
total_samples = int(sample_rate * duration)
|
||||
for i in range(total_samples):
|
||||
@ -66,7 +64,6 @@ def generate_sound(sound_type):
|
||||
buffer.append(max(-32768, min(32767, sample)))
|
||||
|
||||
elif sound_type == "destroy":
|
||||
# Destrucción: Ruido de explosión corta
|
||||
duration = 0.2
|
||||
total_samples = int(sample_rate * duration)
|
||||
for i in range(total_samples):
|
||||
@ -92,6 +89,39 @@ def grid_to_iso(gx, gy, gz=0):
|
||||
return iso_x, iso_y
|
||||
|
||||
|
||||
def draw_hazard_tile(surface, pts):
|
||||
"""Dibuja una casilla isométrica con patrón de franjas amarillas y negras."""
|
||||
polygon_surf = pygame.Surface((TILE_WIDTH, TILE_HEIGHT), pygame.SRCALPHA)
|
||||
|
||||
min_x = min(p[0] for p in pts)
|
||||
min_y = min(p[1] for p in pts)
|
||||
local_pts = [(p[0] - min_x, p[1] - min_y) for p in pts]
|
||||
|
||||
# Fondo base amarillo
|
||||
pygame.draw.polygon(polygon_surf, (255, 200, 0), local_pts)
|
||||
|
||||
# Franjas diagonales negras
|
||||
stripe_width = 8
|
||||
for offset in range(-TILE_WIDTH, TILE_WIDTH * 2, stripe_width * 2):
|
||||
stripe_pts = [
|
||||
(offset, 0),
|
||||
(offset + stripe_width, 0),
|
||||
(offset + stripe_width - TILE_HEIGHT, TILE_HEIGHT),
|
||||
(offset - TILE_HEIGHT, TILE_HEIGHT)
|
||||
]
|
||||
pygame.draw.polygon(polygon_surf, (20, 20, 20), stripe_pts)
|
||||
|
||||
# Máscara para recortar al rombo isométrico
|
||||
mask_surf = pygame.Surface((TILE_WIDTH, TILE_HEIGHT), pygame.SRCALPHA)
|
||||
pygame.draw.polygon(mask_surf, (255, 255, 255, 255), local_pts)
|
||||
polygon_surf.blit(mask_surf, (0, 0), special_flags=pygame.BLEND_RGBA_MIN)
|
||||
|
||||
# Borde de la casilla
|
||||
pygame.draw.polygon(polygon_surf, (10, 10, 10), local_pts, 1)
|
||||
|
||||
surface.blit(polygon_surf, (min_x, min_y))
|
||||
|
||||
|
||||
def draw_isometric_prism(surface, color, width=40, height=35):
|
||||
"""Genera una superficie isométrica con forma de prisma o cubo."""
|
||||
surf = pygame.Surface((64, 64), pygame.SRCALPHA)
|
||||
@ -158,7 +188,6 @@ def create_placeholder_sprites():
|
||||
pygame.draw.circle(surf_vortex, (0, 0, 0), (32, 12), 8, 1)
|
||||
sprites["vortex"] = surf_vortex
|
||||
|
||||
# Bloques
|
||||
sprites["block_white"] = draw_isometric_prism(
|
||||
None, COLOR_WHITE, width=40, height=25
|
||||
)
|
||||
@ -166,7 +195,6 @@ def create_placeholder_sprites():
|
||||
None, COLOR_PURPLE, width=40, height=25
|
||||
)
|
||||
|
||||
# Enemigos
|
||||
sprites["enemy_indestructible"] = draw_isometric_prism(
|
||||
None, COLOR_WHITE, width=32, height=35
|
||||
)
|
||||
@ -370,8 +398,8 @@ class DiagonalEnemy(Enemy):
|
||||
def __init__(self, gx, gy):
|
||||
super().__init__(gx, gy, destructible=False)
|
||||
self.sprite_name = "enemy_diagonal"
|
||||
self.speed_x = 0.02 # Cambiado de 0.035 a 0.02
|
||||
self.speed_y = 0.02 # Cambiado de 0.035 a 0.02
|
||||
self.speed_x = 0.02
|
||||
self.speed_y = 0.02
|
||||
self.dir_x = 1
|
||||
self.dir_y = 1
|
||||
self.min_y = gy - 6
|
||||
@ -500,7 +528,7 @@ class Game:
|
||||
|
||||
def __init__(self):
|
||||
self.screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
|
||||
pygame.display.set_caption("Highway Vector - Edición Isométrica")
|
||||
pygame.display.set_caption("Highway Vector")
|
||||
self.clock = pygame.time.Clock()
|
||||
self.font = pygame.font.SysFont("monospace", 14, bold=True)
|
||||
self.big_font = pygame.font.SysFont("monospace", 28, bold=True)
|
||||
@ -515,7 +543,6 @@ class Game:
|
||||
self.reset_level()
|
||||
|
||||
def show_opening_screen(self):
|
||||
"""Muestra la pantalla explicativa inicial al ejecutar el juego."""
|
||||
while self.in_opening:
|
||||
self.clock.tick(FPS)
|
||||
for event in pygame.event.get():
|
||||
@ -528,7 +555,6 @@ class Game:
|
||||
|
||||
self.screen.fill((10, 10, 20))
|
||||
|
||||
# Título principal
|
||||
title_surf = self.title_font.render(
|
||||
"HIGHWAY VECTOR", True, COLOR_YELLOW
|
||||
)
|
||||
@ -537,7 +563,6 @@ class Game:
|
||||
(SCREEN_WIDTH // 2 - title_surf.get_width() // 2, 20),
|
||||
)
|
||||
|
||||
# Lista de elementos a mostrar
|
||||
items = [
|
||||
(
|
||||
"player",
|
||||
@ -572,17 +597,14 @@ class Game:
|
||||
for idx, (sprite_key, desc_text) in enumerate(items):
|
||||
y_pos = start_y + idx * spacing_y
|
||||
|
||||
# Dibujar imagen del elemento
|
||||
sprite = self.sprite_mgr.get_sprite(sprite_key)
|
||||
img_x = 60 - sprite.get_width() // 2
|
||||
img_y = y_pos + 12 - sprite.get_height() // 2
|
||||
self.screen.blit(sprite, (img_x, img_y))
|
||||
|
||||
# Dibujar texto descriptivo
|
||||
text_surf = self.font.render(desc_text, True, (230, 230, 230))
|
||||
self.screen.blit(text_surf, (110, y_pos + 4))
|
||||
|
||||
# Línea divisoria discreta entre filas
|
||||
if idx < len(items) - 1:
|
||||
pygame.draw.line(
|
||||
self.screen,
|
||||
@ -591,7 +613,6 @@ class Game:
|
||||
(SCREEN_WIDTH - 40, y_pos + spacing_y - 8),
|
||||
)
|
||||
|
||||
# Mensaje para comenzar con efecto de parpadeo suave
|
||||
blink = (pygame.time.get_ticks() // 400) % 2 == 0
|
||||
start_color = (0, 255, 200) if blink else (0, 150, 120)
|
||||
start_surf = self.big_font.render(
|
||||
@ -716,7 +737,7 @@ class Game:
|
||||
if self.lives <= 0:
|
||||
self.screen.fill((0, 0, 0))
|
||||
msg = self.font.render(
|
||||
"GAME OVER - Pulsa R para Reiniciar", True, (255, 50, 50)
|
||||
"GAME OVER - Press R to Restart", True, (255, 50, 50)
|
||||
)
|
||||
self.screen.blit(
|
||||
msg, (SCREEN_WIDTH // 2 - 150, SCREEN_HEIGHT // 2)
|
||||
@ -783,6 +804,11 @@ class Game:
|
||||
draw_y + TILE_HEIGHT // 2,
|
||||
),
|
||||
]
|
||||
|
||||
# Fila de meta (Zona 0) con señalización de peligro
|
||||
if gy == 0:
|
||||
draw_hazard_tile(self.screen, pts)
|
||||
else:
|
||||
pygame.draw.polygon(self.screen, COLOR_ROAD, pts)
|
||||
pygame.draw.polygon(self.screen, COLOR_GRID, pts, 1)
|
||||
|
||||
|
||||
BIN
img-versiones/version_final_04.png
Normal file
BIN
img-versiones/version_final_04.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
Loading…
x
Reference in New Issue
Block a user