Compare commits

Author SHA1 Message Date
ankdev c4773c94e7 Merge pull request 'Items integrados y mejoras' (#22) from feature/ia_automated_test into main
Android Debug APK / build (push) Successful in 47s
Reviewed-on: #22
2026-10-21 08:46:53 +00:00
Diego De la Viuda Llorente 8fc8925151 Items integrados y mejoras 2026-10-21 10:40:14 +02:00
ankdev 45ee99b054 Merge pull request 'Arreglados los pickups' (#21) from feature/ia_automated_test into main
Android Debug APK / build (push) Successful in 41s
Reviewed-on: #21
2026-10-20 16:10:10 +00:00
Diego De la Viuda Llorente 1fbfdf3f8a Arreglados los pickups 2026-10-20 18:01:21 +02:00
ankdev ec1f211956 Merge pull request 'Feature/ia automated test' (#20) from feature/ia_automated_test into main
Android Debug APK / build (push) Successful in 45s
Reviewed-on: #20
2026-10-20 15:36:11 +00:00
Diego De la Viuda Llorente 5c3d16951e bug arreglado 2026-10-20 17:34:09 +02:00
Diego De la Viuda Llorente 27f8b4b70e Añadida la fuente nueva 2026-10-20 17:28:05 +02:00
Diego De la Viuda Llorente 82c7963767 bug arreglado 2026-10-20 17:20:42 +02:00
ankdev 4c4d52ef3d Merge pull request 'bug arreglado' (#19) from feature/ia_automated_test into main
Android Debug APK / build (push) Successful in 40s
Reviewed-on: #19
2026-10-20 14:58:32 +00:00
Diego De la Viuda Llorente 84c148f1ab bug arreglado 2026-10-20 16:56:55 +02:00
ankdev fe0a134b8a Merge pull request 'Añadidos drops, ahora cae cerveza o cafe' (#18) from feature/ia_automated_test into main
Android Debug APK / build (push) Successful in 39s
Reviewed-on: #18
2026-10-20 14:24:04 +00:00
Diego De la Viuda Llorente 8bbf70e8cb Añadidos drops, ahora cae cerveza o cafe 2026-10-20 16:23:34 +02:00
ankdev f8f83e822e Merge pull request 'Tamaño de la camara y personaje' (#17) from feature/ia_automated_test into main
Android Debug APK / build (push) Successful in 37s
Reviewed-on: #17
2026-10-20 13:28:14 +00:00
ankdev bbecc76dbe Tamaño de la camara y personaje 2026-10-20 15:27:38 +02:00
ankdev 511e317978 Merge pull request 'Ajustes de camara' (#16) from feature/ia_automated_test into main
Android Debug APK / build (push) Successful in 37s
Reviewed-on: #16
2026-10-20 13:20:41 +00:00
Diego De la Viuda Llorente 0ff8df6a6b Ajustes de camara 2026-10-20 15:19:40 +02:00
ankdev 647d88989d Merge pull request 'Adaptacion de velocidad y tamaños del nivel' (#15) from feature/ia_automated_test into main
Android Debug APK / build (push) Successful in 37s
Reviewed-on: #15
2026-10-20 12:09:08 +00:00
Diego De la Viuda Llorente 00804de7d9 Adaptacion de velocidad y tamaños del nivel 2026-10-20 14:08:51 +02:00
ankdev 617f2d4dce Merge pull request 'Cambios en el tamaño del personaje y del hud' (#14) from feature/ia_automated_test into main
Android Debug APK / build (push) Successful in 34s
Reviewed-on: #14
2026-10-20 11:56:16 +00:00
ankdev eee0f98ab0 Cambios en el tamaño del personaje y del hud 2026-10-20 13:55:49 +02:00
ankdev 1611a98e40 Merge pull request 'Daño aumentado, tamaño de los personajes disminuid' (#13) from feature/ia_automated_test into main
Android Debug APK / build (push) Successful in 41s
Reviewed-on: #13
2026-10-20 11:43:10 +00:00
Diego De la Viuda Llorente 79a7621a42 Daño aumentado, tamaño de los personajes disminuid 2026-10-20 13:42:46 +02:00
ankdev 3e6b09c7de Merge pull request 'Daño aumentado, tamaño de los personajes disminuid' (#12) from feature/ia_automated_test into main
Android Debug APK / build (push) Successful in 39s
Reviewed-on: #12
2026-10-20 11:32:18 +00:00
Diego De la Viuda Llorente 6d0948022a Daño aumentado, tamaño de los personajes disminuid 2026-10-20 13:31:37 +02:00
ankdev d9eacb104c Merge pull request 'Cambios en la potencia y area de los ataques' (#11) from feature/ia_automated_test into main
Android Debug APK / build (push) Successful in 52s
Reviewed-on: #11
2026-10-20 09:31:15 +00:00
Diego De la Viuda Llorente eaa6c4e8d3 Cambios en la potencia y area de los ataques 2026-10-20 11:29:24 +02:00
ankdev b002952d97 Merge pull request '➕ADD: Añadido hud de botones a la nueva escena' (#10) from feature/ia_automated_test into main
Android Debug APK / build (push) Successful in 37s
Reviewed-on: #10
2026-10-16 12:09:40 +00:00
Diego De la Viuda Llorente 1b3991e2ad ➕ADD: Añadido hud de botones a la nueva escena 2026-10-16 14:09:07 +02:00
ankdev 7264f75d6a Merge pull request 'Feature/ia automated test' (#9) from feature/ia_automated_test into main
Android Debug APK / build (push) Successful in 39s
Reviewed-on: #9
2026-10-16 11:56:30 +00:00
ankdev e8c1f5d166 ♻️ Cambio la escena principal por la prueba 2026-10-16 13:52:11 +02:00
Diego De la Viuda Llorente 767c9c6c91 ➕ADD: Primer nivel de prueba 2026-10-16 13:48:06 +02:00
ankdev 623517c5fb Merge pull request 'Feature/ia automated test' (#8) from feature/ia_automated_test into main
Android Debug APK / build (push) Successful in 41s
Reviewed-on: #8
2026-10-16 11:26:02 +00:00
Diego De la Viuda Llorente f33ab4e183 🐛FIX: Reparada la funcion draw_string 2026-10-16 13:24:57 +02:00
Diego De la Viuda Llorente 80d550b6fa 🐛FIX: Reparada la funcion draw_string 2026-10-16 13:22:50 +02:00
Diego De la Viuda Llorente 37206548e1 🐛FIX: Error en el draw del enemigo 2026-10-16 13:16:44 +02:00
Diego De la Viuda Llorente 93497002ff ➕ADD: Stun al enemigo 2026-10-16 13:13:57 +02:00
ankdev 18b0ca30c2 Merge pull request '➕ADD: vida y daño para debug al enemigo' (#7) from feature/ia_automated_test into main
Android Debug APK / build (push) Successful in 44s
Reviewed-on: #7
2026-10-16 10:59:29 +00:00
Diego De la Viuda Llorente ba4db3b47e ➕ADD: vida y daño para debug al enemigo 2026-10-16 12:58:43 +02:00
ankdev 70ac0c8f3d Merge pull request 'Feature/ia automated test' (#6) from feature/ia_automated_test into main
Android Debug APK / build (push) Successful in 40s
Reviewed-on: #6
2026-10-16 10:49:37 +00:00
Diego De la Viuda Llorente b66bef09cb ♻️REFACTOR: Modificados los parametros de vida base 2026-10-16 12:49:11 +02:00
Diego De la Viuda Llorente cf42886682 ➕ADD: botones para los ataques especiales 2026-10-16 12:47:27 +02:00
ankdev abb3e5afa0 Merge pull request '🐛FIX: Arreglado fallo con fill_alpha' (#5) from feature/ia_automated_test into main
Android Debug APK / build (push) Successful in 50s
Reviewed-on: #5
2026-10-16 10:42:13 +00:00
Diego De la Viuda Llorente 18b0fae498 🐛FIX: Arreglado fallo con fill_alpha 2026-10-16 12:33:16 +02:00
ankdev 385be4e84d Merge pull request '➕ADD: Ataques y hud de energia mejorados' (#4) from feature/ia_automated_test into main
Android Debug APK / build (push) Successful in 51s
Reviewed-on: #4
2026-10-16 10:20:46 +00:00
Diego De la Viuda Llorente 9b32d97d1f ➕ADD: Ataques y hud de energia mejorados 2026-10-16 12:18:43 +02:00
ankdev 5d87de8ca1 Merge pull request 'Genera artefactos' (#3) from feature/first_player_and_enemy into main
Android Debug APK / build (push) Successful in 44s
Reviewed-on: #3
2026-10-05 16:31:59 +00:00
ankdev f5cc3b65b2 Merge pull request 'Feature/first player and enemy' (#2) from feature/first_player_and_enemy into main
Android Debug APK / build (push) Successful in 34s
Reviewed-on: #2
2026-10-05 16:20:54 +00:00
64 changed files with 1506 additions and 132 deletions

No files matched your search

+15
View File
@@ -1944,3 +1944,18 @@ LATER
``` ```
El objetivo principal es siempre tener una versión pequeña pero completamente jugable antes de ampliar el alcance. El objetivo principal es siempre tener una versión pequeña pero completamente jugable antes de ampliar el alcance.
---
## Estado actualizado: objetos y recompensas (octubre de 2026)
- **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:** 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`.
- **Pendiente:** indicadores persistentes de mejoras activas, coleccionables secretos, pruebas visuales en el editor y equilibrado.
Catálogo, pesos, estados e instrucciones: **[docs/items.md](docs/items.md)**.
> 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.
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><g fill="#f37e6d" stroke="#252132" stroke-width="1.6" stroke-linejoin="round"><rect x="3" y="5" width="26" height="23" rx="2"/><rect x="6" y="12" width="20" height="13" rx="2" fill="#3b3443"/><circle cx="16" cy="18" r="6" fill="none" stroke="#bdb7d2" stroke-width="2"/><circle cx="10" cy="9" r="1.5" fill="#ffffb8"/><circle cx="16" cy="9" r="1.5" fill="#ffffb8"/></g></svg>

After

Width:  |  Height:  |  Size: 457 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><g fill="#eac58c" stroke="#252132" stroke-width="1.6" stroke-linejoin="round"><path d="M7 26 24 5l3 3-17 20z"/><circle cx="25" cy="6" r="4" fill="#fff4d3"/><path d="m12 20 3 3" stroke="#fff" stroke-width="2"/></g></svg>

After

Width:  |  Height:  |  Size: 303 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><g fill="#ffcd5b" stroke="#252132" stroke-width="1.6" stroke-linejoin="round"><path d="M7 10h16l-2 15H9z"/><path d="M23 12h4v8h-5" fill="none" stroke="#252132" stroke-width="3"/><path d="M8 10q2-8 5-3 4-7 7 0 5-4 6 3" fill="#fff4c7"/></g></svg>

After

Width:  |  Height:  |  Size: 328 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><g fill="#f0ae55" stroke="#252132" stroke-width="1.6" stroke-linejoin="round"><path d="M4 13 16 5l12 8-3 11H7z"/><path d="M6 16h20l-2 4H8" fill="#65bf75"/><path d="M8 22h16" stroke="#fff3c7" stroke-width="3"/></g></svg>

After

Width:  |  Height:  |  Size: 303 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><g fill="#b99afa" stroke="#252132" stroke-width="1.6" stroke-linejoin="round"><path d="M8 4h12v12l7 5v6H4v-7l4-4z"/><path d="M9 10h10M8 15h11" stroke="#f7e7ff" stroke-width="2"/></g></svg>

After

Width:  |  Height:  |  Size: 272 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><g fill="#ec9fcd" stroke="#252132" stroke-width="1.6" stroke-linejoin="round"><rect x="3" y="7" width="26" height="20" rx="2"/><rect x="6" y="10" width="20" height="10" fill="#fff1dd"/><circle cx="11" cy="15" r="3" fill="#343048"/><circle cx="21" cy="15" r="3" fill="#343048"/><path d="M8 24h16" stroke="#343048" stroke-width="2"/></g></svg>

After

Width:  |  Height:  |  Size: 425 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><g fill="#a1c1cc" stroke="#252132" stroke-width="1.6" stroke-linejoin="round"><circle cx="16" cy="16" r="12"/><circle cx="16" cy="16" r="6" fill="#343048"/><circle cx="16" cy="16" r="2" fill="#c8cfde"/></g></svg>

After

Width:  |  Height:  |  Size: 296 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><g fill="#9b6243" stroke="#252132" stroke-width="1.6" stroke-linejoin="round"><path d="M7 10h17l-2 16H9z"/><path d="M24 12h3v10h-4" stroke="#252132" stroke-width="3" fill="none"/><path d="M12 4v4m7-4v4" stroke="#fff3d4" stroke-width="2"/></g></svg>

After

Width:  |  Height:  |  Size: 332 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><g fill="#e5e6fc" stroke="#252132" stroke-width="1.6" stroke-linejoin="round"><circle cx="10" cy="10" r="6" fill="none" stroke="#f8faff" stroke-width="3"/><circle cx="22" cy="22" r="6" fill="none" stroke="#f8faff" stroke-width="3"/><path d="M14 7q17 0 7 18M6 15q2 11 18 7" stroke="#343048" stroke-width="2" fill="none"/></g></svg>

After

Width:  |  Height:  |  Size: 414 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><g fill="#f55b78" stroke="#252132" stroke-width="1.6" stroke-linejoin="round"><rect x="9" y="5" width="14" height="23" rx="3"/><path d="M10 8h12M10 25h12" stroke="#fff" stroke-width="2"/><path d="m18 11-6 8h5l-3 6 8-10h-5z" fill="#fff9ac"/></g></svg>

After

Width:  |  Height:  |  Size: 334 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><g fill="#82d8f3" stroke="#252132" stroke-width="1.6" stroke-linejoin="round"><path d="M5 26h22M5 6h22M8 24l16-4-16-4 16-4L8 8" stroke="#343048" stroke-width="3" fill="none"/></g></svg>

After

Width:  |  Height:  |  Size: 269 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><g fill="#76bddc" stroke="#252132" stroke-width="1.6" stroke-linejoin="round"><rect x="6" y="4" width="20" height="24" rx="3"/><circle cx="16" cy="10" r="3" fill="#f9e68d"/><rect x="10" y="17" width="12" height="7" rx="1" fill="#343048"/></g></svg>

After

Width:  |  Height:  |  Size: 332 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><g fill="#f9a047" stroke="#252132" stroke-width="1.6" stroke-linejoin="round"><path d="M4 5 27 11 12 28z"/><path d="m4 5 23 6" stroke="#d17d39" stroke-width="5"/><circle cx="15" cy="16" r="3" fill="#c54b5a"/><circle cx="19" cy="12" r="2" fill="#c54b5a"/></g></svg>

After

Width:  |  Height:  |  Size: 348 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><g fill="#dc78f8" stroke="#252132" stroke-width="1.6" stroke-linejoin="round"><path d="M16 4Q3 3 5 14q2 9 11 15 12-10 12-17T16 4z"/><path d="m16 9-4 8h5l-2 7 7-11h-5z" fill="#fff"/></g></svg>

After

Width:  |  Height:  |  Size: 275 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><g fill="#f1e7a3" stroke="#252132" stroke-width="1.6" stroke-linejoin="round"><path d="M7 3h16l4 5v21H7z"/><path d="M23 3v6h4M11 14h12M11 19h12M11 24h9" stroke="#584c46" stroke-width="2" fill="none"/></g></svg>

After

Width:  |  Height:  |  Size: 294 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><g fill="#c2eb7e" stroke="#252132" stroke-width="1.6" stroke-linejoin="round"><path d="M8 5h6v20H8zM20 8h6v17h-6z"/><path d="M7 6h8M19 9h8" stroke="#fff" stroke-width="3"/></g></svg>

After

Width:  |  Height:  |  Size: 266 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><g fill="#83d0c5" stroke="#252132" stroke-width="1.6" stroke-linejoin="round"><rect x="4" y="10" width="24" height="17" rx="2"/><rect x="3" y="6" width="26" height="6" rx="2" fill="#defaff"/><path d="M10 18h12" stroke="#fff" stroke-width="3"/></g></svg>

After

Width:  |  Height:  |  Size: 337 B

+58
View File
@@ -0,0 +1,58 @@
# Objetos de Mortal Maze
Estado: **implementado** = recurso, icono SVG y efecto integrados en el jugador. Los valores son provisionales hasta playtesting.
Los SVG son de 32 x 32 px, y la escena `pickup.tscn` escala el Sprite2D a 0.5: **16 x 16 px visibles**, igual que el placeholder original.
| Objeto (recurso) | Descripcion | Efecto | Estado |
|---|---|---|---|
| **Espuma del Pogo** (`beer.tres`) | Espuma garantizada. El contenido, no tanto. | +30 PV | **Implementado** |
| **Tostado del Averno** (`coffee.tres`) | 240 BPM por las venas. | +25% velocidad, 12 s | **Implementado** |
| **Bocata del Roadie** (`bocata_roadie.tres`) | Lleva tres giras en la furgoneta. | +20 PV | **Implementado** |
| **Pizza Post-Bolo** (`pizza_post_bolo.tres`) | La encontraron detras del amplificador. | +45 PV | **Implementado** |
| **Tupper del Bateria** (`tupper_bateria.tres`) | Ni su madre recuerda que le puso. | +70 PV | **Implementado** |
| **Lata de Feedback** (`lata_feedback.tres`) | Hace mas ruido al abrirse que el guitarrista. | +15% velocidad, 20 s | **Implementado** |
| **Botas del Doble Bombo** (`botas_doble_bombo.tres`) | El bateria marca el ritmo de la carrera. | +35% velocidad, 8 s | **Implementado** |
| **Pua del Apocalipsis** (`pua_apocalipsis.tres`) | Tres acordes. Cero supervivientes. | +30% daño básico/aéreo, 12 s | **Implementado** |
| **Pedal de Distorsion** (`pedal_distorsion.tres`) | El tecnico de sonido ha dimitido. | +50% daño básico/aéreo, 7 s | **Implementado** |
| **Cuerda de Titanio** (`cuerda_titanio.tres`) | No desafina. Tampoco perdona. | +20% daño básico/aéreo, 20 s | **Implementado** |
| **Casete de la Demo Perdida** (`casete_demo.tres`) | Grabado en un garaje. Se nota. | +25 especial | **Implementado** |
| **Setlist del Fin del Mundo** (`setlist_fin.tres`) | Si no queda escenario, el orden da igual. | +50 especial | **Implementado** |
| **Amplificador al 11** (`amplificador_11.tres`) | El 10 era para cobardes. | +100 especial | **Implementado** |
| **Cinta Americana Infinita** (`cinta_americana.tres`) | Arregla todo, menos la afinacion. | Absorbe el próximo golpe | **Implementado** |
| **Tapones del Tecnico** (`tapones_tecnico.tres`) | Por una vez, el tecnico tenia razon. | -25% daño recibido, 12 s | **Implementado** |
| **Muelles del Stage Diving** (`muelles_stage.tres`) | El aterrizaje no esta incluido. | +20% impulso de salto, 12 s | **Implementado** |
| **Baqueta Sismica** (`baqueta_sismica.tres`) | Una prueba de sonido y desaparecio el suelo. | +50% daño aéreo adicional, 10 s | **Implementado** |
## Distribución y reglas
- Walker: 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.
- 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.
- 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.
## Pendiente (no implementado)
| Coleccionable | Descripción | Estado |
|---|---|---|
| La Pua Perdida | Lleva desaparecida desde el primer concierto. Estaba debajo del sofá. | Pendiente: sistema de coleccionables |
| La Primera Maqueta | La grabaron en 2008. Todavía están intentando mezclarla. | Pendiente: sistema de coleccionables |
| El Calcetin del Bajista | Nadie sabe de quien es. Todos saben que hay que alejarse. | Pendiente: sistema de coleccionables |
| La Factura del Local | Impagada desde tiempos inmemoriales. | Pendiente: sistema de coleccionables |
## Añadir un objeto
1. Duplica un `.tres` de `pickups/data/`; cambia `id`, `display_name`, `description`, `icon`, `effect_type`, `value` y `duration`.
2. Coloca un SVG 32×32 en `assets/pickups/`; Godot lo importa como Texture2D.
3. Si debe caer de enemigos, añade una entrada `PickupDrop` con su peso en `enemies/walker/walker_drop.tres`.
4. Si requiere una mecánica nueva, añádela expresamente en `Player.collect_pickup()` y documenta aquí su efecto.
5. Prueba a recogerlo con vida/especial llenos, dos veces seguidas y justo cuando expira.
## Comprobaciones pendientes
- Probar visualmente las importaciones SVG y cada efecto en Godot 4.7.
- Equilibrar tiempos y probabilidades tras jugar varios niveles.
- Añadir indicadores persistentes de buffs en el HUD (ahora se muestra texto flotante al recoger).
- Revisar la clasificación por edades con el cuestionario IARC/Google Play; nombres ficticios no garantizan ninguna clasificación.
+136 -11
View File
@@ -9,6 +9,7 @@ signal died
# actually share instead of guessing an abstraction in advance. # actually share instead of guessing an abstraction in advance.
const PLAYER_HURTBOX_MASK: int = 1 << 3 const PLAYER_HURTBOX_MASK: int = 1 << 3
const DROP_MANAGER := preload("res://pickups/drop_manager.gd")
enum AttackState { enum AttackState {
@@ -25,8 +26,8 @@ enum AttackState {
@export_category("Movement") @export_category("Movement")
@export var move_speed: float = 85.0 @export var move_speed: float = 78.0
@export var max_fall_speed: float = 1200.0 @export var max_fall_speed: float = 800.0
# ============================================================================ # ============================================================================
@@ -35,7 +36,7 @@ enum AttackState {
@export_category("Combat") @export_category("Combat")
@export_range(1, 100, 1) var max_health: int = 3 @export_range(1, 100, 1) var max_health: int = 20
@export_range(0, 100, 1) var attack_damage: int = 1 @export_range(0, 100, 1) var attack_damage: int = 1
## Minimum time between the beginning of two attacks. ## Minimum time between the beginning of two attacks.
@@ -44,11 +45,11 @@ enum AttackState {
## Horizontal distance at which the Walker stops chasing and prepares a hit. ## Horizontal distance at which the Walker stops chasing and prepares a hit.
## This is intentionally wider than the final hitbox so entering range does not ## This is intentionally wider than the final hitbox so entering range does not
## mean taking unavoidable damage. ## mean taking unavoidable damage.
@export var attack_trigger_distance: float = 125.0 @export var attack_trigger_distance: float = 140.0
## Keeps the Walker from starting a ground attack against a player far above or ## Keeps the Walker from starting a ground attack against a player far above or
## below it. ## below it.
@export var attack_vertical_tolerance: float = 70.0 @export var attack_vertical_tolerance: float = 80.0
## Readable pause before the dangerous part of the attack starts. During this ## Readable pause before the dangerous part of the attack starts. During this
## time the direction is locked, so moving behind the enemy is a valid dodge. ## time the direction is locked, so moving behind the enemy is a valid dodge.
@@ -57,24 +58,46 @@ enum AttackState {
## Duration of the actual hit. The hitbox sweeps forward during this window. ## Duration of the actual hit. The hitbox sweeps forward during this window.
@export var attack_duration: float = 0.22 @export var attack_duration: float = 0.22
## Small recovery after the hit before the enemy can move again. ## Small recovery after the hit before the enemy can hitbox again.
@export var attack_recovery_duration: float = 0.30 @export var attack_recovery_duration: float = 0.30
## Where the hitbox starts, relative to the enemy while facing right. ## Where the hitbox starts, relative to the enemy while facing right.
@export var attack_start_offset: Vector2 = Vector2(34.0, 0.0) @export var attack_start_offset: Vector2 = Vector2(34.0, 0.0)
## Furthest horizontal position reached by the moving hitbox. ## Furthest horizontal position reached by the moving hitbox.
@export var attack_reach: float = 105.0 @export var attack_reach: float = 120.0
## A successful player hit briefly interrupts the Walker. This makes attacking ## A successful player hit briefly interrupts the Walker. This makes attacking
## during its windup useful instead of forcing an unavoidable damage trade. ## during its windup useful instead of forcing an unavoidable damage trade.
@export var hit_stun_duration: float = 0.18 @export var hit_stun_duration: float = 0.18
## Strength of the knockback applied per point of damage. The final push is
## divided by the enemy's max health, so tougher enemies move less.
@export var knockback_strength: float = 400.0
## How long the knockback impulse lasts before friction brings the enemy to a halt.
@export var knockback_duration: float = 0.4
## Damage threshold to trigger a longer stun (e.g. a fully charged special attack).
@export_range(0, 100, 1) var stun_damage_threshold: int = 5
## Stun duration when the received damage exceeds the threshold.
@export var strong_hit_stun_duration: float = 2.0
# ============================================================================ # ============================================================================
# RESPAWN # RESPAWN
# ============================================================================ # ============================================================================
@export_category("Drops")
## Table defining what pickups can drop on death (by chance).
@export var drop_table: PickupDropTable
@export_category("Respawn")
@export_category("Respawn") @export_category("Respawn")
## Enough downtime to make defeating an enemy meaningful before it comes back. ## Enough downtime to make defeating an enemy meaningful before it comes back.
@@ -92,6 +115,10 @@ enum AttackState {
## The orange area during windup previews the complete attack sweep. ## The orange area during windup previews the complete attack sweep.
@export var show_debug_hitboxes: bool = true @export var show_debug_hitboxes: bool = true
## Shows the enemy health bar above its head and floating damage numbers when
## it is hit. Purely debug: can be disabled once final art and UI exist.
@export var show_debug_enemy_info: bool = true
# ============================================================================ # ============================================================================
# NODES # NODES
@@ -127,6 +154,13 @@ var target: Node2D
## Prevents one sweep from damaging the same target once per physics frame. ## Prevents one sweep from damaging the same target once per physics frame.
var attack_hit_targets: Dictionary = {} var attack_hit_targets: Dictionary = {}
## Timer for the knockback impulse applied when the enemy is hit.
var knockback_timer: float = 0.0
## Floating damage numbers shown above the enemy when it takes damage.
## Each entry: { text: String, local_pos: Vector2, timer: float }
var _damage_texts: Array = []
func _ready() -> void: func _ready() -> void:
spawn_position = global_position spawn_position = global_position
@@ -137,6 +171,11 @@ func _ready() -> void:
attack_hitbox.collision_mask = PLAYER_HURTBOX_MASK attack_hitbox.collision_mask = PLAYER_HURTBOX_MASK
attack_hitbox.monitoring = true attack_hitbox.monitoring = true
if drop_table == null:
var default_table := load("res://enemies/walker/walker_drop.tres")
if default_table != null:
drop_table = default_table
visibility_notifier.screen_entered.connect(_wake_up) visibility_notifier.screen_entered.connect(_wake_up)
_update_facing() _update_facing()
@@ -149,6 +188,7 @@ func _physics_process(delta: float) -> void:
return return
_update_timers(delta) _update_timers(delta)
_update_damage_texts(delta)
_apply_gravity(delta) _apply_gravity(delta)
# The enemy deliberately does nothing until the camera has shown it once. # The enemy deliberately does nothing until the camera has shown it once.
@@ -167,11 +207,18 @@ func _physics_process(delta: float) -> void:
queue_redraw() queue_redraw()
return return
# Being hit pauses both movement and attack for only a few frames. The # Being hit pauses both movement and attack. While the knockback impulse
# lasts the enemy is pushed back, then friction brings it to a halt. The
# cooldown keeps running, so interrupting an attack does not make the enemy # cooldown keeps running, so interrupting an attack does not make the enemy
# immediately start another one. # immediately start another one.
if hit_stun_timer > 0.0: if hit_stun_timer > 0.0:
velocity.x = 0.0 if knockback_timer > 0.0:
knockback_timer = max(knockback_timer - delta, 0.0)
var fade: float = knockback_timer / knockback_duration if knockback_duration > 0.0 else 0.0
velocity.x = move_toward(velocity.x, 0.0, knockback_strength * delta * (1.0 - fade + 0.1))
else:
velocity.x = move_toward(velocity.x, 0.0, knockback_strength * delta)
move_and_slide() move_and_slide()
queue_redraw() queue_redraw()
return return
@@ -378,6 +425,15 @@ func _update_timers(delta: float) -> void:
hit_stun_timer = max(hit_stun_timer - delta, 0.0) hit_stun_timer = max(hit_stun_timer - delta, 0.0)
# Updates floating damage numbers: they drift upward and fade out over time.
func _update_damage_texts(delta: float) -> void:
for i in range(_damage_texts.size() - 1, -1, -1):
var entry: Dictionary = _damage_texts[i]
entry.timer = max(entry.timer - delta, 0.0)
entry.local_pos.y -= 40.0 * delta
if entry.timer <= 0.0:
_damage_texts.remove_at(i)
# ============================================================================ # ============================================================================
# DAMAGE AND RESPAWN # DAMAGE AND RESPAWN
# ============================================================================ # ============================================================================
@@ -388,6 +444,14 @@ func take_damage(amount: int, source_position: Vector2) -> void:
current_health = max(current_health - amount, 0) current_health = max(current_health - amount, 0)
# Floating damage number (debug only).
if show_debug_enemy_info:
_damage_texts.append({
"text": str(amount),
"local_pos": Vector2(0, -25),
"timer": 1.0
})
if current_health == 0: if current_health == 0:
_die() _die()
return return
@@ -395,8 +459,25 @@ func take_damage(amount: int, source_position: Vector2) -> void:
# Light enemies are interruptible. This makes a well-timed player attack a # Light enemies are interruptible. This makes a well-timed player attack a
# defensive option and avoids mandatory damage trades at close range. # defensive option and avoids mandatory damage trades at close range.
_interrupt_attack() _interrupt_attack()
hit_stun_timer = hit_stun_duration
velocity.x = 0.0 # Knockback: stronger hits push harder, tougher enemies (more max health)
# resist the push. Direction is away from the damage source.
var knockback_dir: float = signf(global_position.x - source_position.x)
if knockback_dir == 0.0:
knockback_dir = 1.0
var knockback_force: float = float(amount) * knockback_strength / float(max_health)
velocity.x = knockback_dir * knockback_force
velocity.y = -180.0
knockback_timer = knockback_duration
# Stun: normal hits use the brief hit stun; very strong hits (e.g. a fully
# charged special attack) trigger a longer stun.
if amount >= stun_damage_threshold:
hit_stun_timer = max(hit_stun_timer, strong_hit_stun_duration)
else:
hit_stun_timer = max(hit_stun_timer, hit_stun_duration)
var reaction_direction: float = signf(source_position.x - global_position.x) var reaction_direction: float = signf(source_position.x - global_position.x)
if reaction_direction != 0.0: if reaction_direction != 0.0:
@@ -408,6 +489,16 @@ func _die() -> void:
is_dead = true is_dead = true
died.emit() died.emit()
if drop_table != null:
var drops = DROP_MANAGER.roll_drop(drop_table)
if not drops.is_empty():
var parent := get_tree().current_scene
if parent == null:
parent = get_tree().root.get_child(get_tree().root.get_child_count() - 1)
if parent == null:
parent = get_tree().root
DROP_MANAGER.spawn_drops(drops, parent, global_position)
velocity = Vector2.ZERO velocity = Vector2.ZERO
visible = false visible = false
@@ -430,6 +521,7 @@ func _respawn() -> void:
attack_phase_timer = 0.0 attack_phase_timer = 0.0
attack_cooldown_timer = 0.0 attack_cooldown_timer = 0.0
hit_stun_timer = 0.0 hit_stun_timer = 0.0
knockback_timer = 0.0
attack_hit_targets.clear() attack_hit_targets.clear()
attack_direction = facing_direction attack_direction = facing_direction
_reset_attack_hitbox_position() _reset_attack_hitbox_position()
@@ -460,6 +552,11 @@ func _draw() -> void:
Color(0.85, 0.85, 0.90, 1.0) Color(0.85, 0.85, 0.90, 1.0)
) )
# Enemy health bar and floating damage numbers (debug overlay).
if show_debug_enemy_info:
_draw_enemy_health_bar()
_draw_damage_texts()
if not show_debug_hitboxes: if not show_debug_hitboxes:
return return
@@ -516,3 +613,31 @@ func _draw_rectangle_collision(
var rect: Rect2 = Rect2(center - rectangle.size / 2.0, rectangle.size) var rect: Rect2 = Rect2(center - rectangle.size / 2.0, rectangle.size)
draw_rect(rect, fill_color, true) draw_rect(rect, fill_color, true)
draw_rect(rect, outline_color, false, 2.0) draw_rect(rect, outline_color, false, 2.0)
# Draws a small horizontal health bar just above the enemy's head.
func _draw_enemy_health_bar() -> void:
var bar_width: float = 40.0
var bar_height: float = 5.0
var bar_pos: Vector2 = Vector2(-bar_width * 0.5, -48.0)
# Background.
draw_rect(Rect2(bar_pos, Vector2(bar_width, bar_height)), Color(0.2, 0.2, 0.2, 0.8), true)
# Fill.
var fill_ratio: float = current_health / max_health if max_health > 0 else 0.0
draw_rect(
Rect2(bar_pos, Vector2(bar_width * fill_ratio, bar_height)),
Color(0.85, 0.2, 0.2, 0.95),
true
)
# Border.
draw_rect(Rect2(bar_pos, Vector2(bar_width, bar_height)), Color(1, 1, 1, 0.6), false, 1.0)
# Draws floating damage numbers that drift upward and fade out.
func _draw_damage_texts() -> void:
var font: Font = ThemeDB.get_default_theme().get_font("font", "Label")
if font == null:
return
for entry in _damage_texts:
var alpha: float = clamp(entry.timer, 0.0, 1.0)
draw_string(font, entry.local_pos, entry.text, 0, -1, 16, Color(1, 1, 1, alpha))
+6 -6
View File
@@ -3,12 +3,12 @@
[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"]
[sub_resource type="RectangleShape2D" id="BodyShape"] [sub_resource type="RectangleShape2D" id="BodyShape"]
size = Vector2(42, 78) size = Vector2(28, 52)
[sub_resource type="RectangleShape2D" id="AttackShape"] [sub_resource type="RectangleShape2D" id="AttackShape"]
size = Vector2(50, 60) size = Vector2(32, 40)
[node name="Walker" type="CharacterBody2D"] [node name="Walker" type="CharacterBody2D" groups=["enemy"]]
collision_layer = 4 collision_layer = 4
collision_mask = 1 collision_mask = 1
script = ExtResource("1_walker") script = ExtResource("1_walker")
@@ -36,10 +36,10 @@ monitorable = false
shape = SubResource("AttackShape") shape = SubResource("AttackShape")
[node name="FloorProbe" type="RayCast2D" parent="."] [node name="FloorProbe" type="RayCast2D" parent="."]
position = Vector2(24, 34) position = Vector2(17, 24)
target_position = Vector2(0, 34) target_position = Vector2(0, 24)
collision_mask = 1 collision_mask = 1
enabled = true enabled = true
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."] [node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]
rect = Rect2(-32, -48, 64, 96) rect = Rect2(-17, -25, 34, 50)
+101
View File
@@ -0,0 +1,101 @@
[gd_resource type="Resource" script_class="PickupDropTable" load_steps=33 format=3]
[ext_resource type="Script" path="res://pickups/pickup_drop.gd" id="1_drop"]
[ext_resource type="Script" path="res://pickups/pickup_drop_table.gd" id="2_table"]
[ext_resource type="Resource" path="res://pickups/data/beer.tres" id="item_0"]
[ext_resource type="Resource" path="res://pickups/data/coffee.tres" id="item_1"]
[ext_resource type="Resource" path="res://pickups/data/bocata_roadie.tres" id="item_2"]
[ext_resource type="Resource" path="res://pickups/data/pizza_post_bolo.tres" id="item_3"]
[ext_resource type="Resource" path="res://pickups/data/tupper_bateria.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/botas_doble_bombo.tres" id="item_6"]
[ext_resource type="Resource" path="res://pickups/data/pua_apocalipsis.tres" id="item_7"]
[ext_resource type="Resource" path="res://pickups/data/pedal_distorsion.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/casete_demo.tres" id="item_10"]
[ext_resource type="Resource" path="res://pickups/data/setlist_fin.tres" id="item_11"]
[ext_resource type="Resource" path="res://pickups/data/amplificador_11.tres" id="item_12"]
[ext_resource type="Resource" path="res://pickups/data/cinta_americana.tres" id="item_13"]
[ext_resource type="Resource" path="res://pickups/data/tapones_tecnico.tres" id="item_14"]
[sub_resource type="Resource" id="drop_0"]
script = ExtResource("1_drop")
pickup = ExtResource("item_0")
weight = 15.0
[sub_resource type="Resource" id="drop_1"]
script = ExtResource("1_drop")
pickup = ExtResource("item_1")
weight = 10.0
[sub_resource type="Resource" id="drop_2"]
script = ExtResource("1_drop")
pickup = ExtResource("item_2")
weight = 14.0
[sub_resource type="Resource" id="drop_3"]
script = ExtResource("1_drop")
pickup = ExtResource("item_3")
weight = 9.0
[sub_resource type="Resource" id="drop_4"]
script = ExtResource("1_drop")
pickup = ExtResource("item_4")
weight = 2.0
[sub_resource type="Resource" id="drop_5"]
script = ExtResource("1_drop")
pickup = ExtResource("item_5")
weight = 10.0
[sub_resource type="Resource" id="drop_6"]
script = ExtResource("1_drop")
pickup = ExtResource("item_6")
weight = 5.0
[sub_resource type="Resource" id="drop_7"]
script = ExtResource("1_drop")
pickup = ExtResource("item_7")
weight = 8.0
[sub_resource type="Resource" id="drop_8"]
script = ExtResource("1_drop")
pickup = ExtResource("item_8")
weight = 3.0
[sub_resource type="Resource" id="drop_9"]
script = ExtResource("1_drop")
pickup = ExtResource("item_9")
weight = 5.0
[sub_resource type="Resource" id="drop_10"]
script = ExtResource("1_drop")
pickup = ExtResource("item_10")
weight = 8.0
[sub_resource type="Resource" id="drop_11"]
script = ExtResource("1_drop")
pickup = ExtResource("item_11")
weight = 4.0
[sub_resource type="Resource" id="drop_12"]
script = ExtResource("1_drop")
pickup = ExtResource("item_12")
weight = 1.0
[sub_resource type="Resource" id="drop_13"]
script = ExtResource("1_drop")
pickup = ExtResource("item_13")
weight = 3.0
[sub_resource type="Resource" id="drop_14"]
script = ExtResource("1_drop")
pickup = ExtResource("item_14")
weight = 3.0
[resource]
script = ExtResource("2_table")
drops = Array[ExtResource("1_drop")]([SubResource("drop_0"), SubResource("drop_1"), SubResource("drop_2"), SubResource("drop_3"), SubResource("drop_4"), SubResource("drop_5"), SubResource("drop_6"), SubResource("drop_7"), SubResource("drop_8"), SubResource("drop_9"), SubResource("drop_10"), SubResource("drop_11"), SubResource("drop_12"), SubResource("drop_13"), SubResource("drop_14")])
drop_chance = 0.5
min_drops = 1
max_drops = 1
+79
View File
@@ -0,0 +1,79 @@
extends Node2D
## Señal que se emite cuando el jugador alcanza el final del nivel.
signal level_completed
@onready var player: Node2D = $Player
@onready var message_label: Label = $MessageLabel
# Colores temporales de cada plataforma. Se pueden cambiar por texturas más tarde.
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
func _ready() -> void:
message_label.visible = false
# Zona de final del nivel (meta).
var finish: Area2D = $FinishZone
if finish:
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)
func _process(delta: float) -> void:
if showing_victory:
victory_timer += delta
if victory_timer >= 3.0:
get_tree().reload_current_scene()
func _on_finish_entered(body: Node2D) -> void:
if body != player:
return
showing_victory = true
message_label.text = "¡NIVEL COMPLETADO!"
message_label.visible = true
func _on_death_entered(body: Node2D) -> void:
if body != player:
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)
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:
var world: Node = $World
for child in world.get_children():
if child is CollisionShape2D:
var shape: Shape2D = child.shape
if shape is RectangleShape2D:
var rect: Rect2 = Rect2(child.position - shape.size / 2.0, shape.size)
var color: Color = platform_colors.get(child.name, Color(0.5, 0.5, 0.5, 1.0))
draw_rect(rect, color, true)
draw_rect(rect, Color(1, 1, 1, 0.3), false, 2.0)
+83
View File
@@ -0,0 +1,83 @@
[gd_scene load_steps=16 format=3]
[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="4_mobile_controls"]
[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="Resource" path="res://pickups/data/pua_apocalipsis.tres" id="6_pua"]
[sub_resource type="RectangleShape2D" id="FloorShape"]
size = Vector2(1400, 40)
[sub_resource type="RectangleShape2D" id="PlatformShape"]
size = Vector2(220, 20)
[sub_resource type="RectangleShape2D" id="FinishShape"]
size = Vector2(60, 40)
[sub_resource type="RectangleShape2D" id="DeathShape"]
size = Vector2(3000, 200)
[node name="Level01" type="Node2D"]
script = ExtResource("3_level")
[node name="World" type="StaticBody2D" parent="."]
collision_layer = 1
collision_mask = 1
[node name="Floor" type="CollisionShape2D" parent="World"]
position = Vector2(700, 620)
shape = SubResource("FloorShape")
[node name="Platform1" type="CollisionShape2D" parent="World"]
position = Vector2(300, 470)
shape = SubResource("PlatformShape")
[node name="Platform2" type="CollisionShape2D" parent="World"]
position = Vector2(1100, 470)
shape = SubResource("PlatformShape")
[node name="Platform3" type="CollisionShape2D" parent="World"]
position = Vector2(700, 320)
shape = SubResource("PlatformShape")
[node name="Player" parent="." instance=ExtResource("1_player")]
position = Vector2(120, 560)
[node name="Walker1" parent="." instance=ExtResource("2_walker")]
position = Vector2(450, 420)
[node name="Walker2" parent="." instance=ExtResource("2_walker")]
position = Vector2(950, 420)
[node name="FinishZone" type="Area2D" parent="."]
position = Vector2(1280, 600)
[node name="FinishShape" type="CollisionShape2D" parent="FinishZone"]
shape = SubResource("FinishShape")
[node name="PowerUp" parent="." instance=ExtResource("5_pickup")]
position = Vector2(300, 440)
pickup_data = ExtResource("6_pua")
[node name="DeathZone" type="Area2D" parent="."]
position = Vector2(0, 680)
[node name="DeathShape" type="CollisionShape2D" parent="DeathZone"]
shape = SubResource("DeathShape")
[node name="MessageLabel" type="Label" parent="."]
position = Vector2(376, 300)
size = Vector2(400, 60)
align = 1
valign = 1
text = ""
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_colors/font_shadow_color = Color(0, 0, 0, 0.9)
theme_override_constants/shadow_offset_x = 2
theme_override_constants/shadow_offset_y = 2
theme_override_font_sizes/font_size = 32
visible = false
[node name="MobileControls" parent="." instance=ExtResource("4_mobile_controls")]
+15
View File
@@ -0,0 +1,15 @@
[gd_resource type="Resource" script_class="PickupData" load_steps=3 format=3]
[ext_resource type="Script" path="res://pickups/pickup_data.gd" id="1_data"]
[ext_resource type="Texture2D" path="res://assets/pickups/amplificador_11.svg" id="2_icon"]
[resource]
script = ExtResource("1_data")
id = &"amplificador_11"
display_name = "Amplificador al 11"
description = "El 10 era para cobardes."
icon = ExtResource("2_icon")
color = Color("#f37e6d")
effect_type = "special_charge"
value = 100.0
duration = 0.0
+15
View File
@@ -0,0 +1,15 @@
[gd_resource type="Resource" script_class="PickupData" load_steps=3 format=3]
[ext_resource type="Script" path="res://pickups/pickup_data.gd" id="1_data"]
[ext_resource type="Texture2D" path="res://assets/pickups/baqueta_sismica.svg" id="2_icon"]
[resource]
script = ExtResource("1_data")
id = &"baqueta_sismica"
display_name = "Baqueta Sismica"
description = "Una prueba de sonido y desaparecio el suelo."
icon = ExtResource("2_icon")
color = Color("#eac58c")
effect_type = "air_damage_boost"
value = 0.5
duration = 10.0
+15
View File
@@ -0,0 +1,15 @@
[gd_resource type="Resource" script_class="PickupData" load_steps=3 format=3]
[ext_resource type="Script" path="res://pickups/pickup_data.gd" id="1_data"]
[ext_resource type="Texture2D" path="res://assets/pickups/beer.svg" id="2_icon"]
[resource]
script = ExtResource("1_data")
id = &"beer"
display_name = "Espuma del Pogo"
description = "Espuma garantizada. El contenido, no tanto."
icon = ExtResource("2_icon")
color = Color("#ffcd5b")
effect_type = "heal"
value = 30.0
duration = 0.0
+15
View File
@@ -0,0 +1,15 @@
[gd_resource type="Resource" script_class="PickupData" load_steps=3 format=3]
[ext_resource type="Script" path="res://pickups/pickup_data.gd" id="1_data"]
[ext_resource type="Texture2D" path="res://assets/pickups/bocata_roadie.svg" id="2_icon"]
[resource]
script = ExtResource("1_data")
id = &"bocata_roadie"
display_name = "Bocata del Roadie"
description = "Lleva tres giras en la furgoneta."
icon = ExtResource("2_icon")
color = Color("#f0ae55")
effect_type = "heal"
value = 20.0
duration = 0.0
+15
View File
@@ -0,0 +1,15 @@
[gd_resource type="Resource" script_class="PickupData" load_steps=3 format=3]
[ext_resource type="Script" path="res://pickups/pickup_data.gd" id="1_data"]
[ext_resource type="Texture2D" path="res://assets/pickups/botas_doble_bombo.svg" id="2_icon"]
[resource]
script = ExtResource("1_data")
id = &"botas_doble_bombo"
display_name = "Botas del Doble Bombo"
description = "El bateria marca el ritmo de la carrera."
icon = ExtResource("2_icon")
color = Color("#b99afa")
effect_type = "speed_boost"
value = 0.35
duration = 8.0
+15
View File
@@ -0,0 +1,15 @@
[gd_resource type="Resource" script_class="PickupData" load_steps=3 format=3]
[ext_resource type="Script" path="res://pickups/pickup_data.gd" id="1_data"]
[ext_resource type="Texture2D" path="res://assets/pickups/casete_demo.svg" id="2_icon"]
[resource]
script = ExtResource("1_data")
id = &"casete_demo"
display_name = "Casete de la Demo Perdida"
description = "Grabado en un garaje. Se nota."
icon = ExtResource("2_icon")
color = Color("#ec9fcd")
effect_type = "special_charge"
value = 25.0
duration = 0.0
+15
View File
@@ -0,0 +1,15 @@
[gd_resource type="Resource" script_class="PickupData" load_steps=3 format=3]
[ext_resource type="Script" path="res://pickups/pickup_data.gd" id="1_data"]
[ext_resource type="Texture2D" path="res://assets/pickups/cinta_americana.svg" id="2_icon"]
[resource]
script = ExtResource("1_data")
id = &"cinta_americana"
display_name = "Cinta Americana Infinita"
description = "Arregla todo, menos la afinacion."
icon = ExtResource("2_icon")
color = Color("#a1c1cc")
effect_type = "shield"
value = 1.0
duration = 0.0
+15
View File
@@ -0,0 +1,15 @@
[gd_resource type="Resource" script_class="PickupData" load_steps=3 format=3]
[ext_resource type="Script" path="res://pickups/pickup_data.gd" id="1_data"]
[ext_resource type="Texture2D" path="res://assets/pickups/coffee.svg" id="2_icon"]
[resource]
script = ExtResource("1_data")
id = &"coffee"
display_name = "Tostado del Averno"
description = "240 BPM por las venas."
icon = ExtResource("2_icon")
color = Color("#9b6243")
effect_type = "speed_boost"
value = 0.25
duration = 12.0
+15
View File
@@ -0,0 +1,15 @@
[gd_resource type="Resource" script_class="PickupData" load_steps=3 format=3]
[ext_resource type="Script" path="res://pickups/pickup_data.gd" id="1_data"]
[ext_resource type="Texture2D" path="res://assets/pickups/cuerda_titanio.svg" id="2_icon"]
[resource]
script = ExtResource("1_data")
id = &"cuerda_titanio"
display_name = "Cuerda de Titanio"
description = "No desafina. Tampoco perdona."
icon = ExtResource("2_icon")
color = Color("#e5e6fc")
effect_type = "damage_boost"
value = 0.2
duration = 20.0
+15
View File
@@ -0,0 +1,15 @@
[gd_resource type="Resource" script_class="PickupData" load_steps=3 format=3]
[ext_resource type="Script" path="res://pickups/pickup_data.gd" id="1_data"]
[ext_resource type="Texture2D" path="res://assets/pickups/lata_feedback.svg" id="2_icon"]
[resource]
script = ExtResource("1_data")
id = &"lata_feedback"
display_name = "Lata de Feedback"
description = "Hace mas ruido al abrirse que el guitarrista."
icon = ExtResource("2_icon")
color = Color("#f55b78")
effect_type = "speed_boost"
value = 0.15
duration = 20.0
+15
View File
@@ -0,0 +1,15 @@
[gd_resource type="Resource" script_class="PickupData" load_steps=3 format=3]
[ext_resource type="Script" path="res://pickups/pickup_data.gd" id="1_data"]
[ext_resource type="Texture2D" path="res://assets/pickups/muelles_stage.svg" id="2_icon"]
[resource]
script = ExtResource("1_data")
id = &"muelles_stage"
display_name = "Muelles del Stage Diving"
description = "El aterrizaje no esta incluido."
icon = ExtResource("2_icon")
color = Color("#82d8f3")
effect_type = "jump_boost"
value = 0.2
duration = 12.0
+15
View File
@@ -0,0 +1,15 @@
[gd_resource type="Resource" script_class="PickupData" load_steps=3 format=3]
[ext_resource type="Script" path="res://pickups/pickup_data.gd" id="1_data"]
[ext_resource type="Texture2D" path="res://assets/pickups/pedal_distorsion.svg" id="2_icon"]
[resource]
script = ExtResource("1_data")
id = &"pedal_distorsion"
display_name = "Pedal de Distorsion"
description = "El tecnico de sonido ha dimitido."
icon = ExtResource("2_icon")
color = Color("#76bddc")
effect_type = "damage_boost"
value = 0.5
duration = 7.0
+15
View File
@@ -0,0 +1,15 @@
[gd_resource type="Resource" script_class="PickupData" load_steps=3 format=3]
[ext_resource type="Script" path="res://pickups/pickup_data.gd" id="1_data"]
[ext_resource type="Texture2D" path="res://assets/pickups/pizza_post_bolo.svg" id="2_icon"]
[resource]
script = ExtResource("1_data")
id = &"pizza_post_bolo"
display_name = "Pizza Post-Bolo"
description = "La encontraron detras del amplificador."
icon = ExtResource("2_icon")
color = Color("#f9a047")
effect_type = "heal"
value = 45.0
duration = 0.0
+15
View File
@@ -0,0 +1,15 @@
[gd_resource type="Resource" script_class="PickupData" load_steps=3 format=3]
[ext_resource type="Script" path="res://pickups/pickup_data.gd" id="1_data"]
[ext_resource type="Texture2D" path="res://assets/pickups/pua_apocalipsis.svg" id="2_icon"]
[resource]
script = ExtResource("1_data")
id = &"pua_apocalipsis"
display_name = "Pua del Apocalipsis"
description = "Tres acordes. Cero supervivientes."
icon = ExtResource("2_icon")
color = Color("#dc78f8")
effect_type = "damage_boost"
value = 0.3
duration = 12.0
+15
View File
@@ -0,0 +1,15 @@
[gd_resource type="Resource" script_class="PickupData" load_steps=3 format=3]
[ext_resource type="Script" path="res://pickups/pickup_data.gd" id="1_data"]
[ext_resource type="Texture2D" path="res://assets/pickups/setlist_fin.svg" id="2_icon"]
[resource]
script = ExtResource("1_data")
id = &"setlist_fin"
display_name = "Setlist del Fin del Mundo"
description = "Si no queda escenario, el orden da igual."
icon = ExtResource("2_icon")
color = Color("#f1e7a3")
effect_type = "special_charge"
value = 50.0
duration = 0.0
+15
View File
@@ -0,0 +1,15 @@
[gd_resource type="Resource" script_class="PickupData" load_steps=3 format=3]
[ext_resource type="Script" path="res://pickups/pickup_data.gd" id="1_data"]
[ext_resource type="Texture2D" path="res://assets/pickups/tapones_tecnico.svg" id="2_icon"]
[resource]
script = ExtResource("1_data")
id = &"tapones_tecnico"
display_name = "Tapones del Tecnico"
description = "Por una vez, el tecnico tenia razon."
icon = ExtResource("2_icon")
color = Color("#c2eb7e")
effect_type = "damage_reduction"
value = 0.25
duration = 12.0
+15
View File
@@ -0,0 +1,15 @@
[gd_resource type="Resource" script_class="PickupData" load_steps=3 format=3]
[ext_resource type="Script" path="res://pickups/pickup_data.gd" id="1_data"]
[ext_resource type="Texture2D" path="res://assets/pickups/tupper_bateria.svg" id="2_icon"]
[resource]
script = ExtResource("1_data")
id = &"tupper_bateria"
display_name = "Tupper del Bateria"
description = "Ni su madre recuerda que le puso."
icon = ExtResource("2_icon")
color = Color("#83d0c5")
effect_type = "heal"
value = 70.0
duration = 0.0
+52
View File
@@ -0,0 +1,52 @@
extends Node
class_name DropManager
const PICKUP_SCENE := preload("res://pickups/pickup.tscn")
static func roll_drop(drop_table: PickupDropTable) -> Array[PickupData]:
var result: Array[PickupData] = []
if drop_table == null:
return result
if randf() > drop_table.drop_chance:
return result
var available: Array[PickupDrop] = drop_table.drops.duplicate()
available = available.filter(func(d): return d.pickup != null)
var count := randi_range(drop_table.min_drops, drop_table.max_drops)
if count < 0:
count = 0
if count > available.size():
count = available.size()
for i in range(count):
if available.is_empty():
break
var total_weight: float = 0.0
for d in available:
total_weight += max(d.weight, 0.0)
if total_weight <= 0.0:
break
var r := randf() * total_weight
var selected: PickupDrop = null
for d in available:
r -= max(d.weight, 0.0)
if r <= 0.0:
selected = d
break
if selected == null:
selected = available.back()
result.append(selected.pickup)
available.erase(selected)
return result
static func spawn_drops(drops_data: Array[PickupData], parent: Node, position: Vector2) -> void:
for data in drops_data:
var pickup := PICKUP_SCENE.instantiate() as Pickup
pickup.pickup_data = data
parent.add_child(pickup)
pickup.global_position = position
+57
View File
@@ -0,0 +1,57 @@
extends Area2D
class_name Pickup
signal picked_up(pickup: Pickup, data: PickupData)
@export var pickup_data: PickupData
@export var fall_speed: float = 150.0
@export var bob_amplitude: float = 4.0
@export var bob_speed: float = 3.0
var velocity: Vector2 = Vector2.ZERO
var time: float = 0.0
var start_y: float = 0.0
var grounded: bool = false
@onready var label: Label = $Label
@onready var sprite: Sprite2D = $Sprite2D
@onready var placeholder: ColorRect = $Sprite2D/ColorRect
func _ready() -> void:
add_to_group("pickup")
if pickup_data != null:
label.text = pickup_data.display_name
sprite.texture = pickup_data.icon
placeholder.visible = pickup_data.icon == null
placeholder.color = pickup_data.color
start_y = position.y
body_entered.connect(_on_body_entered)
func _physics_process(delta: float) -> void:
time += delta
if not grounded:
velocity.y += fall_speed * delta
position += velocity * delta
if is_on_floor():
grounded = true
velocity = Vector2.ZERO
start_y = position.y
else:
position.y = start_y + sin(time * bob_speed) * bob_amplitude
func is_on_floor() -> bool:
var space = get_world_2d().direct_space_state
var params = PhysicsRayQueryParameters2D.create(global_position, global_position + Vector2(0, 12))
params.collision_mask = 1
var result = space.intersect_ray(params)
return result.size() > 0
func _on_body_entered(body: Node2D) -> void:
if body.is_in_group("player") and body.has_method("collect_pickup"):
if body.collect_pickup(pickup_data):
picked_up.emit(self, pickup_data)
queue_free()
+37
View File
@@ -0,0 +1,37 @@
[gd_scene load_steps=4 format=3]
[ext_resource type="Script" path="res://pickups/pickup.gd" id="1_pickup"]
[ext_resource type="FontFile" path="res://assets/fonts/PixelOperator8.ttf" id="2_font"]
[sub_resource type="RectangleShape2D" id="PickupShape"]
size = Vector2(16, 16)
[node name="Pickup" type="Area2D"]
collision_layer = 0
collision_mask = 2
script = ExtResource("1_pickup")
[node name="Sprite2D" type="Sprite2D" parent="."]
modulate = Color(1, 1, 1, 1)
scale = Vector2(0.5, 0.5)
[node name="ColorRect" type="ColorRect" parent="Sprite2D"]
offset_left = -16.0
offset_top = -16.0
offset_right = 16.0
offset_bottom = 16.0
color = Color(1, 1, 1, 1)
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("PickupShape")
[node name="Label" type="Label" parent="."]
offset_left = -32.0
offset_top = -28.0
offset_right = 32.0
offset_bottom = -12.0
theme_override_fonts/font = ExtResource("2_font")
theme_override_font_sizes/font_size = 8
text = "Item"
horizontal_alignment = 1
vertical_alignment = 1
+18
View File
@@ -0,0 +1,18 @@
extends Resource
class_name PickupData
@export_category("Identity")
@export var id: StringName = &"pickup"
@export var display_name: String = "Item"
@export_multiline var description: String = ""
@export_category("Visuals")
@export var icon: Texture2D
@export var color: Color = Color(1.0, 0.7, 0.2)
@export_category("Effect")
## heal and special_charge are instant; shield absorbs one hit; others expire.
## value is an absolute amount for heal/charge, a fractional bonus for timed buffs.
@export_enum("heal", "speed_boost", "damage_boost", "special_charge", "shield", "damage_reduction", "jump_boost", "air_damage_boost") var effect_type: String = "heal"
@export var value: float = 0.0
@export var duration: float = 0.0
+5
View File
@@ -0,0 +1,5 @@
extends Resource
class_name PickupDrop
@export var pickup: PickupData
@export_range(0.0, 100.0, 0.1) var weight: float = 1.0
+7
View File
@@ -0,0 +1,7 @@
extends Resource
class_name PickupDropTable
@export var drops: Array[PickupDrop] = []
@export_range(0.0, 1.0) var drop_chance: float = 0.5
@export_range(0, 10, 1) var min_drops: int = 1
@export_range(0, 10, 1) var max_drops: int = 1
+2 -2
View File
@@ -6,5 +6,5 @@ extends Camera2D
func _ready() -> void: func _ready() -> void:
limit_left = 0 limit_left = 0
limit_top = 0 limit_top = 0
limit_right = 3000 limit_right = 4000
limit_bottom = 2000 limit_bottom = 2500
+2 -2
View File
@@ -20,5 +20,5 @@ class_name CharacterData
@export_range(1, 100, 1) var max_health: int = 5 @export_range(1, 100, 1) var max_health: int = 5
@export var move_speed: float = 400.0 @export var move_speed: float = 400.0
@export var jump_velocity: float = -600.0 @export var jump_velocity: float = -600.0
@export_range(0, 100, 1) var basic_attack_damage: int = 1 @export_range(0, 100, 1) var basic_attack_damage: int = 5
@export_range(0, 100, 1) var air_attack_damage: int = 3 @export_range(0, 100, 1) var air_attack_damage: int = 10
+4 -4
View File
@@ -8,8 +8,8 @@ script = ExtResource("1_data")
id = &"bassist" id = &"bassist"
display_name = "Bassist" display_name = "Bassist"
sprite_frames = ExtResource("2_frames") sprite_frames = ExtResource("2_frames")
max_health = 5 max_health = 100
move_speed = 400.0 move_speed = 390.0
jump_velocity = -600.0 jump_velocity = -600.0
basic_attack_damage = 1 basic_attack_damage = 5
air_attack_damage = 3 air_attack_damage = 10
+4 -4
View File
@@ -8,8 +8,8 @@ script = ExtResource("1_data")
id = &"drummer" id = &"drummer"
display_name = "Drummer" display_name = "Drummer"
sprite_frames = ExtResource("2_frames") sprite_frames = ExtResource("2_frames")
max_health = 5 max_health = 100
move_speed = 400.0 move_speed = 390.0
jump_velocity = -600.0 jump_velocity = -600.0
basic_attack_damage = 1 basic_attack_damage = 5
air_attack_damage = 3 air_attack_damage = 10
+4 -4
View File
@@ -8,8 +8,8 @@ script = ExtResource("1_data")
id = &"guitarist" id = &"guitarist"
display_name = "Guitarist" display_name = "Guitarist"
sprite_frames = ExtResource("2_frames") sprite_frames = ExtResource("2_frames")
max_health = 5 max_health = 100
move_speed = 400.0 move_speed = 390.0
jump_velocity = -600.0 jump_velocity = -600.0
basic_attack_damage = 1 basic_attack_damage = 5
air_attack_damage = 3 air_attack_damage = 10
@@ -1,4 +1,4 @@
[gd_resource type="SpriteFrames" load_steps=36 format=3] [gd_resource type="SpriteFrames" format=3 uid="uid://s2xmt6mpri5c"]
[ext_resource type="Texture2D" uid="uid://cjxrw1p7eh82i" path="res://assets/characters/ankarde/Diego-idle-trimmed.png" id="1_idle"] [ext_resource type="Texture2D" uid="uid://cjxrw1p7eh82i" path="res://assets/characters/ankarde/Diego-idle-trimmed.png" id="1_idle"]
[ext_resource type="Texture2D" uid="uid://dg1x17ci14p4f" path="res://assets/characters/ankarde/Diego-walk-trimmed.png" id="2_walk"] [ext_resource type="Texture2D" uid="uid://dg1x17ci14p4f" path="res://assets/characters/ankarde/Diego-walk-trimmed.png" id="2_walk"]
+4 -4
View File
@@ -8,8 +8,8 @@ script = ExtResource("1_data")
id = &"singer" id = &"singer"
display_name = "Singer" display_name = "Singer"
sprite_frames = ExtResource("2_frames") sprite_frames = ExtResource("2_frames")
max_health = 5 max_health = 100
move_speed = 400.0 move_speed = 390.0
jump_velocity = -600.0 jump_velocity = -600.0
basic_attack_damage = 1 basic_attack_damage = 5
air_attack_damage = 3 air_attack_damage = 10
+341 -29
View File
@@ -3,6 +3,7 @@ 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)
# Collision layers used by this first playable slice. # Collision layers used by this first playable slice.
@@ -33,19 +34,19 @@ const ENEMY_HURTBOX_MASK: int = 1 << 4
@export_category("Movement") @export_category("Movement")
## Reaches full running speed quickly, but not instantly. ## Reaches full running speed quickly, but not instantly.
@export var ground_acceleration: float = 3600.0 @export var ground_acceleration: float = 4000.0
## Used when there is no horizontal input. Slightly stronger than acceleration ## Used when there is no horizontal input. Slightly stronger than acceleration
## so releasing the controls feels precise instead of slippery. ## so releasing the controls feels precise instead of slippery.
@export var ground_friction: float = 4800.0 @export var ground_friction: float = 5000.0
## Braking used only when the player asks for the opposite direction. The ## Braking used only when the player asks for the opposite direction. The
## character loses the old momentum first and then accelerates the other way, ## character loses the old momentum first and then accelerates the other way,
## producing a small but readable turn delay. ## producing a small but turning is snappy enough.
@export var turn_braking: float = 5600.0 @export var turn_braking: float = 5800.0
## Air control stays responsive but weaker than movement on the floor. ## Air control stays responsive but weaker than movement on the floor.
@export var air_acceleration: float = 1800.0 @export var air_acceleration: float = 2000.0
# ============================================================================ # ============================================================================
@@ -55,17 +56,29 @@ const ENEMY_HURTBOX_MASK: int = 1 << 4
@export_category("Jump") @export_category("Jump")
## Allows a jump a few milliseconds after walking off a ledge. ## Allows a jump a few milliseconds after walking off a ledge.
@export var coyote_time: float = 0.12 @export var coyote_time: float = 0.17
## Remembers an early jump press just before landing. ## Remembers an early jump press just before landing.
@export var jump_buffer_time: float = 0.12 @export var jump_buffer_time: float = 0.17
## Releasing jump while rising cuts the jump short. ## Releasing jump while rising cuts the jump short.
@export_range(0.1, 1.0) var jump_cut_multiplier: float = 0.45 @export_range(0.1, 1.0) var jump_cut_multiplier: float = 0.43
@export var gravity_multiplier: float = 1.0 @export var gravity_multiplier: float = 1.0
@export var fall_gravity_multiplier: float = 1.7 @export var fall_gravity_multiplier: float = 1.6
@export var max_fall_speed: float = 1200.0 @export var max_fall_speed: float = 1400.0
@export_category("Double Jump")
## Enables a second jump while in the air.
@export var enable_double_jump: bool = true
## Maximum number of jumps allowed (1 = only ground/coyote, 2 = double jump).
@export_range(1, 2, 1) var max_jumps: int = 2
## Height multiplier applied to the second jump relative to the character's jump force.
@export_range(0.5, 0.95, 0.01) var double_jump_multiplier: float = 0.8
# ============================================================================ # ============================================================================
@@ -78,7 +91,7 @@ const ENEMY_HURTBOX_MASK: int = 1 << 4
@export var invulnerability_duration: float = 0.65 @export var invulnerability_duration: float = 0.65
## Horizontal and vertical impulse applied when the player is hit. ## Horizontal and vertical impulse applied when the player is hit.
@export var damage_knockback: Vector2 = Vector2(300.0, 260.0) @export var damage_knockback: Vector2 = Vector2(310.0, 270.0)
# ============================================================================ # ============================================================================
@@ -89,8 +102,8 @@ const ENEMY_HURTBOX_MASK: int = 1 << 4
@export var punch_duration: float = 0.13 @export var punch_duration: float = 0.13
@export var punch_cooldown: float = 0.28 @export var punch_cooldown: float = 0.28
@export var punch_hitbox_size: Vector2 = Vector2(55.0, 38.0) @export var punch_hitbox_size: Vector2 = Vector2(34.0, 24.0)
@export var punch_offset: Vector2 = Vector2(48.0, 0.0) @export var punch_offset: Vector2 = Vector2(30.0, 0.0)
# ============================================================================ # ============================================================================
@@ -108,8 +121,35 @@ const ENEMY_HURTBOX_MASK: int = 1 << 4
## Small amount of steering kept during the fall. ## Small amount of steering kept during the fall.
@export_range(0.0, 1.0) var ground_pound_horizontal_control: float = 0.25 @export_range(0.0, 1.0) var ground_pound_horizontal_control: float = 0.25
@export var ground_pound_radius: float = 85.0 @export var ground_pound_radius: float = 54.0
@export var ground_pound_offset: Vector2 = Vector2(0.0, 28.0) @export var ground_pound_offset: Vector2 = Vector2(0.0, 18.0)
## Damage per pixel of jump height. Higher jumps deal more damage, up to the max.
@export var ground_pound_damage_per_pixel: float = 0.03
@export_range(1, 100, 1) var ground_pound_min_damage: int = 1
@export_range(1, 100, 1) var ground_pound_max_damage: int = 10
# ============================================================================
# SPECIAL ATTACK
# ============================================================================
@export_category("Special Attack")
## Maximum charge of the special meter (0-100).
@export_range(0, 100, 1) var special_max_charge: int = 100
## Charge gained when an enemy dies.
@export_range(0, 100, 1) var special_charge_per_kill: int = 25
## Minimum charge required to use special attack.
@export_range(0, 100, 1) var special_min_use_charge: int = 25
## Maximum damage dealt by the special (at full charge, closest to player).
@export_range(0, 100, 1) var special_max_damage: int = 30
## Radius no longer used for full-screen special; kept for backwards compatibility.
@export var special_radius: float = 100000.0
# ============================================================================ # ============================================================================
@@ -156,10 +196,35 @@ var ground_pound_active: bool = false
var ground_pound_debug_timer: float = 0.0 var ground_pound_debug_timer: float = 0.0
var is_dead: bool = false var is_dead: bool = false
var jumps_remaining: int = 2
var _speed_boost_timer: float = 0.0
var _speed_boost_multiplier: float = 0.0
# Only runtime state changes: CharacterData remains immutable during pickups.
var _damage_boost_timer: float = 0.0
var _damage_boost_multiplier: float = 0.0
var _air_damage_boost_timer: float = 0.0
var _air_damage_boost_multiplier: float = 0.0
var _damage_reduction_timer: float = 0.0
var _damage_reduction_fraction: float = 0.0
var _jump_boost_timer: float = 0.0
var _jump_boost_multiplier: float = 0.0
var _shield_hits: int = 0
var _floating_texts: Array = []
# Tracks the highest point reached since leaving the ground, used to scale
# ground pound damage by jump height instead of fall distance.
var _jump_height_tracking: bool = false
var _jump_start_position: Vector2
var _jump_peak_height: float = 0.0
## Prevents one target from receiving damage every physics frame during the ## Prevents one target from receiving damage every physics frame during the
## same punch. A new punch starts with an empty set again. ## same punch. A new punch starts with an empty set again.
var punch_hit_targets: Dictionary = {} var punch_hit_targets: Dictionary = {}
var special_charge: int = 0
func _ready() -> void: func _ready() -> void:
if character_data == null: if character_data == null:
@@ -170,10 +235,16 @@ func _ready() -> void:
if character_data.sprite_frames != null: if character_data.sprite_frames != null:
animated_sprite.sprite_frames = character_data.sprite_frames animated_sprite.sprite_frames = character_data.sprite_frames
jumps_remaining = max_jumps
_setup_attack_hitboxes() _setup_attack_hitboxes()
_update_facing() _update_facing()
_update_animation() _update_animation()
health_changed.emit(current_health, character_data.max_health) health_changed.emit(current_health, character_data.max_health)
special_charge_changed.emit(special_charge, special_max_charge)
# Conecta a los enemigos que ya estén en el árbol. Si se añaden más tarde,
# se conectarán cuando mueran mediante el grupo "enemy".
_connect_to_enemies()
func _physics_process(delta: float) -> void: func _physics_process(delta: float) -> void:
@@ -189,11 +260,26 @@ func _physics_process(delta: float) -> void:
_apply_gravity(delta) _apply_gravity(delta)
_handle_horizontal_movement(delta) _handle_horizontal_movement(delta)
_update_punch_damage() _update_punch_damage()
_update_floating_texts(delta)
move_and_slide() move_and_slide()
# Track the highest point reached since leaving the ground, so ground pound
# damage is based on jump height rather than the current fall distance.
if not is_on_floor():
if not _jump_height_tracking:
_jump_height_tracking = true
_jump_start_position = global_position
_jump_peak_height = global_position.y
else:
_jump_peak_height = min(_jump_peak_height, global_position.y)
elif _jump_height_tracking:
_jump_height_tracking = false
# Landing is only reliable after move_and_slide() has resolved collisions. # Landing is only reliable after move_and_slide() has resolved collisions.
if ground_pound_active and not was_on_floor and is_on_floor(): if not was_on_floor and is_on_floor():
jumps_remaining = max_jumps
if ground_pound_active:
_ground_pound_impact() _ground_pound_impact()
_update_animation() _update_animation()
@@ -211,7 +297,10 @@ func _handle_horizontal_movement(delta: float) -> void:
facing_direction = signf(direction) facing_direction = signf(direction)
_update_facing() _update_facing()
var target_speed: float = direction * character_data.move_speed var move_speed: float = character_data.move_speed
if _speed_boost_timer > 0.0:
move_speed *= (1.0 + _speed_boost_multiplier)
var target_speed: float = direction * move_speed
if ground_pound_active: if ground_pound_active:
target_speed *= ground_pound_horizontal_control target_speed *= ground_pound_horizontal_control
@@ -274,6 +363,7 @@ func _apply_gravity(delta: float) -> void:
func _update_jump_windows(delta: float) -> void: func _update_jump_windows(delta: float) -> void:
if is_on_floor(): if is_on_floor():
coyote_timer = coyote_time coyote_timer = coyote_time
jumps_remaining = max_jumps
else: else:
coyote_timer = max(coyote_timer - delta, 0.0) coyote_timer = max(coyote_timer - delta, 0.0)
@@ -286,12 +376,17 @@ func _update_jump_windows(delta: float) -> void:
func _handle_jump() -> void: func _handle_jump() -> void:
if ( if (
jump_buffer_timer > 0.0 jump_buffer_timer > 0.0
and coyote_timer > 0.0
and not ground_pound_active and not ground_pound_active
): ):
velocity.y = character_data.jump_velocity if is_on_floor() or coyote_timer > 0.0:
velocity.y = character_data.jump_velocity * (1.0 + _jump_boost_multiplier)
jump_buffer_timer = 0.0 jump_buffer_timer = 0.0
coyote_timer = 0.0 coyote_timer = 0.0
jumps_remaining = max(0, max_jumps - 1)
elif enable_double_jump and jumps_remaining > 0:
velocity.y = character_data.jump_velocity * (1.0 + _jump_boost_multiplier) * double_jump_multiplier
jump_buffer_timer = 0.0
jumps_remaining -= 1
if Input.is_action_just_released("jump") and velocity.y < 0.0: if Input.is_action_just_released("jump") and velocity.y < 0.0:
velocity.y *= jump_cut_multiplier velocity.y *= jump_cut_multiplier
@@ -302,16 +397,20 @@ func _handle_jump() -> void:
# ============================================================================ # ============================================================================
func _handle_attack_input() -> void: func _handle_attack_input() -> void:
if not Input.is_action_just_pressed("attack"): if Input.is_action_just_pressed("attack"):
return
if attack_cooldown_timer > 0.0:
return
if is_on_floor():
_start_punch() _start_punch()
else: return
if Input.is_action_just_pressed("ground_pound"):
# The ground pound is an air attack: it only triggers while jumping or
# falling, so it never replaces a grounded punch.
if not is_on_floor():
_start_ground_pound() _start_ground_pound()
return
if Input.is_action_just_pressed("special_attack"):
_start_special_attack()
return
# ============================================================================ # ============================================================================
@@ -329,7 +428,7 @@ func _update_punch_damage() -> void:
return return
for area in punch_hitbox.get_overlapping_areas(): for area in punch_hitbox.get_overlapping_areas():
_damage_target(area, character_data.basic_attack_damage, punch_hit_targets) _damage_target(area, roundi(character_data.basic_attack_damage * (1.0 + _damage_boost_multiplier)), punch_hit_targets)
# ============================================================================ # ============================================================================
@@ -352,10 +451,166 @@ func _ground_pound_impact() -> void:
ground_pound_active = false ground_pound_active = false
ground_pound_debug_timer = debug_impact_duration ground_pound_debug_timer = debug_impact_duration
# Damage scales with jump height: how high the player rose from the takeoff
# point, clamped between the min and max damage.
var height_reached: float = _jump_start_position.y - _jump_peak_height
if height_reached < 0.0:
height_reached = 0.0
var damage: int = clamp(
int(height_reached * ground_pound_damage_per_pixel),
ground_pound_min_damage,
ground_pound_max_damage
)
var hit_targets: Dictionary = {} var hit_targets: Dictionary = {}
for area in ground_pound_hitbox.get_overlapping_areas(): for area in ground_pound_hitbox.get_overlapping_areas():
_damage_target(area, character_data.air_attack_damage, hit_targets) _damage_target(area, roundi(damage * (1.0 + _damage_boost_multiplier + _air_damage_boost_multiplier)), hit_targets)
# ============================================================================
# SPECIAL ATTACK
# ============================================================================
func _start_special_attack() -> void:
if is_dead:
return
if special_charge < special_min_use_charge:
return
var charge_used: int = special_charge
# Consume all current charge
special_charge = 0
special_charge_changed.emit(special_charge, special_max_charge)
_apply_special_attack(charge_used)
func _apply_special_attack(charge_used: int = special_max_charge) -> void:
var charge_ratio: float = clamp(float(charge_used) / float(special_max_charge), 0.0, 1.0)
var hit_targets: Dictionary = {}
# Get viewport size to scale falloff across the whole screen
var viewport: Viewport = get_viewport()
var viewport_rect: Rect2 = viewport.get_visible_rect()
var max_distance: float = max(viewport_rect.size.x, viewport_rect.size.y) * 0.8
if max_distance < 1.0:
max_distance = special_radius
for enemy in get_tree().get_nodes_in_group("enemy"):
if not is_instance_valid(enemy):
continue
if not enemy.has_method("take_damage"):
continue
var distance: float = global_position.distance_to(enemy.global_position)
# Damage falls off with distance: maximum at the player, lower farther away
# affects the whole screen (no hard circle cutoff)
var distance_factor: float = 1.0 - clamp(distance / max_distance, 0.0, 1.0)
# Ensure it still affects even if very far, just minimal
if distance_factor < 0.1:
distance_factor = 0.1
var damage: int = int(special_max_damage * charge_ratio * distance_factor)
if damage < 1:
damage = 1
var enemy_id: int = enemy.get_instance_id()
if hit_targets.has(enemy_id):
continue
hit_targets[enemy_id] = true
enemy.take_damage(damage, global_position)
func collect_pickup(data: PickupData) -> bool:
if is_dead or data == null or character_data == null:
return false
match data.effect_type:
"heal":
var heal_amount: int = mini(int(data.value), character_data.max_health - current_health)
if heal_amount <= 0:
return false
current_health += heal_amount
health_changed.emit(current_health, character_data.max_health)
_spawn_floating_text("+" + str(heal_amount), Color(0.2, 1.0, 0.3))
"speed_boost":
if data.value <= 0.0 or data.duration <= 0.0:
return false
_speed_boost_multiplier = max(_speed_boost_multiplier, data.value) if _speed_boost_timer > 0.0 else data.value
_speed_boost_timer = data.duration
_spawn_floating_text("SPEED UP", Color(1.0, 0.8, 0.2))
"damage_boost", "air_damage_boost", "damage_reduction", "jump_boost":
if data.value <= 0.0 or data.duration <= 0.0:
return false
# Repeated pickup refreshes time and keeps the strongest bonus.
match data.effect_type:
"damage_boost":
_damage_boost_multiplier = max(_damage_boost_multiplier, data.value) if _damage_boost_timer > 0.0 else data.value
_damage_boost_timer = data.duration
"air_damage_boost":
_air_damage_boost_multiplier = max(_air_damage_boost_multiplier, data.value) if _air_damage_boost_timer > 0.0 else data.value
_air_damage_boost_timer = data.duration
"damage_reduction":
_damage_reduction_fraction = max(_damage_reduction_fraction, data.value) if _damage_reduction_timer > 0.0 else data.value
_damage_reduction_timer = data.duration
"jump_boost":
_jump_boost_multiplier = max(_jump_boost_multiplier, data.value) if _jump_boost_timer > 0.0 else data.value
_jump_boost_timer = data.duration
_spawn_floating_text(data.display_name, data.color)
"special_charge":
var new_charge: int = mini(special_max_charge, special_charge + int(data.value))
if new_charge <= special_charge:
return false
special_charge = new_charge
special_charge_changed.emit(special_charge, special_max_charge)
_spawn_floating_text("SPECIAL +" + str(int(data.value)), data.color)
"shield":
if data.value <= 0.0:
return false
_shield_hits = maxi(_shield_hits, int(data.value))
_spawn_floating_text("SHIELD", data.color)
_:
push_warning("Unknown pickup effect: %s" % data.effect_type)
return false
return true
func _spawn_floating_text(text: String, color: Color) -> void:
var entry := {
"text": text,
"timer": 1.2,
"pos": Vector2(-12, -60),
"color": color,
"velocity": Vector2(0, -25)
}
_floating_texts.append(entry)
func _update_floating_texts(delta: float) -> void:
for entry in _floating_texts:
entry.pos += entry.velocity * delta
entry.timer -= delta
_floating_texts = _floating_texts.filter(func(e): return e.timer > 0.0)
func _connect_to_enemies() -> void:
for enemy in get_tree().get_nodes_in_group("enemy"):
if is_instance_valid(enemy) and enemy.has_signal(&"died"):
enemy.died.connect(_on_enemy_died.bind(enemy))
func _on_enemy_died(enemy: Node) -> void:
if is_dead:
return
special_charge = min(special_charge + special_charge_per_kill, special_max_charge)
special_charge_changed.emit(special_charge, special_max_charge)
# ============================================================================ # ============================================================================
@@ -385,6 +640,15 @@ func take_damage(amount: int, source_position: Vector2) -> void:
if amount <= 0 or is_dead or invulnerability_timer > 0.0: if amount <= 0 or is_dead or invulnerability_timer > 0.0:
return return
if _shield_hits > 0:
_shield_hits -= 1
invulnerability_timer = invulnerability_duration
_spawn_floating_text("BLOCK!", Color(0.7, 0.9, 1.0))
return
# At least one point of damage passes through an active reduction.
if _damage_reduction_timer > 0.0:
amount = maxi(1, roundi(amount * (1.0 - clampf(_damage_reduction_fraction, 0.0, 0.95))))
current_health = max(current_health - amount, 0) current_health = max(current_health - amount, 0)
invulnerability_timer = invulnerability_duration invulnerability_timer = invulnerability_duration
@@ -425,6 +689,23 @@ func _update_timers(delta: float) -> void:
attack_cooldown_timer = max(attack_cooldown_timer - delta, 0.0) attack_cooldown_timer = max(attack_cooldown_timer - delta, 0.0)
ground_pound_debug_timer = max(ground_pound_debug_timer - delta, 0.0) ground_pound_debug_timer = max(ground_pound_debug_timer - delta, 0.0)
invulnerability_timer = max(invulnerability_timer - delta, 0.0) invulnerability_timer = max(invulnerability_timer - delta, 0.0)
if _speed_boost_timer > 0.0:
_speed_boost_timer = max(_speed_boost_timer - delta, 0.0)
else:
_speed_boost_multiplier = 0.0
# Each effect expires independently; no mutation of the character resource.
_damage_boost_timer = maxf(0.0, _damage_boost_timer - delta)
_air_damage_boost_timer = maxf(0.0, _air_damage_boost_timer - delta)
_damage_reduction_timer = maxf(0.0, _damage_reduction_timer - delta)
_jump_boost_timer = maxf(0.0, _jump_boost_timer - delta)
if _damage_boost_timer == 0.0:
_damage_boost_multiplier = 0.0
if _air_damage_boost_timer == 0.0:
_air_damage_boost_multiplier = 0.0
if _damage_reduction_timer == 0.0:
_damage_reduction_fraction = 0.0
if _jump_boost_timer == 0.0:
_jump_boost_multiplier = 0.0
func _update_animation() -> void: func _update_animation() -> void:
@@ -502,6 +783,37 @@ func _draw() -> void:
2.0 2.0
) )
# Special: show full-screen effect indication. Brighter when fully charged.
var fill_alpha: float = 0.05
var outline_alpha: float = 0.25
if special_charge >= special_min_use_charge:
fill_alpha = 0.12
outline_alpha = 0.6
var viewport_rect: Rect2 = get_viewport().get_visible_rect()
var camera: Camera2D = get_viewport().get_camera_2d()
var screen_pos: Vector2 = Vector2.ZERO
if camera != null:
screen_pos = to_local(camera.get_screen_center_position())
draw_rect(
Rect2(screen_pos - viewport_rect.size * 0.5, viewport_rect.size),
Color(1.0, 0.6, 0.05, fill_alpha),
true
)
draw_rect(
Rect2(screen_pos - viewport_rect.size * 0.5, viewport_rect.size),
Color(1.0, 0.6, 0.05, outline_alpha),
false,
2.0
)
var font: Font = ThemeDB.get_default_theme().get_font("font", "Label")
if font != null:
for entry in _floating_texts:
var alpha: float = clamp(entry.timer / 1.2, 0.0, 1.0)
var col = entry.color
col.a = alpha
draw_string(font, entry.pos, entry.text, 0, -1, 14, col)
func _draw_rectangle_collision( func _draw_rectangle_collision(
collision: CollisionShape2D, collision: CollisionShape2D,
+18 -22
View File
@@ -1,61 +1,57 @@
[gd_scene load_steps=7 format=3 uid="uid://nwbjxttgghpq"] [gd_scene format=3 uid="uid://nwbjxttgghpq"]
[ext_resource type="Script" uid="uid://dccfebno1gvh7" path="res://player/player.gd" id="1_player"] [ext_resource type="Script" uid="uid://dccfebno1gvh7" path="res://player/player.gd" id="1_player"]
[ext_resource type="SpriteFrames" path="res://player/characters/shared/prototype_sprite_frames.tres" id="2_frames"] [ext_resource type="SpriteFrames" uid="uid://s2xmt6mpri5c" path="res://player/characters/shared/prototype_sprite_frames.tres" id="2_frames"]
[ext_resource type="Script" uid="uid://kg3i7b0dj2p8" path="res://player/camera_2d.gd" id="3_camera"] [ext_resource type="Script" uid="uid://kg3i7b0dj2p8" path="res://player/camera_2d.gd" id="3_camera"]
[ext_resource type="Resource" path="res://player/characters/singer.tres" id="4_character"] [ext_resource type="Resource" path="res://player/characters/singer.tres" id="4_character"]
[ext_resource type="PackedScene" path="res://ui/hud/player_health_hud.tscn" id="5_health_hud"] [ext_resource type="PackedScene" path="res://ui/hud/player_health_hud.tscn" id="5_health_hud"]
[ext_resource type="PackedScene" path="res://ui/hud/special_charge_hud.tscn" id="6_special_charge_hud"]
[sub_resource type="RectangleShape2D" id="PlayerShape"] [sub_resource type="RectangleShape2D" id="PlayerShape"]
size = Vector2(65, 115) size = Vector2(41, 74)
[node name="Player" type="CharacterBody2D" groups=["player"]] [node name="Player" type="CharacterBody2D" unique_id=730885194 groups=["player"]]
z_index = 1 z_index = 1
collision_layer = 2 collision_layer = 2
collision_mask = 1
script = ExtResource("1_player") script = ExtResource("1_player")
character_data = ExtResource("4_character") character_data = ExtResource("4_character")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=589859800]
position = Vector2(0.5, 5.5)
shape = SubResource("PlayerShape") shape = SubResource("PlayerShape")
[node name="Hurtbox" type="Area2D" parent="."] [node name="Hurtbox" type="Area2D" parent="." unique_id=542287926]
collision_layer = 8 collision_layer = 8
collision_mask = 0 collision_mask = 0
monitoring = false monitoring = false
monitorable = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hurtbox"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Hurtbox" unique_id=813209683]
position = Vector2(0.5, 5.5)
shape = SubResource("PlayerShape") shape = SubResource("PlayerShape")
[node name="PunchHitbox" type="Area2D" parent="."] [node name="PunchHitbox" type="Area2D" parent="." unique_id=184501519]
collision_layer = 0 collision_layer = 0
collision_mask = 16 collision_mask = 16
monitoring = true
monitorable = false monitorable = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="PunchHitbox"] [node name="CollisionShape2D" type="CollisionShape2D" parent="PunchHitbox" unique_id=126348432]
[node name="GroundPoundHitbox" type="Area2D" parent="."] [node name="GroundPoundHitbox" type="Area2D" parent="." unique_id=1822904824]
collision_layer = 0 collision_layer = 0
collision_mask = 16 collision_mask = 16
monitoring = true
monitorable = false monitorable = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="GroundPoundHitbox"] [node name="CollisionShape2D" type="CollisionShape2D" parent="GroundPoundHitbox" unique_id=2120510285]
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=1502470275]
z_index = -1 z_index = -1
scale = Vector2(0.80251265, 0.8025128) scale = Vector2(0.56, 0.56)
sprite_frames = ExtResource("2_frames") sprite_frames = ExtResource("2_frames")
animation = &"idle" animation = &"idle"
speed_scale = 2.0 speed_scale = 2.0
[node name="Camera2D" type="Camera2D" parent="."] [node name="Camera2D" type="Camera2D" parent="." unique_id=902833396]
scale = Vector2(0.5, 0.5)
zoom = Vector2(2, 2) zoom = Vector2(2, 2)
script = ExtResource("3_camera") script = ExtResource("3_camera")
[node name="PlayerHealthHUD" parent="." instance=ExtResource("5_health_hud")] [node name="PlayerHealthHUD" parent="." unique_id=660684564 instance=ExtResource("5_health_hud")]
[node name="SpecialChargeHUD" parent="." unique_id=1505444607 instance=ExtResource("6_special_charge_hud")]
+12 -5
View File
@@ -11,15 +11,12 @@ config_version=5
[application] [application]
config/name="Mortal Maze: The Game" config/name="Mortal Maze: The Game"
run/main_scene="res://game/main.tscn" run/main_scene="res://levels/level_01.tscn"
config/features=PackedStringArray("4.7", "GL Compatibility") config/features=PackedStringArray("4.7", "GL Compatibility")
config/icon="res://icon.svg" config/icon="res://icon.svg"
[display] [display]
window/size/viewport_width=1152
window/size/viewport_height=648
window/handheld/orientation=0
window/stretch/mode="canvas_items" window/stretch/mode="canvas_items"
window/stretch/aspect="expand" window/stretch/aspect="expand"
@@ -50,6 +47,16 @@ attack={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":74,"key_label":0,"unicode":106,"location":0,"echo":false,"script":null) "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":74,"key_label":0,"unicode":106,"location":0,"echo":false,"script":null)
] ]
} }
ground_pound={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":75,"physical_keycode":75,"key_label":0,"unicode":107,"location":0,"echo":false,"script":null)
]
}
special_attack={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":76,"physical_keycode":76,"key_label":0,"unicode":108,"location":0,"echo":false,"script":null)
]
}
[layer_names] [layer_names]
@@ -65,7 +72,7 @@ attack={
[rendering] [rendering]
textures/vram_compression/import_etc2_astc=true
rendering_device/driver.windows="d3d12" rendering_device/driver.windows="d3d12"
renderer/rendering_method="gl_compatibility" renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility" renderer/rendering_method.mobile="gl_compatibility"
textures/vram_compression/import_etc2_astc=true
+19
View File
@@ -10,10 +10,14 @@ 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
var player_ref: Node
func _ready() -> void: func _ready() -> void:
var player: Node = get_parent() var player: Node = get_parent()
player_ref = player
if player == null or not player.has_signal(&"health_changed"): if player == null or not player.has_signal(&"health_changed"):
push_error("PlayerHealthHUD must be a child of a Player with health_changed signal.") push_error("PlayerHealthHUD must be a child of a Player with health_changed signal.")
return return
@@ -21,6 +25,21 @@ func _ready() -> void:
# Child _ready() runs before Player._ready(). We connect here first and the # Child _ready() runs before Player._ready(). We connect here first and the
# Player will emit its initial health value a moment later during its _ready(). # Player will emit its initial health value a moment later during its _ready().
player.connect(&"health_changed", _on_health_changed) player.connect(&"health_changed", _on_health_changed)
if speed_label:
speed_label.visible = false
func _process(_delta: float) -> void:
if player_ref == null or speed_label == null:
return
if "get" in player_ref and player_ref.has_method("get"):
pass
var t = player_ref.get("_speed_boost_timer")
if t != null and float(t) > 0.0:
speed_label.visible = true
speed_label.text = "SPEED UP: %ds" % int(float(t))
else:
speed_label.visible = false
func _on_health_changed(current_health: int, max_health: int) -> void: func _on_health_changed(current_health: int, max_health: int) -> void:
+14
View File
@@ -63,3 +63,17 @@ theme_override_font_sizes/font_size = 18
text = "HP 5 / 5" text = "HP 5 / 5"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1 vertical_alignment = 1
[node name="SpeedLabel" type="Label" parent="HUD"]
layout_mode = 0
offset_left = 18.0
offset_top = 70.0
offset_right = 278.0
offset_bottom = 98.0
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_font_sizes/font_size = 16
text = "SPEED UP: 0s"
horizontal_alignment = 1
vertical_alignment = 1
visible = false
+28
View File
@@ -0,0 +1,28 @@
extends CanvasLayer
## Minimal HUD showing the player's special attack charge.
##
## Expects to be a child of a Player that exposes a `special_charge_changed`
## signal, just like PlayerHealthHUD expects `health_changed`.
@onready var special_bar: ProgressBar = $HUD/SpecialBar
@onready var special_label: Label = $HUD/SpecialBar/SpecialLabel
func _ready() -> void:
var player: Node = get_parent()
if player == null or not player.has_signal(&"special_charge_changed"):
push_error("SpecialChargeHUD must be a child of a Player with special_charge_changed signal.")
return
# Child _ready() runs before Player._ready(). We connect here first and the
# Player will emit its initial charge a moment later during its _ready().
player.connect(&"special_charge_changed", _on_special_charge_changed)
func _on_special_charge_changed(current_charge: int, max_charge: int) -> void:
special_bar.max_value = float(max_charge)
special_bar.value = float(current_charge)
special_label.text = "SPECIAL %d%%" % [current_charge]
+37
View File
@@ -0,0 +1,37 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://ui/hud/special_charge_hud.gd" id="1_hud"]
[node name="SpecialChargeHUD" type="CanvasLayer"]
layer = 95
script = ExtResource("1_hud")
[node name="HUD" type="Control" parent="."]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
mouse_filter = 2
[node name="SpecialBar" type="ProgressBar" parent="HUD"]
offset_left = 18.0
offset_top = 44.0
offset_right = 220.0
offset_bottom = 64.0
max_value = 100.0
value = 0.0
show_percentage = false
[node name="SpecialLabel" type="Label" parent="HUD/SpecialBar"]
layout_mode = 1
anchors_preset = 15
offset_left = 4.0
offset_top = 2.0
text = "SPECIAL"
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_colors/font_shadow_color = Color(0, 0, 0, 0.9)
theme_override_constants/shadow_offset_x = 1
theme_override_constants/shadow_offset_y = 1
theme_override_font_sizes/font_size = 14
horizontal_alignment = 1
vertical_alignment = 1
+6
View File
@@ -18,6 +18,8 @@ extends CanvasLayer
@onready var move_right_button: Button = $Controls/MoveRight @onready var move_right_button: Button = $Controls/MoveRight
@onready var jump_button: Button = $Controls/Jump @onready var jump_button: Button = $Controls/Jump
@onready var attack_button: Button = $Controls/Attack @onready var attack_button: Button = $Controls/Attack
@onready var ground_pound_button: Button = $Controls/GroundPound
@onready var special_attack_button: Button = $Controls/SpecialAttack
var direction_touch_index: int = -1 var direction_touch_index: int = -1
@@ -25,6 +27,8 @@ var direction_touch_index: int = -1
func _ready() -> void: func _ready() -> void:
_bind_button(jump_button, &"jump") _bind_button(jump_button, &"jump")
_bind_button(attack_button, &"attack") _bind_button(attack_button, &"attack")
_bind_button(ground_pound_button, &"ground_pound")
_bind_button(special_attack_button, &"special_attack")
func _input(event: InputEvent) -> void: func _input(event: InputEvent) -> void:
@@ -53,6 +57,8 @@ func _exit_tree() -> void:
Input.action_release(&"move_right") Input.action_release(&"move_right")
Input.action_release(&"jump") Input.action_release(&"jump")
Input.action_release(&"attack") Input.action_release(&"attack")
Input.action_release(&"ground_pound")
Input.action_release(&"special_attack")
func _direction_at(position: Vector2) -> StringName: func _direction_at(position: Vector2) -> StringName:
+84 -38
View File
@@ -1,10 +1,10 @@
[gd_scene load_steps=8 format=3] [gd_scene format=3 uid="uid://g7h185yageqr"]
[ext_resource type="Script" path="res://ui/mobile_controls/mobile_controls.gd" id="1_controls"] [ext_resource type="Script" uid="uid://2kbajcohyem7" path="res://ui/mobile_controls/mobile_controls.gd" id="1_controls"]
[ext_resource type="Texture2D" path="res://assets/ui/mobile_controls/left-arrow.png" id="2_left"] [ext_resource type="Texture2D" uid="uid://cj6wl2l43nao2" path="res://assets/ui/mobile_controls/left-arrow.png" id="2_left"]
[ext_resource type="Texture2D" path="res://assets/ui/mobile_controls/right-arrow.png" id="3_right"] [ext_resource type="Texture2D" uid="uid://y0tsuhk4moj3" path="res://assets/ui/mobile_controls/right-arrow.png" id="3_right"]
[ext_resource type="Texture2D" path="res://assets/ui/mobile_controls/top-arrow.png" id="4_jump"] [ext_resource type="Texture2D" uid="uid://b832qiumqbdwc" path="res://assets/ui/mobile_controls/top-arrow.png" id="4_jump"]
[ext_resource type="Texture2D" path="res://assets/ui/mobile_controls/attack.png" id="5_attack"] [ext_resource type="Texture2D" uid="uid://byb0xo2xlcj4f" path="res://assets/ui/mobile_controls/attack.png" id="5_attack"]
[sub_resource type="StyleBoxFlat" id="ButtonNormal"] [sub_resource type="StyleBoxFlat" id="ButtonNormal"]
bg_color = Color(0.65, 0.04, 0.04, 0.28) bg_color = Color(0.65, 0.04, 0.04, 0.28)
@@ -30,11 +30,11 @@ corner_radius_top_right = 14
corner_radius_bottom_right = 14 corner_radius_bottom_right = 14
corner_radius_bottom_left = 14 corner_radius_bottom_left = 14
[node name="MobileControls" type="CanvasLayer"] [node name="MobileControls" type="CanvasLayer" unique_id=478431491]
layer = 100 layer = 100
script = ExtResource("1_controls") script = ExtResource("1_controls")
[node name="Controls" type="Control" parent="."] [node name="Controls" type="Control" parent="." unique_id=1754744981]
layout_mode = 3 layout_mode = 3
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
@@ -43,92 +43,138 @@ grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
mouse_filter = 2 mouse_filter = 2
[node name="MoveLeft" type="Button" parent="Controls"] [node name="MoveLeft" type="Button" parent="Controls" unique_id=981068385]
layout_mode = 0 layout_mode = 1
anchors_preset = 2
anchor_top = 1.0 anchor_top = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
offset_left = 34.0 offset_left = 50.0
offset_top = -132.0 offset_top = -170.0
offset_right = 134.0 offset_right = 188.0
offset_bottom = -32.0 offset_bottom = -32.0
grow_vertical = 0 grow_vertical = 0
focus_mode = 0 focus_mode = 0
keep_pressed_outside = true
theme_override_colors/font_color = Color(1, 1, 1, 0.95) theme_override_colors/font_color = Color(1, 1, 1, 0.95)
theme_override_colors/font_pressed_color = Color(1, 1, 1, 1) theme_override_colors/font_pressed_color = Color(1, 1, 1, 1)
theme_override_font_sizes/font_size = 42 theme_override_font_sizes/font_size = 42
theme_override_styles/normal = SubResource("ButtonNormal") theme_override_styles/normal = SubResource("ButtonNormal")
theme_override_styles/hover = SubResource("ButtonNormal")
theme_override_styles/pressed = SubResource("ButtonPressed") theme_override_styles/pressed = SubResource("ButtonPressed")
theme_override_styles/hover = SubResource("ButtonNormal")
keep_pressed_outside = true
icon = ExtResource("2_left") icon = ExtResource("2_left")
expand_icon = true expand_icon = true
icon_max_width = 48
[node name="MoveRight" type="Button" parent="Controls"] [node name="MoveRight" type="Button" parent="Controls" unique_id=561780368]
layout_mode = 0 layout_mode = 1
anchors_preset = 2
anchor_top = 1.0 anchor_top = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
offset_left = 150.0 offset_left = 208.0
offset_top = -132.0 offset_top = -170.0
offset_right = 250.0 offset_right = 346.0
offset_bottom = -32.0 offset_bottom = -32.0
grow_vertical = 0 grow_vertical = 0
focus_mode = 0 focus_mode = 0
keep_pressed_outside = true
theme_override_colors/font_color = Color(1, 1, 1, 0.95) theme_override_colors/font_color = Color(1, 1, 1, 0.95)
theme_override_colors/font_pressed_color = Color(1, 1, 1, 1) theme_override_colors/font_pressed_color = Color(1, 1, 1, 1)
theme_override_font_sizes/font_size = 42 theme_override_font_sizes/font_size = 42
theme_override_styles/normal = SubResource("ButtonNormal") theme_override_styles/normal = SubResource("ButtonNormal")
theme_override_styles/hover = SubResource("ButtonNormal")
theme_override_styles/pressed = SubResource("ButtonPressed") theme_override_styles/pressed = SubResource("ButtonPressed")
theme_override_styles/hover = SubResource("ButtonNormal")
keep_pressed_outside = true
icon = ExtResource("3_right") icon = ExtResource("3_right")
expand_icon = true expand_icon = true
icon_max_width = 48
[node name="Jump" type="Button" parent="Controls"] [node name="Jump" type="Button" parent="Controls" unique_id=1396737393]
layout_mode = 0 layout_mode = 1
anchors_preset = 3
anchor_left = 1.0 anchor_left = 1.0
anchor_top = 1.0 anchor_top = 1.0
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
offset_left = -264.0 offset_left = -280.0
offset_top = -132.0 offset_top = -132.0
offset_right = -154.0 offset_right = -170.0
offset_bottom = -32.0 offset_bottom = -32.0
grow_horizontal = 0 grow_horizontal = 0
grow_vertical = 0 grow_vertical = 0
focus_mode = 0 focus_mode = 0
keep_pressed_outside = true
theme_override_colors/font_color = Color(1, 1, 1, 0.95) theme_override_colors/font_color = Color(1, 1, 1, 0.95)
theme_override_colors/font_pressed_color = Color(1, 1, 1, 1) theme_override_colors/font_pressed_color = Color(1, 1, 1, 1)
theme_override_font_sizes/font_size = 22 theme_override_font_sizes/font_size = 22
theme_override_styles/normal = SubResource("ButtonNormal") theme_override_styles/normal = SubResource("ButtonNormal")
theme_override_styles/hover = SubResource("ButtonNormal")
theme_override_styles/pressed = SubResource("ButtonPressed") theme_override_styles/pressed = SubResource("ButtonPressed")
theme_override_styles/hover = SubResource("ButtonNormal")
keep_pressed_outside = true
icon = ExtResource("4_jump") icon = ExtResource("4_jump")
expand_icon = true expand_icon = true
icon_max_width = 48
[node name="Attack" type="Button" parent="Controls"] [node name="Attack" type="Button" parent="Controls" unique_id=514469811]
layout_mode = 0 layout_mode = 1
anchors_preset = 3
anchor_left = 1.0 anchor_left = 1.0
anchor_top = 1.0 anchor_top = 1.0
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
offset_left = -138.0 offset_left = -154.0
offset_top = -132.0 offset_top = -132.0
offset_right = -28.0 offset_right = -44.0
offset_bottom = -32.0 offset_bottom = -32.0
grow_horizontal = 0 grow_horizontal = 0
grow_vertical = 0 grow_vertical = 0
focus_mode = 0 focus_mode = 0
keep_pressed_outside = true
theme_override_colors/font_color = Color(1, 1, 1, 0.95) theme_override_colors/font_color = Color(1, 1, 1, 0.95)
theme_override_colors/font_pressed_color = Color(1, 1, 1, 1) theme_override_colors/font_pressed_color = Color(1, 1, 1, 1)
theme_override_font_sizes/font_size = 22 theme_override_font_sizes/font_size = 22
theme_override_styles/normal = SubResource("ButtonNormal") theme_override_styles/normal = SubResource("ButtonNormal")
theme_override_styles/hover = SubResource("ButtonNormal")
theme_override_styles/pressed = SubResource("ButtonPressed") theme_override_styles/pressed = SubResource("ButtonPressed")
theme_override_styles/hover = SubResource("ButtonNormal")
keep_pressed_outside = true
icon = ExtResource("5_attack") icon = ExtResource("5_attack")
expand_icon = true expand_icon = true
icon_max_width = 48
[node name="GroundPound" type="Button" parent="Controls" unique_id=655126227]
layout_mode = 1
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -280.0
offset_top = -256.0
offset_right = -170.0
offset_bottom = -156.0
grow_horizontal = 0
grow_vertical = 0
focus_mode = 0
theme_override_colors/font_color = Color(1, 1, 1, 0.95)
theme_override_colors/font_pressed_color = Color(1, 1, 1, 1)
theme_override_font_sizes/font_size = 18
theme_override_styles/normal = SubResource("ButtonNormal")
theme_override_styles/pressed = SubResource("ButtonPressed")
theme_override_styles/hover = SubResource("ButtonNormal")
keep_pressed_outside = true
text = "GP"
[node name="SpecialAttack" type="Button" parent="Controls" unique_id=2065869646]
layout_mode = 1
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -154.0
offset_top = -256.0
offset_right = -44.0
offset_bottom = -156.0
grow_horizontal = 0
grow_vertical = 0
focus_mode = 0
theme_override_colors/font_color = Color(1, 1, 1, 0.95)
theme_override_colors/font_pressed_color = Color(1, 1, 1, 1)
theme_override_font_sizes/font_size = 18
theme_override_styles/normal = SubResource("ButtonNormal")
theme_override_styles/pressed = SubResource("ButtonPressed")
theme_override_styles/hover = SubResource("ButtonNormal")
keep_pressed_outside = true
text = "SP"