♻️REFACTOR: Mejoras en la viabilidad para desarrollo
This commit is contained in:
1 parent
5aba6c7b47
commit
fd0118d964
98 files changed
+5985
-3024
No files matched your search
+8
-7
@@ -1,6 +1,6 @@
|
||||
extends Camera2D
|
||||
|
||||
## Set to zero to disable camera shake and screen overlays.
|
||||
## Cero desactiva sacudidas y superposiciones. Los limites se configuran en la escena o en LevelRoot.
|
||||
@export_range(0.0, 1.0, 0.05) var feedback_strength: float = 1.0
|
||||
|
||||
var _base_offset: Vector2
|
||||
@@ -13,14 +13,11 @@ var _flash_color := Color(1.0, 0.82, 0.50)
|
||||
var _overlay: Control
|
||||
|
||||
|
||||
## Prepara la capa visual de feedback; no sobrescribe los limites de la camara.
|
||||
func _ready() -> void:
|
||||
limit_left = 0
|
||||
limit_top = 0
|
||||
limit_right = 4000
|
||||
limit_bottom = 2500
|
||||
_base_offset = offset
|
||||
|
||||
# Below the existing HUDs. This Control never intercepts touch controls.
|
||||
# Capa inferior a los HUD. Este Control nunca intercepta los controles tactiles.
|
||||
var layer := CanvasLayer.new()
|
||||
layer.name = "CombatFeedback"
|
||||
layer.layer = 80
|
||||
@@ -32,6 +29,7 @@ func _ready() -> void:
|
||||
_overlay.draw.connect(_draw_feedback)
|
||||
|
||||
|
||||
## Acumula la sacudida mas intensa sin reiniciar a menor fuerza un impacto existente.
|
||||
func impact(strength: float = 1.5, duration: float = 0.16,
|
||||
color: Color = Color(1.0, 0.82, 0.50)) -> void:
|
||||
_shake_amplitude = maxf(_shake_amplitude, strength)
|
||||
@@ -40,10 +38,12 @@ func impact(strength: float = 1.5, duration: float = 0.16,
|
||||
_flash_color = color
|
||||
|
||||
|
||||
## Activa la superposicion del especial durante el tiempo solicitado.
|
||||
func start_solo(duration: float) -> void:
|
||||
_solo_remaining = duration
|
||||
|
||||
|
||||
## Amortigua las sacudidas alrededor del desplazamiento inicial de la camara.
|
||||
func _process(delta: float) -> void:
|
||||
_clock += delta
|
||||
_shake_remaining = maxf(0.0, _shake_remaining - delta)
|
||||
@@ -56,12 +56,13 @@ func _process(delta: float) -> void:
|
||||
_overlay.queue_redraw()
|
||||
|
||||
|
||||
## Dibuja bordes y notas visuales sin afectar a entradas ni colisiones.
|
||||
func _draw_feedback() -> void:
|
||||
if feedback_strength <= 0.0:
|
||||
return
|
||||
var size: Vector2 = get_viewport_rect().size
|
||||
var pulse: float = (_shake_remaining / _shake_duration) * feedback_strength
|
||||
# Subtle edge flashes, not full-white flashes or a strobing screen.
|
||||
# Destellos suaves en los bordes, sin flashes blancos a pantalla completa.
|
||||
if pulse > 0.0:
|
||||
var color: Color = _flash_color
|
||||
color.a = pulse * 0.14
|
||||
|
||||
Reference in new issue
Block a user