Merge pull request 'Nivel de prueba reimplementado' (#23) from feature/ia_automated_test into main
Android Debug APK / build (push) Successful in 39s

Reviewed-on: #23
This commit was merged in pull request #23.
This commit is contained in:
ankdev committed 2026-10-21 09:03:34 +00:00
commit a77829fa06
24 files changed
+2372 -152

No files matched your search

+4
View File
@@ -4,3 +4,7 @@
# Local export artifacts # Local export artifacts
build/ build/
# Python-only static checks for the level resources
__pycache__/
*.pyc
+31 -6
View File
@@ -1882,10 +1882,15 @@ Actualizar esta sección conforme avance el proyecto.
- Vida, daño, knockback, invulnerabilidad breve y muerte/reinicio del jugador. - Vida, daño, knockback, invulnerabilidad breve y muerte/reinicio del jugador.
- CharacterData con cuatro recursos: singer, guitarist, bassist y drummer. - CharacterData con cuatro recursos: singer, guitarist, bassist y drummer.
- Los cuatro personajes usan provisionalmente las mismas animaciones idle/walk de Diego. - Los cuatro personajes usan provisionalmente las mismas animaciones idle/walk de Diego.
- Primer enemigo Walker: patrulla, gira en paredes/bordes, hace daño por contacto, - Walker: persigue y ataca con animacion temporal de aviso, recibe dano y muere.
recibe daño y muere. - Cinco apariencias humanoides del enemigo (roadie, fan del pogo, tecnico,
guardia y guitarrista rival) con SVG originales y estadisticas propias.
- Level 01 ampliado a 8500 unidades, 17 encuentros de recompensa fija sin
respawn y varias plataformas opcionales para probar la movilidad.
- Hurtboxes y zonas de ataque visibles en modo debug con rojo semitransparente. - Hurtboxes y zonas de ataque visibles en modo debug con rojo semitransparente.
- Sala levels/test/combat_test.tscn para probar el combate. - Sala levels/test/combat_test.tscn para probar el combate.
- Objetos recolectables configurables, curacion y siete buffs/cargas distintos.
- HUD de mejoras activas y contador de objetos realmente recogidos en Level 01.
- Controles táctiles provisionales para Android usando las mismas acciones del InputMap. - Controles táctiles provisionales para Android usando las mismas acciones del InputMap.
- Preset Android preparado para generar un APK arm64 de pruebas. - Preset Android preparado para generar un APK arm64 de pruebas.
- Script scripts/export_android_debug.sh para exportar el APK desde un servidor sin GUI. - Script scripts/export_android_debug.sh para exportar el APK desde un servidor sin GUI.
@@ -1897,7 +1902,9 @@ Actualizar esta sección conforme avance el proyecto.
- Probar y ajustar tamaños/offsets de hurtboxes e hitboxes jugando la sala de combate. - Probar y ajustar tamaños/offsets de hurtboxes e hitboxes jugando la sala de combate.
- Sustituir las animaciones provisionales cuando exista arte para cada integrante. - Sustituir las animaciones provisionales cuando exista arte para cada integrante.
- Probar tamaños y colocación de los controles táctiles en varios teléfonos. - Probar tamaños y colocación de los controles táctiles en varios teléfonos.
- Añadir UI provisional de vida si hace falta para seguir afinando el combate. - Validar la ruta de Level 01 en una APK real: todos los 17 objetos y el
acceso a las plataformas elevadas.
- Ajustar posicion/tamano de los HUDs y controles para distintas pantallas.
``` ```
## LATER ## LATER
@@ -1905,7 +1912,7 @@ Actualizar esta sección conforme avance el proyecto.
```text ```text
- diferencias particulares entre personajes; - diferencias particulares entre personajes;
- invisibilidad del bajista; - invisibilidad del bajista;
- power-ups adicionales; - coleccionables secretos;
- definición completa de capítulos; - definición completa de capítulos;
- bosses; - bosses;
- easter eggs; - easter eggs;
@@ -1953,9 +1960,27 @@ El objetivo principal es siempre tener una versión pequeña pero completamente
- **Implementado:** 17 objetos configurables (`pickups/data/`) con SVG originales de 32×32 (16×16 visibles), textos breves y efectos. - **Implementado:** 17 objetos configurables (`pickups/data/`) con SVG originales de 32×32 (16×16 visibles), textos breves y efectos.
- **Implementado:** curación, velocidad, daño, carga del especial, bloqueo de un golpe, reducción de daño, altura de salto y daño aéreo. - **Implementado:** curación, velocidad, daño, carga del especial, bloqueo de un golpe, reducción de daño, altura de salto y daño aéreo.
- **Implementado:** tabla de drops ponderados de Walker; 50% de probabilidad de un objeto por muerte. - **Implementado:** tabla de drops ponderados de Walker; 50% de probabilidad de un objeto por muerte.
- **Implementado:** el objeto del primer nivel usa el mismo sistema que los demás, sin alterar `CharacterData`. - **Implementado:** `level_01.tscn` es ahora un laboratorio de objetos con 17 enemigos,
- **Pendiente:** indicadores persistentes de mejoras activas, coleccionables secretos, pruebas visuales en el editor y equilibrado. 17 drops garantizados diferentes, ninguno reaparece, y 5 variantes visuales
originales con un unico comportamiento Walker.
- **Implementado:** indicador de mejoras activas con duracion/escudo, contador
de objetos recogidos y limites de camara adaptados al nivel largo.
- **Implementado:** especial con radio configurable (290 en el laboratorio),
sin modificar el alcance por defecto en el resto de escenas.
- **Pendiente:** coleccionables secretos, test visual en Godot/Android,
equilibrio y sprites/animaciones definitivas.
Catálogo, pesos, estados e instrucciones: **[docs/items.md](docs/items.md)**. Catálogo, pesos, estados e instrucciones: **[docs/items.md](docs/items.md)**.
Recorrido de Android (17 estaciones, orden y checklist):
**[docs/test_level_01.md](docs/test_level_01.md)**.
Comprobacion estatica reproducible (sin arrancar Godot):
`python -m unittest discover -s tests -v`.
La escena de inicio del proyecto ya es `levels/level_01.tscn`.
Para exportar una APK de pruebas, revisa las instrucciones de
`scripts/export_android_debug.sh` y el preset de Android (requiere SDK y
plantillas Godot configuradas localmente).
> Importante: el proyecto contiene un prototipo jugable y arte provisional; la implementación no sustituye una prueba real en Godot ni garantiza una clasificación por edades concreta. > Importante: el proyecto contiene un prototipo jugable y arte provisional; la implementación no sustituye una prueba real en Godot ni garantiza una clasificación por edades concreta.
+4
View File
@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="56" viewBox="0 0 32 56" shape-rendering="crispEdges">
<title>Guardia de camerino</title>
<rect x="6" y="49" width="9" height="7" fill="#161723"/><rect x="18" y="49" width="9" height="7" fill="#161723"/><rect x="7" y="51" width="7" height="4" fill="#241f2d"/><rect x="19" y="51" width="7" height="4" fill="#241f2d"/><rect x="9" y="38" width="6" height="13" fill="#161723"/><rect x="18" y="38" width="6" height="13" fill="#161723"/><rect x="10" y="39" width="4" height="11" fill="#262634"/><rect x="19" y="39" width="4" height="11" fill="#262634"/><rect x="5" y="22" width="22" height="19" fill="#161723"/><rect x="7" y="23" width="18" height="16" fill="#2d3547"/><rect x="2" y="24" width="5" height="16" fill="#161723"/><rect x="25" y="24" width="5" height="16" fill="#161723"/><rect x="3" y="25" width="3" height="13" fill="#343f53"/><rect x="26" y="25" width="3" height="13" fill="#343f53"/><rect x="2" y="38" width="5" height="4" fill="#ecb78b"/><rect x="25" y="38" width="5" height="4" fill="#ecb78b"/><rect x="9" y="8" width="14" height="17" fill="#161723"/><rect x="11" y="10" width="10" height="14" fill="#ecb78b"/><rect x="13" y="18" width="6" height="2" fill="#a77765"/><rect x="10" y="6" width="12" height="4" fill="#161723"/><rect x="8" y="7" width="16" height="3" fill="#45424c"/><rect x="11" y="13" width="5" height="4" fill="#161723"/><rect x="17" y="13" width="5" height="4" fill="#161723"/><rect x="15" y="14" width="3" height="1" fill="#a9b7cf"/><rect x="13" y="20" width="6" height="2" fill="#161723"/><rect x="7" y="24" width="18" height="4" fill="#46536a"/><rect x="13" y="27" width="6" height="10" fill="#f6eecb"/><rect x="15" y="28" width="2" height="8" fill="#9c4254"/><rect x="7" y="38" width="18" height="3" fill="#161723"/><rect x="11" y="38" width="9" height="2" fill="#aeb5ce"/><rect x="25" y="30" width="5" height="4" fill="#1c2430"/>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

+4
View File
@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="56" viewBox="0 0 32 56" shape-rendering="crispEdges">
<title>Tecnico del feedback</title>
<rect x="6" y="49" width="9" height="7" fill="#161723"/><rect x="18" y="49" width="9" height="7" fill="#161723"/><rect x="7" y="51" width="7" height="4" fill="#5a4241"/><rect x="19" y="51" width="7" height="4" fill="#5a4241"/><rect x="9" y="38" width="6" height="13" fill="#161723"/><rect x="18" y="38" width="6" height="13" fill="#161723"/><rect x="10" y="39" width="4" height="11" fill="#4b4654"/><rect x="19" y="39" width="4" height="11" fill="#4b4654"/><rect x="5" y="22" width="22" height="19" fill="#161723"/><rect x="7" y="23" width="18" height="16" fill="#547a63"/><rect x="2" y="24" width="5" height="16" fill="#161723"/><rect x="25" y="24" width="5" height="16" fill="#161723"/><rect x="3" y="25" width="3" height="13" fill="#d2bd53"/><rect x="26" y="25" width="3" height="13" fill="#d2bd53"/><rect x="2" y="38" width="5" height="4" fill="#ecb78b"/><rect x="25" y="38" width="5" height="4" fill="#ecb78b"/><rect x="9" y="8" width="14" height="17" fill="#161723"/><rect x="11" y="10" width="10" height="14" fill="#ecb78b"/><rect x="13" y="18" width="6" height="2" fill="#a77765"/><rect x="8" y="6" width="16" height="4" fill="#161723"/><rect x="10" y="7" width="12" height="2" fill="#68dbd1"/><rect x="8" y="10" width="3" height="12" fill="#161723"/><rect x="21" y="10" width="3" height="12" fill="#161723"/><rect x="8" y="12" width="3" height="9" fill="#6fd9df"/><rect x="21" y="12" width="3" height="9" fill="#6fd9df"/><rect x="12" y="14" width="3" height="3" fill="#161723"/><rect x="18" y="14" width="3" height="3" fill="#161723"/><rect x="15" y="15" width="3" height="1" fill="#161723"/><rect x="7" y="24" width="5" height="15" fill="#d9d45e"/><rect x="20" y="24" width="5" height="15" fill="#d9d45e"/><rect x="7" y="26" width="18" height="2" fill="#b0c8bd"/><rect x="10" y="31" width="13" height="7" fill="#161723"/><rect x="11" y="32" width="11" height="5" fill="#4b7376"/><rect x="12" y="33" width="2" height="2" fill="#f5a04a"/><rect x="16" y="33" width="2" height="2" fill="#71e891"/><rect x="20" y="33" width="2" height="2" fill="#ee6b6a"/>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

+4
View File
@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="56" viewBox="0 0 32 56" shape-rendering="crispEdges">
<title>Fan del pogo eterno</title>
<rect x="6" y="49" width="9" height="7" fill="#161723"/><rect x="18" y="49" width="9" height="7" fill="#161723"/><rect x="7" y="51" width="7" height="4" fill="#c15e52"/><rect x="19" y="51" width="7" height="4" fill="#c15e52"/><rect x="9" y="38" width="6" height="13" fill="#161723"/><rect x="18" y="38" width="6" height="13" fill="#161723"/><rect x="10" y="39" width="4" height="11" fill="#315c67"/><rect x="19" y="39" width="4" height="11" fill="#315c67"/><rect x="5" y="22" width="22" height="19" fill="#161723"/><rect x="7" y="23" width="18" height="16" fill="#854a75"/><rect x="2" y="24" width="5" height="16" fill="#161723"/><rect x="25" y="24" width="5" height="16" fill="#161723"/><rect x="3" y="25" width="3" height="13" fill="#644c70"/><rect x="26" y="25" width="3" height="13" fill="#644c70"/><rect x="2" y="38" width="5" height="4" fill="#ecb78b"/><rect x="25" y="38" width="5" height="4" fill="#ecb78b"/><rect x="9" y="8" width="14" height="17" fill="#161723"/><rect x="11" y="10" width="10" height="14" fill="#ecb78b"/><rect x="13" y="18" width="6" height="2" fill="#a77765"/><rect x="12" y="1" width="8" height="10" fill="#161723"/><rect x="14" y="0" width="4" height="10" fill="#e4489d"/><rect x="9" y="4" width="5" height="7" fill="#161723"/><rect x="10" y="3" width="4" height="7" fill="#ff76c7"/><rect x="18" y="4" width="5" height="7" fill="#161723"/><rect x="18" y="3" width="3" height="7" fill="#ff76c7"/><rect x="10" y="14" width="4" height="2" fill="#161723"/><rect x="18" y="14" width="4" height="2" fill="#161723"/><rect x="14" y="20" width="5" height="2" fill="#161723"/><rect x="9" y="26" width="14" height="10" fill="#385a86"/><rect x="11" y="27" width="2" height="2" fill="#f6eecb"/><rect x="19" y="27" width="2" height="2" fill="#f6eecb"/><rect x="14" y="30" width="5" height="4" fill="#f3c9c3"/><rect x="16" y="32" width="1" height="2" fill="#161723"/><rect x="10" y="44" width="4" height="2" fill="#131a24"/><rect x="21" y="45" width="2" height="3" fill="#131a24"/>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

+4
View File
@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="56" viewBox="0 0 32 56" shape-rendering="crispEdges">
<title>Guitarrista rival</title>
<rect x="6" y="49" width="9" height="7" fill="#161723"/><rect x="18" y="49" width="9" height="7" fill="#161723"/><rect x="7" y="51" width="7" height="4" fill="#553247"/><rect x="19" y="51" width="7" height="4" fill="#553247"/><rect x="9" y="38" width="6" height="13" fill="#161723"/><rect x="18" y="38" width="6" height="13" fill="#161723"/><rect x="10" y="39" width="4" height="11" fill="#292b42"/><rect x="19" y="39" width="4" height="11" fill="#292b42"/><rect x="5" y="22" width="22" height="19" fill="#161723"/><rect x="7" y="23" width="18" height="16" fill="#982f49"/><rect x="2" y="24" width="5" height="16" fill="#161723"/><rect x="25" y="24" width="5" height="16" fill="#161723"/><rect x="3" y="25" width="3" height="13" fill="#982f49"/><rect x="26" y="25" width="3" height="13" fill="#982f49"/><rect x="2" y="38" width="5" height="4" fill="#ecb78b"/><rect x="25" y="38" width="5" height="4" fill="#ecb78b"/><rect x="9" y="8" width="14" height="17" fill="#161723"/><rect x="11" y="10" width="10" height="14" fill="#ecb78b"/><rect x="13" y="18" width="6" height="2" fill="#a77765"/><rect x="8" y="5" width="16" height="8" fill="#161723"/><rect x="9" y="3" width="13" height="9" fill="#efcf57"/><rect x="6" y="9" width="4" height="20" fill="#dca83f"/><rect x="22" y="9" width="4" height="20" fill="#dca83f"/><rect x="10" y="15" width="2" height="2" fill="#161723"/><rect x="19" y="15" width="2" height="2" fill="#161723"/><rect x="14" y="20" width="4" height="2" fill="#161723"/><rect x="9" y="25" width="14" height="4" fill="#d35672"/><rect x="15" y="27" width="3" height="9" fill="#161723"/><rect x="22" y="24" width="3" height="18" fill="#161723"/><rect x="23" y="25" width="1" height="15" fill="#f1cd87"/><rect x="12" y="35" width="13" height="12" fill="#161723"/><rect x="15" y="35" width="11" height="9" fill="#ef8555"/><rect x="12" y="41" width="5" height="7" fill="#ec684c"/><rect x="20" y="42" width="4" height="6" fill="#f8ad62"/><rect x="18" y="38" width="3" height="2" fill="#f6eecb"/><rect x="18" y="42" width="3" height="2" fill="#f6eecb"/>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

+4
View File
@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="56" viewBox="0 0 32 56" shape-rendering="crispEdges">
<title>Roadie del mas alla</title>
<rect x="6" y="49" width="9" height="7" fill="#161723"/><rect x="18" y="49" width="9" height="7" fill="#161723"/><rect x="7" y="51" width="7" height="4" fill="#313440"/><rect x="19" y="51" width="7" height="4" fill="#313440"/><rect x="9" y="38" width="6" height="13" fill="#161723"/><rect x="18" y="38" width="6" height="13" fill="#161723"/><rect x="10" y="39" width="4" height="11" fill="#545568"/><rect x="19" y="39" width="4" height="11" fill="#545568"/><rect x="5" y="22" width="22" height="19" fill="#161723"/><rect x="7" y="23" width="18" height="16" fill="#35576d"/><rect x="2" y="24" width="5" height="16" fill="#161723"/><rect x="25" y="24" width="5" height="16" fill="#161723"/><rect x="3" y="25" width="3" height="13" fill="#35576d"/><rect x="26" y="25" width="3" height="13" fill="#35576d"/><rect x="2" y="38" width="5" height="4" fill="#ecb78b"/><rect x="25" y="38" width="5" height="4" fill="#ecb78b"/><rect x="9" y="8" width="14" height="17" fill="#161723"/><rect x="11" y="10" width="10" height="14" fill="#ecb78b"/><rect x="13" y="18" width="6" height="2" fill="#a77765"/><rect x="8" y="7" width="16" height="5" fill="#161723"/><rect x="10" y="5" width="14" height="5" fill="#b84f40"/><rect x="6" y="10" width="10" height="3" fill="#dc6c51"/><rect x="10" y="15" width="2" height="2" fill="#161723"/><rect x="19" y="15" width="2" height="2" fill="#161723"/><rect x="13" y="20" width="7" height="2" fill="#74534e"/><rect x="7" y="34" width="18" height="5" fill="#d5a156"/><rect x="10" y="34" width="4" height="5" fill="#fce98f"/><rect x="14" y="26" width="4" height="7" fill="#e1cf9b"/><rect x="15" y="27" width="2" height="3" fill="#161723"/><rect x="4" y="25" width="2" height="10" fill="#65869c"/><rect x="26" y="40" width="6" height="1" fill="#161723"/><rect x="31" y="41" width="1" height="8" fill="#161723"/><rect x="25" y="48" width="7" height="1" fill="#161723"/><rect x="24" y="43" width="1" height="6" fill="#161723"/><rect x="25" y="43" width="5" height="1" fill="#ffa760"/><rect x="29" y="44" width="1" height="3" fill="#ffa760"/>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

+17 -3
View File
@@ -26,13 +26,26 @@ Los SVG son de 32 x 32 px, y la escena `pickup.tscn` escala el Sprite2D a 0.5: *
## Distribución y reglas ## Distribución y reglas
- Walker: 50% de probabilidad de soltar 1 objeto al morir; tabla ponderada en `enemies/walker/walker_drop.tres`. - Walker normal: 50% de probabilidad de soltar 1 objeto al morir; tabla ponderada en `enemies/walker/walker_drop.tres`.
- `Muelles del Stage Diving` y `Baqueta Sismica`: recursos implementados, disponibles para colocar manualmente en niveles; aún no incluidos en la tabla de Walker. - En el laboratorio `levels/level_01.tscn`: `guaranteed_drop` asignado en cada uno de los 17 enemigos, 100% de probabilidad y sin respawn. No cambia el drop normal.
- `Muelles del Stage Diving` y `Baqueta Sismica` no están en la tabla aleatoria normal, pero **sí** se pueden probar derrotando las estaciones 15 y 16 del laboratorio.
- Las curaciones no se consumen si ya tienes la vida completa; el especial tampoco si está lleno. - Las curaciones no se consumen si ya tienes la vida completa; el especial tampoco si está lleno.
- Las mejoras de igual tipo renuevan duración y conservan la mayor potencia (no se multiplican entre sí). Mejoras de tipos diferentes conviven. - Las mejoras de igual tipo renuevan duración y conservan la mayor potencia (no se multiplican entre sí). Mejoras de tipos diferentes conviven.
- El escudo bloquea un golpe y aplica la invulnerabilidad habitual del jugador. - El escudo bloquea un golpe y aplica la invulnerabilidad habitual del jugador.
- Los sprites son iconos originales vectoriales, no se reutilizan imágenes de terceros. - Los sprites son iconos originales vectoriales, no se reutilizan imágenes de terceros.
## Prueba de todos los objetos en una APK
- **Implementado en escena:** 17 estaciones ordenadas de izquierda a derecha,
cada una con un enemigo visual diferente (cinco variantes cíclicas) y un drop
fijo. El HUD cuenta objetos *recogidos*, no enemigos eliminados.
- **Implementado en código:** el HUD del jugador muestra los efectos temporales
y el escudo. Carga especial/curación requieren capacidad disponible para
consumirse; a tope permanecen en el suelo.
- **Por validar:** importación SVG, colisiones, caídas de los items, equilibrio,
funcionamiento con controles táctiles y exportación APK en un teléfono real.
- **Guía:** [Test de Level 01](test_level_01.md) (orden de recompensas y checklist).
## Pendiente (no implementado) ## Pendiente (no implementado)
| Coleccionable | Descripción | Estado | | Coleccionable | Descripción | Estado |
@@ -54,5 +67,6 @@ Los SVG son de 32 x 32 px, y la escena `pickup.tscn` escala el Sprite2D a 0.5: *
- Probar visualmente las importaciones SVG y cada efecto en Godot 4.7. - Probar visualmente las importaciones SVG y cada efecto en Godot 4.7.
- Equilibrar tiempos y probabilidades tras jugar varios niveles. - Equilibrar tiempos y probabilidades tras jugar varios niveles.
- Añadir indicadores persistentes de buffs en el HUD (ahora se muestra texto flotante al recoger). - Validar que los indicadores persistentes del HUD se ven y se actualizan
correctamente en Android (implementados en código, aún no probados en dispositivo).
- Revisar la clasificación por edades con el cuestionario IARC/Google Play; nombres ficticios no garantizan ninguna clasificación. - Revisar la clasificación por edades con el cuestionario IARC/Google Play; nombres ficticios no garantizan ninguna clasificación.
+101
View File
@@ -0,0 +1,101 @@
# Level 01 - Laboratorio de objetos (Android)
**Implementado en escena / pendiente de validar jugando en Godot y Android.**
`levels/level_01.tscn` es un recorrido deliberadamente largo para probar una
APK sin alterar el codigo entre partidas. Es la escena inicial configurada en
`project.godot`.
- **17 enemigos / 17 objetos diferentes**, uno por enemigo, en este orden.
- Cada enemigo suelta **siempre** su objeto asignado al morir y **no reaparece**.
- La tabla normal `enemies/walker/walker_drop.tres` conserva su 50% aleatorio
en las otras escenas (no se ha desactivado globalmente).
- Suelo continuo para no quedarse atascado, con 7 plataformas opcionales.
La primera plataforma alta (x=1690, y=291) esta concebida para alcanzarse
desde la baja (x=1530, y=455), no directamente desde el suelo. Hay doble salto.
- La camara acompana todo el recorrido (hasta x=8500).
- Etiquetas sobre cada enemigo y contador en la esquina superior derecha.
- HUD izquierda: vida, carga especial y mejoras temporales con segundos.
- La meta esta en **x=8180**; muestra resultados y reinicia tras 8 segundos.
- En esta escena el especial tiene radio de 290 unidades para evitar eliminar
enemigos de estaciones vecinas antes de llegar a ellas.
## Encuentros y recompensas
| # | X | Enemigo (aspecto) | Drop fijo | Archivo de datos |
|---|---:|---|---|---|
| 01 | 480 | Roadie del Mas Alla | **Pua del Apocalipsis** | `pua_apocalipsis.tres` |
| 02 | 930 | Fan del Pogo Eterno | **Espuma del Pogo** | `beer.tres` |
| 03 | 1380 | Tecnico del Feedback | **Tostado del Averno** | `coffee.tres` |
| 04 | 1830 | Guardia del Camerino | **Casete de la Demo Perdida** | `casete_demo.tres` |
| 05 | 2280 | Guitarrista Rival | **Bocata del Roadie** | `bocata_roadie.tres` |
| 06 | 2730 | Roadie del Mas Alla | **Lata de Feedback** | `lata_feedback.tres` |
| 07 | 3180 | Fan del Pogo Eterno | **Pedal de Distorsion** | `pedal_distorsion.tres` |
| 08 | 3630 | Tecnico del Feedback | **Setlist del Fin del Mundo** | `setlist_fin.tres` |
| 09 | 4080 | Guardia del Camerino | **Pizza Post-Bolo** | `pizza_post_bolo.tres` |
| 10 | 4530 | Guitarrista Rival | **Cuerda de Titanio** | `cuerda_titanio.tres` |
| 11 | 4980 | Roadie del Mas Alla | **Cinta Americana Infinita** | `cinta_americana.tres` |
| 12 | 5430 | Fan del Pogo Eterno | **Tapones del Tecnico** | `tapones_tecnico.tres` |
| 13 | 5880 | Tecnico del Feedback | **Tupper del Bateria** | `tupper_bateria.tres` |
| 14 | 6330 | Guardia del Camerino | **Botas del Doble Bombo** | `botas_doble_bombo.tres` |
| 15 | 6780 | Guitarrista Rival | **Muelles del Stage Diving** | `muelles_stage.tres` |
| 16 | 7230 | Roadie del Mas Alla | **Baqueta Sismica** | `baqueta_sismica.tres` |
| 17 | 7680 | Fan del Pogo Eterno | **Amplificador al 11** | `amplificador_11.tres` |
## Que comprobar en la APK
- [ ] La APK abre directamente `level_01`, se puede caminar a derecha durante
todo el nivel y la camara no se detiene en x=4000.
- [ ] Los 17 enemigos tienen apariencia humanoide visible y ataques legibles.
- [ ] Cada muerte deja el objeto esperado (no uno aleatorio), una sola vez.
- [ ] La etiqueta del siguiente objeto y el contador coinciden con la partida.
- [ ] Al recoger objetos, sus efectos se notan; buffs y escudo se listan a la izquierda.
- [ ] Vida llena: las curaciones permanecen en el suelo hasta necesitar HP.
- [ ] Especial lleno: los objetos de carga permanecen hasta consumir el especial (SP).
- [ ] Las dos mejoras de salto/ataque aereo se pueden probar en las plataformas.
- [ ] Hay que saltar a la plataforma baja para alcanzar la alta.
- [ ] Al llegar a la meta se ve el resumen y vuelve a empezar tras 8 s.
**Nota:** El contador marca objetos efectivamente *recogidos*, no enemigos
muertos. Para obtener 17/17 hay que haber perdido vida antes de tomar curaciones
y haber gastado especial antes de tomar cargadores si esta lleno. Los objetos
no desaparecen por tiempo; puedes volver a recogerlos.
## Como cambiar una estacion
En `levels/level_01.tscn`, selecciona `TestEnemies/StationXX` y cambia
`guaranteed_drop` por un recurso de `pickups/data/`. En esta escena no necesitas
modificar la tabla de drops. El valor `respawn_delay = 0` viene del perfil del
enemigo (en `enemies/variants/`). Para volver al reparto aleatorio en un nivel
normal, deja `guaranteed_drop` vacio y usa el Walker original.
Los cinco perfiles usan el script `enemies/walker/walker.gd`. Son variantes
**visuales y de estadisticas**, no cinco IA diferentes:
- Roadie del Mas Alla: mochila/cable y gorra.
- Fan del Pogo Eterno: cresta y chaleco de festival.
- Tecnico del Feedback: auriculares, chaleco y mesa de sonido.
- Guardia del Camerino: traje y gafas de sol.
- Guitarrista Rival: melenas y guitarra electrica.
Sprites SVG de **32x56** (`assets/enemies/`) para una colision aprox. **28x52**.
Los objetos mantienen iconos SVG de **32x32** y representacion a **16x16**.
## Verificacion antes de exportar
Desde la raiz del proyecto:
```bash
python -m unittest discover -s tests -v
```
Esto valida rutas, SVG, drops y el layout basico, **pero no ejecuta Godot**.
Abre el proyecto en Godot una vez para importar los SVG y probar la escena.
Para generar un APK en un entorno que tenga Godot y el SDK Android configurados:
```bash
./scripts/export_android_debug.sh
```
El script admite una ruta de salida opcional; por defecto escribe
`build/android/mortal-maze-debug.apk`. No se ha compilado la APK aqui.
+16
View File
@@ -0,0 +1,16 @@
[gd_scene load_steps=3 format=3]
[ext_resource type="PackedScene" path="res://enemies/walker/walker.tscn" id="1_walker"]
[ext_resource type="Texture2D" path="res://assets/enemies/backstage_guard.svg" id="2_sprite"]
[node name="Walker" instance=ExtResource("1_walker")]
enemy_display_name = "Guardia del Camerino"
move_speed = 70.0
max_health = 30
attack_damage = 4
chase_radius = 135.0
respawn_delay = 0.0
show_debug_hitboxes = false
[node name="Visual" parent="." index="0"]
texture = ExtResource("2_sprite")
+16
View File
@@ -0,0 +1,16 @@
[gd_scene load_steps=3 format=3]
[ext_resource type="PackedScene" path="res://enemies/walker/walker.tscn" id="1_walker"]
[ext_resource type="Texture2D" path="res://assets/enemies/feedback_tech.svg" id="2_sprite"]
[node name="Walker" instance=ExtResource("1_walker")]
enemy_display_name = "Tecnico del Feedback"
move_speed = 55.0
max_health = 25
attack_damage = 3
chase_radius = 135.0
respawn_delay = 0.0
show_debug_hitboxes = false
[node name="Visual" parent="." index="0"]
texture = ExtResource("2_sprite")
+16
View File
@@ -0,0 +1,16 @@
[gd_scene load_steps=3 format=3]
[ext_resource type="PackedScene" path="res://enemies/walker/walker.tscn" id="1_walker"]
[ext_resource type="Texture2D" path="res://assets/enemies/pogo_fan.svg" id="2_sprite"]
[node name="Walker" instance=ExtResource("1_walker")]
enemy_display_name = "Fan del Pogo Eterno"
move_speed = 105.0
max_health = 15
attack_damage = 2
chase_radius = 135.0
respawn_delay = 0.0
show_debug_hitboxes = false
[node name="Visual" parent="." index="0"]
texture = ExtResource("2_sprite")
+16
View File
@@ -0,0 +1,16 @@
[gd_scene load_steps=3 format=3]
[ext_resource type="PackedScene" path="res://enemies/walker/walker.tscn" id="1_walker"]
[ext_resource type="Texture2D" path="res://assets/enemies/rival_guitarist.svg" id="2_sprite"]
[node name="Walker" instance=ExtResource("1_walker")]
enemy_display_name = "Guitarrista Rival"
move_speed = 87.0
max_health = 20
attack_damage = 3
chase_radius = 135.0
respawn_delay = 0.0
show_debug_hitboxes = false
[node name="Visual" parent="." index="0"]
texture = ExtResource("2_sprite")
+16
View File
@@ -0,0 +1,16 @@
[gd_scene load_steps=3 format=3]
[ext_resource type="PackedScene" path="res://enemies/walker/walker.tscn" id="1_walker"]
[ext_resource type="Texture2D" path="res://assets/enemies/roadie.svg" id="2_sprite"]
[node name="Walker" instance=ExtResource("1_walker")]
enemy_display_name = "Roadie del Mas Alla"
move_speed = 65.0
max_health = 20
attack_damage = 3
chase_radius = 135.0
respawn_delay = 0.0
show_debug_hitboxes = false
[node name="Visual" parent="." index="0"]
texture = ExtResource("2_sprite")
+38 -16
View File
@@ -91,18 +91,26 @@ enum AttackState {
@export_category("Drops") @export_category("Drops")
## Table defining what pickups can drop on death (by chance). ## Default weighted drops for normal encounters.
@export var drop_table: PickupDropTable @export var drop_table: PickupDropTable
## Optional fixed drop, used by the Level 01 test route. When assigned, this
@export_category("Respawn") ## object drops with 100% probability INSTEAD of the random table.
@export var guaranteed_drop: PickupData
@export_category("Respawn") @export_category("Respawn")
## Enough downtime to make defeating an enemy meaningful before it comes back. ## A value of 0 disables respawn (one enemy = one test item).
@export var respawn_delay: float = 5.0 @export var respawn_delay: float = 5.0
## Limits how far the enemy may chase from its spawn point; 0 = unrestricted.
## Small limits keep independent testing encounters from piling up.
@export var chase_radius: float = 0.0
## Only used to describe enemy variants in test HUDs.
@export var enemy_display_name: String = "Walker"
# ============================================================================ # ============================================================================
# DEBUG # DEBUG
@@ -130,6 +138,7 @@ enum AttackState {
@onready var attack_collision: CollisionShape2D = $AttackHitbox/CollisionShape2D @onready var attack_collision: CollisionShape2D = $AttackHitbox/CollisionShape2D
@onready var floor_probe: RayCast2D = $FloorProbe @onready var floor_probe: RayCast2D = $FloorProbe
@onready var visibility_notifier: VisibleOnScreenNotifier2D = $VisibleOnScreenNotifier2D @onready var visibility_notifier: VisibleOnScreenNotifier2D = $VisibleOnScreenNotifier2D
@onready var visual: Sprite2D = $Visual
# ============================================================================ # ============================================================================
@@ -263,6 +272,8 @@ func _update_facing() -> void:
if attack_state == AttackState.IDLE: if attack_state == AttackState.IDLE:
_reset_attack_hitbox_position() _reset_attack_hitbox_position()
# The five variants share one collision box and AI, but use different sprites.
visual.flip_h = facing_direction < 0.0
# ============================================================================ # ============================================================================
@@ -288,6 +299,13 @@ func _update_idle_behaviour() -> void:
func _chase_target() -> void: func _chase_target() -> void:
# Limit chasing to the current testing station when chase_radius is set.
# Going back towards the spawn point is always allowed.
var distance_from_spawn: float = global_position.x - spawn_position.x
if chase_radius > 0.0 and absf(distance_from_spawn) >= chase_radius and signf(distance_from_spawn) == facing_direction:
velocity.x = 0.0
return
# Do not blindly walk off a platform while chasing. Proper pathfinding is # Do not blindly walk off a platform while chasing. Proper pathfinding is
# intentionally postponed until levels actually require it. # intentionally postponed until levels actually require it.
if is_on_floor() and not floor_probe.is_colliding(): if is_on_floor() and not floor_probe.is_colliding():
@@ -489,12 +507,15 @@ func _die() -> void:
is_dead = true is_dead = true
died.emit() died.emit()
if drop_table != null: # Test encounters always drop their assigned item, including the two items
var drops = DROP_MANAGER.roll_drop(drop_table) # absent from the normal Walker table. Other levels keep their random loot.
var drops: Array[PickupData] = []
if guaranteed_drop != null:
drops.append(guaranteed_drop)
elif drop_table != null:
drops = DROP_MANAGER.roll_drop(drop_table)
if not drops.is_empty(): if not drops.is_empty():
var parent := get_tree().current_scene var parent: Node = get_tree().current_scene
if parent == null:
parent = get_tree().root.get_child(get_tree().root.get_child_count() - 1)
if parent == null: if parent == null:
parent = get_tree().root parent = get_tree().root
DROP_MANAGER.spawn_drops(drops, parent, global_position) DROP_MANAGER.spawn_drops(drops, parent, global_position)
@@ -508,6 +529,7 @@ func _die() -> void:
hurtbox_collision.set_deferred("disabled", true) hurtbox_collision.set_deferred("disabled", true)
attack_collision.set_deferred("disabled", true) attack_collision.set_deferred("disabled", true)
if respawn_delay > 0.0:
await get_tree().create_timer(respawn_delay).timeout await get_tree().create_timer(respawn_delay).timeout
_respawn() _respawn()
@@ -544,8 +566,8 @@ func _respawn() -> void:
# ============================================================================ # ============================================================================
func _draw() -> void: func _draw() -> void:
# The enemy has no sprite yet. This neutral block makes the actual entity # Retain a fallback body if an imported sprite is missing.
# visible independently from the debug overlays. if visual.texture == null:
_draw_rectangle_collision( _draw_rectangle_collision(
body_collision, body_collision,
Color(0.18, 0.18, 0.20, 0.90), Color(0.18, 0.18, 0.20, 0.90),
@@ -557,6 +579,11 @@ func _draw() -> void:
_draw_enemy_health_bar() _draw_enemy_health_bar()
_draw_damage_texts() _draw_damage_texts()
# Orange windup is important gameplay feedback, not a debug hitbox.
# Keep it visible on Android even when red collision overlays are disabled.
if attack_state == AttackState.WINDUP:
_draw_attack_telegraph()
if not show_debug_hitboxes: if not show_debug_hitboxes:
return return
@@ -567,11 +594,6 @@ func _draw() -> void:
Color(1.0, 0.05, 0.05, 0.55) Color(1.0, 0.05, 0.05, 0.55)
) )
# Windup: preview the full sweep in orange. It is explicitly NOT dangerous
# yet, so the different colour makes the reaction window easy to understand.
if attack_state == AttackState.WINDUP:
_draw_attack_telegraph()
# Active attack: draw the real moving physics hitbox in strong red. # Active attack: draw the real moving physics hitbox in strong red.
if attack_state == AttackState.ACTIVE: if attack_state == AttackState.ACTIVE:
_draw_rectangle_collision( _draw_rectangle_collision(
+7 -1
View File
@@ -1,6 +1,7 @@
[gd_scene load_steps=4 format=3] [gd_scene load_steps=5 format=3]
[ext_resource type="Script" path="res://enemies/walker/walker.gd" id="1_walker"] [ext_resource type="Script" path="res://enemies/walker/walker.gd" id="1_walker"]
[ext_resource type="Texture2D" path="res://assets/enemies/roadie.svg" id="2_sprite"]
[sub_resource type="RectangleShape2D" id="BodyShape"] [sub_resource type="RectangleShape2D" id="BodyShape"]
size = Vector2(28, 52) size = Vector2(28, 52)
@@ -13,6 +14,11 @@ collision_layer = 4
collision_mask = 1 collision_mask = 1
script = ExtResource("1_walker") script = ExtResource("1_walker")
[node name="Visual" type="Sprite2D" parent="."]
z_index = -1
texture_filter = 1
texture = ExtResource("2_sprite")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, 0) position = Vector2(0, 0)
shape = SubResource("BodyShape") shape = SubResource("BodyShape")
+76 -49
View File
@@ -1,79 +1,106 @@
extends Node2D extends Node2D
## Señal que se emite cuando el jugador alcanza el final del nivel. ## Android test course: 17 stations / 17 different guaranteed items.
## Encounters are configured in the scene, not spawned by code, so designers can
## freely move a station or switch its drop in the Godot inspector.
signal level_completed signal level_completed
const TEST_ITEM_COUNT: int = 17
const LEVEL_WIDTH: int = 8500
const FINISH_RESTART_SECONDS: float = 8.0
@onready var player: Node2D = $Player @onready var player: Node2D = $Player
@onready var message_label: Label = $MessageLabel @onready var test_enemies: Node2D = $TestEnemies
@onready var status_label: Label = $TestHUD/Overlay/Status
@onready var finish_message: Label = $TestHUD/Overlay/FinishMessage
# Colores temporales de cada plataforma. Se pueden cambiar por texturas más tarde. var collected_items: Dictionary = {} # PickupData.id -> true; count each only once
var platform_colors: Dictionary = {
"Floor": Color(0.2, 0.7, 0.2, 1.0), # Verde (suelo)
"Platform1": Color(0.4, 0.6, 1.0, 1.0), # Azul
"Platform2": Color(1.0, 0.4, 0.4, 1.0), # Rojo
"Platform3": Color(1.0, 1.0, 0.4, 1.0), # Amarillo
}
var victory_timer: float = 0.0
var showing_victory: bool = false var showing_victory: bool = false
var victory_timer: float = 0.0
func _ready() -> void: func _ready() -> void:
message_label.visible = false finish_message.visible = false
# Player Camera2D sets its own provisional limit (4000) in _ready.
# Zona de final del nivel (meta). # Override it here, after child _ready, for the long Android route.
var finish: Area2D = $FinishZone var camera: Camera2D = player.get_node("Camera2D") as Camera2D
if finish: camera.limit_right = LEVEL_WIDTH
finish.body_entered.connect(_on_finish_entered)
# Zona de muerte (caer fuera del nivel).
var death: Area2D = $DeathZone
if death:
death.body_entered.connect(_on_death_entered)
# Cuando el jugador muere, el nivel se recarga solo (player.gd ya lo hace).
if player.has_signal("died"):
player.died.connect(_on_player_died)
$FinishZone.body_entered.connect(_on_finish_entered)
$DeathZone.body_entered.connect(_on_death_entered)
player.connect(&"pickup_collected", _on_pickup_collected)
_update_status()
func _process(delta: float) -> void: func _process(delta: float) -> void:
if showing_victory: if showing_victory:
victory_timer += delta victory_timer += delta
if victory_timer >= 3.0: if victory_timer >= FINISH_RESTART_SECONDS:
get_tree().reload_current_scene() get_tree().reload_current_scene()
return
_update_status()
func _update_status() -> void:
# Each station has one enemy and an assigned pickup. Look ahead to the first
# living enemy so the player knows what to expect without opening a menu.
var next_item: String = "FIN DEL RECORRIDO"
for enemy in test_enemies.get_children():
if bool(enemy.get("is_dead")):
continue
var enemy_body: Node2D = enemy as Node2D
if enemy_body.position.x < player.position.x - 165.0:
continue
var data: PickupData = enemy.get("guaranteed_drop") as PickupData
if data != null:
next_item = data.display_name
break
status_label.text = "LAB THRASH %02d / %02d recogidos\nSIGUIENTE: %s" % [
collected_items.size(), TEST_ITEM_COUNT, next_item
]
func _on_pickup_collected(data: PickupData) -> void:
# A heal at full HP or a charge item with a full meter isn't consumed and
# doesn't count. The object remains on the floor for later collection.
collected_items[data.id] = true
_update_status()
func _on_finish_entered(body: Node2D) -> void: func _on_finish_entered(body: Node2D) -> void:
if body != player: if body != player or showing_victory:
return return
showing_victory = true showing_victory = true
message_label.text = "¡NIVEL COMPLETADO!" level_completed.emit()
message_label.visible = true finish_message.text = "FIN DEL LAB!\nObjetos recogidos: %d / %d\nReinicio en 8 s" % [
collected_items.size(), TEST_ITEM_COUNT
]
finish_message.visible = true
func _on_death_entered(body: Node2D) -> void: func _on_death_entered(body: Node2D) -> void:
if body != player: if body == player and body.has_method("take_damage"):
return
# Caer al vacío mata al jugador y recarga el nivel.
if body.has_method("take_damage"):
body.take_damage(9999, body.global_position) body.take_damage(9999, body.global_position)
func _on_player_died() -> void:
# El nivel se recarga automáticamente desde player.gd.
pass
# Dibuja las plataformas con colores sólidos para que se vean en juego.
# Esto es solo temporal: se reemplazará por sprites/texturas cuando haya arte.
func _draw() -> void: func _draw() -> void:
var world: Node = $World # Temporary coloured geometry; collision shapes are the single source of
for child in world.get_children(): # truth for position and dimensions, so the visuals cannot desynchronise.
if child is CollisionShape2D: for child in $World.get_children():
var shape: Shape2D = child.shape if not child is CollisionShape2D:
if shape is RectangleShape2D: continue
var rect: Rect2 = Rect2(child.position - shape.size / 2.0, shape.size) var collision: CollisionShape2D = child as CollisionShape2D
var color: Color = platform_colors.get(child.name, Color(0.5, 0.5, 0.5, 1.0)) var rectangle: RectangleShape2D = collision.shape as RectangleShape2D
if rectangle == null:
continue
var color: Color = Color(0.32, 0.57, 0.79)
if collision.name == "Floor":
color = Color(0.20, 0.40, 0.25)
elif collision.name.begins_with("High"):
color = Color(0.68, 0.39, 0.76)
var rect: Rect2 = Rect2(collision.position - rectangle.size / 2.0, rectangle.size)
draw_rect(rect, color, true) draw_rect(rect, color, true)
draw_rect(rect, Color(1, 1, 1, 0.3), false, 2.0) draw_rect(rect, Color(0.93, 0.94, 1.0, 0.6), false, 2.0)
+407 -46
View File
@@ -1,83 +1,444 @@
[gd_scene load_steps=16 format=3] [gd_scene load_steps=31 format=3]
[ext_resource type="PackedScene" path="res://player/player.tscn" id="1_player"] [ext_resource type="PackedScene" path="res://player/player.tscn" id="1_player"]
[ext_resource type="PackedScene" path="res://enemies/walker/walker.tscn" id="2_walker"] [ext_resource type="PackedScene" path="res://ui/mobile_controls/mobile_controls.tscn" id="2_mobile"]
[ext_resource type="PackedScene" path="res://ui/mobile_controls/mobile_controls.tscn" id="4_mobile_controls"]
[ext_resource type="Script" path="res://levels/level_01.gd" id="3_level"] [ext_resource type="Script" path="res://levels/level_01.gd" id="3_level"]
[ext_resource type="PackedScene" path="res://pickups/pickup.tscn" id="5_pickup"] [ext_resource type="PackedScene" path="res://enemies/variants/roadie.tscn" id="v0"]
[ext_resource type="Resource" path="res://pickups/data/pua_apocalipsis.tres" id="6_pua"] [ext_resource type="PackedScene" path="res://enemies/variants/pogo_fan.tscn" id="v1"]
[ext_resource type="PackedScene" path="res://enemies/variants/feedback_tech.tscn" id="v2"]
[ext_resource type="PackedScene" path="res://enemies/variants/backstage_guard.tscn" id="v3"]
[ext_resource type="PackedScene" path="res://enemies/variants/rival_guitarist.tscn" id="v4"]
[ext_resource type="Resource" path="res://pickups/data/pua_apocalipsis.tres" id="item_0"]
[ext_resource type="Resource" path="res://pickups/data/beer.tres" id="item_1"]
[ext_resource type="Resource" path="res://pickups/data/coffee.tres" id="item_2"]
[ext_resource type="Resource" path="res://pickups/data/casete_demo.tres" id="item_3"]
[ext_resource type="Resource" path="res://pickups/data/bocata_roadie.tres" id="item_4"]
[ext_resource type="Resource" path="res://pickups/data/lata_feedback.tres" id="item_5"]
[ext_resource type="Resource" path="res://pickups/data/pedal_distorsion.tres" id="item_6"]
[ext_resource type="Resource" path="res://pickups/data/setlist_fin.tres" id="item_7"]
[ext_resource type="Resource" path="res://pickups/data/pizza_post_bolo.tres" id="item_8"]
[ext_resource type="Resource" path="res://pickups/data/cuerda_titanio.tres" id="item_9"]
[ext_resource type="Resource" path="res://pickups/data/cinta_americana.tres" id="item_10"]
[ext_resource type="Resource" path="res://pickups/data/tapones_tecnico.tres" id="item_11"]
[ext_resource type="Resource" path="res://pickups/data/tupper_bateria.tres" id="item_12"]
[ext_resource type="Resource" path="res://pickups/data/botas_doble_bombo.tres" id="item_13"]
[ext_resource type="Resource" path="res://pickups/data/muelles_stage.tres" id="item_14"]
[ext_resource type="Resource" path="res://pickups/data/baqueta_sismica.tres" id="item_15"]
[ext_resource type="Resource" path="res://pickups/data/amplificador_11.tres" id="item_16"]
[sub_resource type="RectangleShape2D" id="FloorShape"] [sub_resource type="RectangleShape2D" id="FloorShape"]
size = Vector2(1400, 40) size = Vector2(8500, 40)
[sub_resource type="RectangleShape2D" id="PlatformShape"] [sub_resource type="RectangleShape2D" id="StepShape"]
size = Vector2(220, 20) size = Vector2(240, 20)
[sub_resource type="RectangleShape2D" id="HighShape"]
size = Vector2(180, 16)
[sub_resource type="RectangleShape2D" id="FinishShape"] [sub_resource type="RectangleShape2D" id="FinishShape"]
size = Vector2(60, 40) size = Vector2(70, 200)
[sub_resource type="RectangleShape2D" id="DeathShape"] [sub_resource type="RectangleShape2D" id="DeathShape"]
size = Vector2(3000, 200) size = Vector2(9000, 170)
[node name="Level01" type="Node2D"] [node name="Level01" type="Node2D"]
script = ExtResource("3_level") script = ExtResource("3_level")
[node name="World" type="StaticBody2D" parent="."] [node name="World" type="StaticBody2D" parent="."]
collision_layer = 1 collision_layer = 1
collision_mask = 1 collision_mask = 0
[node name="Floor" type="CollisionShape2D" parent="World"] [node name="Floor" type="CollisionShape2D" parent="World"]
position = Vector2(700, 620) position = Vector2(4250, 620)
shape = SubResource("FloorShape") shape = SubResource("FloorShape")
[node name="Platform1" type="CollisionShape2D" parent="World"] [node name="Step1" type="CollisionShape2D" parent="World"]
position = Vector2(300, 470) position = Vector2(1530, 455)
shape = SubResource("PlatformShape") shape = SubResource("StepShape")
[node name="Platform2" type="CollisionShape2D" parent="World"] [node name="High1" type="CollisionShape2D" parent="World"]
position = Vector2(1100, 470) position = Vector2(1690, 291)
shape = SubResource("PlatformShape") shape = SubResource("HighShape")
[node name="Platform3" type="CollisionShape2D" parent="World"] [node name="Step2" type="CollisionShape2D" parent="World"]
position = Vector2(700, 320) position = Vector2(3370, 485)
shape = SubResource("PlatformShape") shape = SubResource("StepShape")
[node name="High2" type="CollisionShape2D" parent="World"]
position = Vector2(3520, 338)
shape = SubResource("HighShape")
[node name="Step3" type="CollisionShape2D" parent="World"]
position = Vector2(5600, 455)
shape = SubResource("StepShape")
[node name="High3" type="CollisionShape2D" parent="World"]
position = Vector2(5750, 291)
shape = SubResource("HighShape")
[node name="Step4" type="CollisionShape2D" parent="World"]
position = Vector2(6890, 485)
shape = SubResource("StepShape")
[node name="Player" parent="." instance=ExtResource("1_player")] [node name="Player" parent="." instance=ExtResource("1_player")]
position = Vector2(120, 560) position = Vector2(140, 557)
show_debug_hitboxes = false
special_radius = 290.0
[node name="Walker1" parent="." instance=ExtResource("2_walker")] [node name="TestEnemies" type="Node2D" parent="."]
position = Vector2(450, 420)
[node name="Walker2" parent="." instance=ExtResource("2_walker")] [node name="Station01" parent="TestEnemies" instance=ExtResource("v0")]
position = Vector2(950, 420) position = Vector2(480, 555)
guaranteed_drop = ExtResource("item_0")
[node name="FinishZone" type="Area2D" parent="."] [node name="Station02" parent="TestEnemies" instance=ExtResource("v1")]
position = Vector2(1280, 600) position = Vector2(930, 555)
guaranteed_drop = ExtResource("item_1")
[node name="FinishShape" type="CollisionShape2D" parent="FinishZone"] [node name="Station03" parent="TestEnemies" instance=ExtResource("v2")]
shape = SubResource("FinishShape") position = Vector2(1380, 555)
guaranteed_drop = ExtResource("item_2")
[node name="PowerUp" parent="." instance=ExtResource("5_pickup")] [node name="Station04" parent="TestEnemies" instance=ExtResource("v3")]
position = Vector2(300, 440) position = Vector2(1830, 555)
pickup_data = ExtResource("6_pua") guaranteed_drop = ExtResource("item_3")
[node name="DeathZone" type="Area2D" parent="."] [node name="Station05" parent="TestEnemies" instance=ExtResource("v4")]
position = Vector2(0, 680) position = Vector2(2280, 555)
guaranteed_drop = ExtResource("item_4")
[node name="DeathShape" type="CollisionShape2D" parent="DeathZone"] [node name="Station06" parent="TestEnemies" instance=ExtResource("v0")]
shape = SubResource("DeathShape") position = Vector2(2730, 555)
guaranteed_drop = ExtResource("item_5")
[node name="MessageLabel" type="Label" parent="."] [node name="Station07" parent="TestEnemies" instance=ExtResource("v1")]
position = Vector2(376, 300) position = Vector2(3180, 555)
size = Vector2(400, 60) guaranteed_drop = ExtResource("item_6")
align = 1
valign = 1 [node name="Station08" parent="TestEnemies" instance=ExtResource("v2")]
text = "" position = Vector2(3630, 555)
theme_override_colors/font_color = Color(1, 1, 1, 1) guaranteed_drop = ExtResource("item_7")
theme_override_colors/font_shadow_color = Color(0, 0, 0, 0.9)
[node name="Station09" parent="TestEnemies" instance=ExtResource("v3")]
position = Vector2(4080, 555)
guaranteed_drop = ExtResource("item_8")
[node name="Station10" parent="TestEnemies" instance=ExtResource("v4")]
position = Vector2(4530, 555)
guaranteed_drop = ExtResource("item_9")
[node name="Station11" parent="TestEnemies" instance=ExtResource("v0")]
position = Vector2(4980, 555)
guaranteed_drop = ExtResource("item_10")
[node name="Station12" parent="TestEnemies" instance=ExtResource("v1")]
position = Vector2(5430, 555)
guaranteed_drop = ExtResource("item_11")
[node name="Station13" parent="TestEnemies" instance=ExtResource("v2")]
position = Vector2(5880, 555)
guaranteed_drop = ExtResource("item_12")
[node name="Station14" parent="TestEnemies" instance=ExtResource("v3")]
position = Vector2(6330, 555)
guaranteed_drop = ExtResource("item_13")
[node name="Station15" parent="TestEnemies" instance=ExtResource("v4")]
position = Vector2(6780, 555)
guaranteed_drop = ExtResource("item_14")
[node name="Station16" parent="TestEnemies" instance=ExtResource("v0")]
position = Vector2(7230, 555)
guaranteed_drop = ExtResource("item_15")
[node name="Station17" parent="TestEnemies" instance=ExtResource("v1")]
position = Vector2(7680, 555)
guaranteed_drop = ExtResource("item_16")
[node name="StationSigns" type="Node2D" parent="."]
[node name="Sign01" type="Label" parent="StationSigns"]
offset_left = 269.0
offset_top = 467.0
offset_right = 691.0
offset_bottom = 515.0
theme_override_colors/font_color = Color(0.98, 0.92, 0.72, 1)
theme_override_colors/font_shadow_color = Color(0.04, 0.03, 0.08, 0.95)
theme_override_constants/shadow_offset_x = 2 theme_override_constants/shadow_offset_x = 2
theme_override_constants/shadow_offset_y = 2 theme_override_constants/shadow_offset_y = 2
theme_override_font_sizes/font_size = 11
text = "01 Roadie del Mas Alla\n>> Pua del Apocalipsis"
horizontal_alignment = 1
[node name="Sign02" type="Label" parent="StationSigns"]
offset_left = 719.0
offset_top = 467.0
offset_right = 1141.0
offset_bottom = 515.0
theme_override_colors/font_color = Color(0.98, 0.92, 0.72, 1)
theme_override_colors/font_shadow_color = Color(0.04, 0.03, 0.08, 0.95)
theme_override_constants/shadow_offset_x = 2
theme_override_constants/shadow_offset_y = 2
theme_override_font_sizes/font_size = 11
text = "02 Fan del Pogo Eterno\n>> Espuma del Pogo"
horizontal_alignment = 1
[node name="Sign03" type="Label" parent="StationSigns"]
offset_left = 1169.0
offset_top = 467.0
offset_right = 1591.0
offset_bottom = 515.0
theme_override_colors/font_color = Color(0.98, 0.92, 0.72, 1)
theme_override_colors/font_shadow_color = Color(0.04, 0.03, 0.08, 0.95)
theme_override_constants/shadow_offset_x = 2
theme_override_constants/shadow_offset_y = 2
theme_override_font_sizes/font_size = 11
text = "03 Tecnico del Feedback\n>> Tostado del Averno"
horizontal_alignment = 1
[node name="Sign04" type="Label" parent="StationSigns"]
offset_left = 1619.0
offset_top = 467.0
offset_right = 2041.0
offset_bottom = 515.0
theme_override_colors/font_color = Color(0.98, 0.92, 0.72, 1)
theme_override_colors/font_shadow_color = Color(0.04, 0.03, 0.08, 0.95)
theme_override_constants/shadow_offset_x = 2
theme_override_constants/shadow_offset_y = 2
theme_override_font_sizes/font_size = 11
text = "04 Guardia del Camerino\n>> Casete de la Demo Perdida"
horizontal_alignment = 1
[node name="Sign05" type="Label" parent="StationSigns"]
offset_left = 2069.0
offset_top = 467.0
offset_right = 2491.0
offset_bottom = 515.0
theme_override_colors/font_color = Color(0.98, 0.92, 0.72, 1)
theme_override_colors/font_shadow_color = Color(0.04, 0.03, 0.08, 0.95)
theme_override_constants/shadow_offset_x = 2
theme_override_constants/shadow_offset_y = 2
theme_override_font_sizes/font_size = 11
text = "05 Guitarrista Rival\n>> Bocata del Roadie"
horizontal_alignment = 1
[node name="Sign06" type="Label" parent="StationSigns"]
offset_left = 2519.0
offset_top = 467.0
offset_right = 2941.0
offset_bottom = 515.0
theme_override_colors/font_color = Color(0.98, 0.92, 0.72, 1)
theme_override_colors/font_shadow_color = Color(0.04, 0.03, 0.08, 0.95)
theme_override_constants/shadow_offset_x = 2
theme_override_constants/shadow_offset_y = 2
theme_override_font_sizes/font_size = 11
text = "06 Roadie del Mas Alla\n>> Lata de Feedback"
horizontal_alignment = 1
[node name="Sign07" type="Label" parent="StationSigns"]
offset_left = 2969.0
offset_top = 467.0
offset_right = 3391.0
offset_bottom = 515.0
theme_override_colors/font_color = Color(0.98, 0.92, 0.72, 1)
theme_override_colors/font_shadow_color = Color(0.04, 0.03, 0.08, 0.95)
theme_override_constants/shadow_offset_x = 2
theme_override_constants/shadow_offset_y = 2
theme_override_font_sizes/font_size = 11
text = "07 Fan del Pogo Eterno\n>> Pedal de Distorsion"
horizontal_alignment = 1
[node name="Sign08" type="Label" parent="StationSigns"]
offset_left = 3419.0
offset_top = 467.0
offset_right = 3841.0
offset_bottom = 515.0
theme_override_colors/font_color = Color(0.98, 0.92, 0.72, 1)
theme_override_colors/font_shadow_color = Color(0.04, 0.03, 0.08, 0.95)
theme_override_constants/shadow_offset_x = 2
theme_override_constants/shadow_offset_y = 2
theme_override_font_sizes/font_size = 11
text = "08 Tecnico del Feedback\n>> Setlist del Fin del Mundo"
horizontal_alignment = 1
[node name="Sign09" type="Label" parent="StationSigns"]
offset_left = 3869.0
offset_top = 467.0
offset_right = 4291.0
offset_bottom = 515.0
theme_override_colors/font_color = Color(0.98, 0.92, 0.72, 1)
theme_override_colors/font_shadow_color = Color(0.04, 0.03, 0.08, 0.95)
theme_override_constants/shadow_offset_x = 2
theme_override_constants/shadow_offset_y = 2
theme_override_font_sizes/font_size = 11
text = "09 Guardia del Camerino\n>> Pizza Post-Bolo"
horizontal_alignment = 1
[node name="Sign10" type="Label" parent="StationSigns"]
offset_left = 4319.0
offset_top = 467.0
offset_right = 4741.0
offset_bottom = 515.0
theme_override_colors/font_color = Color(0.98, 0.92, 0.72, 1)
theme_override_colors/font_shadow_color = Color(0.04, 0.03, 0.08, 0.95)
theme_override_constants/shadow_offset_x = 2
theme_override_constants/shadow_offset_y = 2
theme_override_font_sizes/font_size = 11
text = "10 Guitarrista Rival\n>> Cuerda de Titanio"
horizontal_alignment = 1
[node name="Sign11" type="Label" parent="StationSigns"]
offset_left = 4769.0
offset_top = 467.0
offset_right = 5191.0
offset_bottom = 515.0
theme_override_colors/font_color = Color(0.98, 0.92, 0.72, 1)
theme_override_colors/font_shadow_color = Color(0.04, 0.03, 0.08, 0.95)
theme_override_constants/shadow_offset_x = 2
theme_override_constants/shadow_offset_y = 2
theme_override_font_sizes/font_size = 11
text = "11 Roadie del Mas Alla\n>> Cinta Americana Infinita"
horizontal_alignment = 1
[node name="Sign12" type="Label" parent="StationSigns"]
offset_left = 5219.0
offset_top = 467.0
offset_right = 5641.0
offset_bottom = 515.0
theme_override_colors/font_color = Color(0.98, 0.92, 0.72, 1)
theme_override_colors/font_shadow_color = Color(0.04, 0.03, 0.08, 0.95)
theme_override_constants/shadow_offset_x = 2
theme_override_constants/shadow_offset_y = 2
theme_override_font_sizes/font_size = 11
text = "12 Fan del Pogo Eterno\n>> Tapones del Tecnico"
horizontal_alignment = 1
[node name="Sign13" type="Label" parent="StationSigns"]
offset_left = 5669.0
offset_top = 467.0
offset_right = 6091.0
offset_bottom = 515.0
theme_override_colors/font_color = Color(0.98, 0.92, 0.72, 1)
theme_override_colors/font_shadow_color = Color(0.04, 0.03, 0.08, 0.95)
theme_override_constants/shadow_offset_x = 2
theme_override_constants/shadow_offset_y = 2
theme_override_font_sizes/font_size = 11
text = "13 Tecnico del Feedback\n>> Tupper del Bateria"
horizontal_alignment = 1
[node name="Sign14" type="Label" parent="StationSigns"]
offset_left = 6119.0
offset_top = 467.0
offset_right = 6541.0
offset_bottom = 515.0
theme_override_colors/font_color = Color(0.98, 0.92, 0.72, 1)
theme_override_colors/font_shadow_color = Color(0.04, 0.03, 0.08, 0.95)
theme_override_constants/shadow_offset_x = 2
theme_override_constants/shadow_offset_y = 2
theme_override_font_sizes/font_size = 11
text = "14 Guardia del Camerino\n>> Botas del Doble Bombo"
horizontal_alignment = 1
[node name="Sign15" type="Label" parent="StationSigns"]
offset_left = 6569.0
offset_top = 467.0
offset_right = 6991.0
offset_bottom = 515.0
theme_override_colors/font_color = Color(0.98, 0.92, 0.72, 1)
theme_override_colors/font_shadow_color = Color(0.04, 0.03, 0.08, 0.95)
theme_override_constants/shadow_offset_x = 2
theme_override_constants/shadow_offset_y = 2
theme_override_font_sizes/font_size = 11
text = "15 Guitarrista Rival\n>> Muelles del Stage Diving"
horizontal_alignment = 1
[node name="Sign16" type="Label" parent="StationSigns"]
offset_left = 7019.0
offset_top = 467.0
offset_right = 7441.0
offset_bottom = 515.0
theme_override_colors/font_color = Color(0.98, 0.92, 0.72, 1)
theme_override_colors/font_shadow_color = Color(0.04, 0.03, 0.08, 0.95)
theme_override_constants/shadow_offset_x = 2
theme_override_constants/shadow_offset_y = 2
theme_override_font_sizes/font_size = 11
text = "16 Roadie del Mas Alla\n>> Baqueta Sismica"
horizontal_alignment = 1
[node name="Sign17" type="Label" parent="StationSigns"]
offset_left = 7469.0
offset_top = 467.0
offset_right = 7891.0
offset_bottom = 515.0
theme_override_colors/font_color = Color(0.98, 0.92, 0.72, 1)
theme_override_colors/font_shadow_color = Color(0.04, 0.03, 0.08, 0.95)
theme_override_constants/shadow_offset_x = 2
theme_override_constants/shadow_offset_y = 2
theme_override_font_sizes/font_size = 11
text = "17 Fan del Pogo Eterno\n>> Amplificador al 11"
horizontal_alignment = 1
[node name="FinishZone" type="Area2D" parent="."]
collision_layer = 0
collision_mask = 2
position = Vector2(8180, 535)
[node name="CollisionShape2D" type="CollisionShape2D" parent="FinishZone"]
shape = SubResource("FinishShape")
[node name="DeathZone" type="Area2D" parent="."]
collision_layer = 0
collision_mask = 2
position = Vector2(4250, 770)
[node name="CollisionShape2D" type="CollisionShape2D" parent="DeathZone"]
shape = SubResource("DeathShape")
[node name="TestHUD" type="CanvasLayer" parent="."]
layer = 87
[node name="Overlay" type="Control" parent="TestHUD"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
mouse_filter = 2
[node name="Status" type="Label" parent="TestHUD/Overlay"]
layout_mode = 1
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -500.0
offset_top = 16.0
offset_right = -20.0
offset_bottom = 72.0
grow_horizontal = 0
theme_override_colors/font_color = Color(1, 0.93, 0.68, 1)
theme_override_colors/font_shadow_color = Color(0.02, 0.02, 0.02, 0.95)
theme_override_constants/shadow_offset_x = 2
theme_override_constants/shadow_offset_y = 2
theme_override_font_sizes/font_size = 17
text = "LAB THRASH 00 / 17"
horizontal_alignment = 2
[node name="FinishMessage" type="Label" parent="TestHUD/Overlay"]
layout_mode = 1
anchor_left = 0.5
anchor_top = 0.32
anchor_right = 0.5
anchor_bottom = 0.32
offset_left = -330.0
offset_top = -35.0
offset_right = 330.0
offset_bottom = 95.0
theme_override_colors/font_color = Color(1, 0.90, 0.32, 1)
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
theme_override_constants/shadow_offset_x = 3
theme_override_constants/shadow_offset_y = 3
theme_override_font_sizes/font_size = 32 theme_override_font_sizes/font_size = 32
horizontal_alignment = 1
vertical_alignment = 1
visible = false visible = false
[node name="MobileControls" parent="." instance=ExtResource("4_mobile_controls")] [node name="MobileControls" parent="." instance=ExtResource("2_mobile")]
File diff suppressed because it is too large. Load diff
+8 -1
View File
@@ -4,6 +4,9 @@ extends CharacterBody2D
signal health_changed(current_health: int, max_health: int) signal health_changed(current_health: int, max_health: int)
signal died signal died
signal special_charge_changed(current_charge: int, max_charge: int) signal special_charge_changed(current_charge: int, max_charge: int)
## Emitted only after an object successfully applies its effect.
## The test level uses this signal to count items actually collected.
signal pickup_collected(data: PickupData)
# Collision layers used by this first playable slice. # Collision layers used by this first playable slice.
@@ -148,7 +151,8 @@ const ENEMY_HURTBOX_MASK: int = 1 << 4
## Maximum damage dealt by the special (at full charge, closest to player). ## Maximum damage dealt by the special (at full charge, closest to player).
@export_range(0, 100, 1) var special_max_damage: int = 30 @export_range(0, 100, 1) var special_max_damage: int = 30
## Radius no longer used for full-screen special; kept for backwards compatibility. ## Optional hard cutoff for the special. Very large = previous full-screen behaviour.
## The Level 01 test sets a smaller radius to keep encounters independent.
@export var special_radius: float = 100000.0 @export var special_radius: float = 100000.0
@@ -508,6 +512,8 @@ func _apply_special_attack(charge_used: int = special_max_charge) -> void:
continue continue
var distance: float = global_position.distance_to(enemy.global_position) var distance: float = global_position.distance_to(enemy.global_position)
if special_radius > 0.0 and distance > special_radius:
continue
# Damage falls off with distance: maximum at the player, lower farther away # Damage falls off with distance: maximum at the player, lower farther away
# affects the whole screen (no hard circle cutoff) # affects the whole screen (no hard circle cutoff)
var distance_factor: float = 1.0 - clamp(distance / max_distance, 0.0, 1.0) var distance_factor: float = 1.0 - clamp(distance / max_distance, 0.0, 1.0)
@@ -578,6 +584,7 @@ func collect_pickup(data: PickupData) -> bool:
_: _:
push_warning("Unknown pickup effect: %s" % data.effect_type) push_warning("Unknown pickup effect: %s" % data.effect_type)
return false return false
pickup_collected.emit(data)
return true return true
+81
View File
@@ -0,0 +1,81 @@
"""Static checks for the Android item test course (no Godot runtime needed).
Run from the project root: python -m unittest discover -s tests -v
These tests check references and test-course configuration, not gameplay.
"""
from pathlib import Path
import re
import unittest
from xml.etree import ElementTree
ROOT = Path(__file__).resolve().parents[1]
SCENE = ROOT / "levels/level_01.tscn"
class Level01ConfigurationTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.scene = SCENE.read_text(encoding="utf-8")
cls.resources = dict(
re.findall(r'\[ext_resource [^\n]*path="res://([^"]+)" id="([^"]+)"\]', cls.scene)
)
# Format is path -> id; invert to follow ExtResource("item_N").
cls.by_id = {resource_id: path for path, resource_id in cls.resources.items()}
cls.stations = re.findall(
r'\[node name="Station(\d{2})" parent="TestEnemies" instance=ExtResource\("(v\d+)"\)\]'
r'\s*position = Vector2\(([\d.]+), ([\d.]+)\)'
r'\s*guaranteed_drop = ExtResource\("(item_\d+)"\)',
cls.scene,
)
def test_seventeen_different_guaranteed_drops(self):
self.assertEqual(len(self.stations), 17)
self.assertEqual([s[0] for s in self.stations], [f"{i:02d}" for i in range(1, 18)])
files = [self.by_id[station[4]] for station in self.stations]
self.assertEqual(len(set(files)), 17)
for path in files:
self.assertTrue((ROOT / path).is_file(), path)
def test_enemy_variants_disable_respawn(self):
self.assertEqual(len({station[1] for station in self.stations}), 5)
for station in self.stations:
scene_path = self.by_id[station[1]]
enemy_scene = (ROOT / scene_path).read_text(encoding="utf-8")
self.assertIn("respawn_delay = 0.0", enemy_scene)
self.assertIn("chase_radius = 135.0", enemy_scene)
def test_floor_covers_all_encounters_and_finish(self):
xs = [float(station[2]) for station in self.stations]
self.assertEqual(xs, sorted(xs))
self.assertTrue(all(0 <= x <= 8500 for x in xs))
self.assertIn("size = Vector2(8500, 40)", self.scene)
self.assertIn("position = Vector2(8180, 535)", self.scene)
self.assertIn("camera.limit_right = LEVEL_WIDTH", (ROOT / "levels/level_01.gd").read_text())
def test_finish_and_death_areas_detect_player_layer(self):
for area in ("FinishZone", "DeathZone"):
definition = re.search(
rf'\[node name="{area}" type="Area2D" parent="\."\](.*?)(?=\n\[node )',
self.scene,
re.S,
)
self.assertIsNotNone(definition)
self.assertIn("collision_mask = 2", definition.group(1))
def test_every_enemy_svg_is_valid_and_present(self):
folder = ROOT / "assets/enemies"
sprites = sorted(folder.glob("*.svg"))
self.assertEqual(len(sprites), 5)
for svg in sprites:
root = ElementTree.parse(svg).getroot()
self.assertEqual(root.attrib["viewBox"], "0 0 32 56")
self.assertTrue(len(root) > 20, svg.name)
def test_all_external_scene_references_exist(self):
for path in self.resources:
self.assertTrue((ROOT / path).is_file(), path)
if __name__ == "__main__":
unittest.main()
+29 -20
View File
@@ -10,36 +10,45 @@ extends CanvasLayer
@onready var health_bar: ProgressBar = $HUD/HealthBar @onready var health_bar: ProgressBar = $HUD/HealthBar
@onready var health_label: Label = $HUD/HealthBar/HealthLabel @onready var health_label: Label = $HUD/HealthBar/HealthLabel
@onready var speed_label: Label = $HUD/SpeedLabel @onready var effects_label: Label = $HUD/EffectsLabel
var player_ref: Node var player_ref: Node
func _ready() -> void: func _ready() -> void:
var player: Node = get_parent() player_ref = get_parent()
player_ref = player if not player_ref.has_signal(&"health_changed"):
if player == null or not player.has_signal(&"health_changed"): push_error("PlayerHealthHUD must be a child of a Player.")
push_error("PlayerHealthHUD must be a child of a Player with health_changed signal.")
return return
# Children enter _ready before Player. Its initial signal arrives afterward.
# Child _ready() runs before Player._ready(). We connect here first and the player_ref.connect(&"health_changed", _on_health_changed)
# Player will emit its initial health value a moment later during its _ready(). effects_label.visible = false
player.connect(&"health_changed", _on_health_changed)
if speed_label:
speed_label.visible = false
func _process(_delta: float) -> void: func _process(_delta: float) -> void:
if player_ref == null or speed_label == null: if player_ref == null:
return return
if "get" in player_ref and player_ref.has_method("get"):
pass # Display each active effect individually: essential when validating all
var t = player_ref.get("_speed_boost_timer") # eight pickup families on a phone. Property names match Player's timers.
if t != null and float(t) > 0.0: var active: Array[String] = []
speed_label.visible = true for effect in [
speed_label.text = "SPEED UP: %ds" % int(float(t)) ["VELOCIDAD", "_speed_boost_timer"],
else: ["DANO", "_damage_boost_timer"],
speed_label.visible = false ["GOLPE AEREO", "_air_damage_boost_timer"],
["DEFENSA", "_damage_reduction_timer"],
["SALTO", "_jump_boost_timer"],
]:
var seconds: float = float(player_ref.get(effect[1]))
if seconds > 0.0:
active.append("%s: %ds" % [effect[0], ceili(seconds)])
var shield_hits: int = int(player_ref.get("_shield_hits"))
if shield_hits > 0:
active.append("ESCUDO: %d golpe(s)" % shield_hits)
effects_label.visible = not active.is_empty()
effects_label.text = "\n".join(active)
func _on_health_changed(current_health: int, max_health: int) -> void: func _on_health_changed(current_health: int, max_health: int) -> void:
+7 -7
View File
@@ -64,16 +64,16 @@ text = "HP 5 / 5"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1 vertical_alignment = 1
[node name="SpeedLabel" type="Label" parent="HUD"] [node name="EffectsLabel" type="Label" parent="HUD"]
layout_mode = 0 layout_mode = 0
offset_left = 18.0 offset_left = 18.0
offset_top = 70.0 offset_top = 106.0
offset_right = 278.0 offset_right = 298.0
offset_bottom = 98.0 offset_bottom = 255.0
theme_override_colors/font_color = Color(1, 0.8, 0.2, 1) theme_override_colors/font_color = Color(1, 0.8, 0.2, 1)
theme_override_colors/font_shadow_color = Color(0, 0, 0, 0.9) theme_override_colors/font_shadow_color = Color(0, 0, 0, 0.9)
theme_override_font_sizes/font_size = 16 theme_override_font_sizes/font_size = 16
text = "SPEED UP: 0s" text = "VELOCIDAD: 0s"
horizontal_alignment = 1 horizontal_alignment = 0
vertical_alignment = 1 vertical_alignment = 0
visible = false visible = false
+3 -3
View File
@@ -15,9 +15,9 @@ mouse_filter = 2
[node name="SpecialBar" type="ProgressBar" parent="HUD"] [node name="SpecialBar" type="ProgressBar" parent="HUD"]
offset_left = 18.0 offset_left = 18.0
offset_top = 44.0 offset_top = 74.0
offset_right = 220.0 offset_right = 278.0
offset_bottom = 64.0 offset_bottom = 94.0
max_value = 100.0 max_value = 100.0
value = 0.0 value = 0.0
show_percentage = false show_percentage = false