mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 00:14:00 +00:00
feat(feedback): add responsive camera and impacts
This commit is contained in:
@@ -18,6 +18,7 @@ class_name HUDController
|
||||
@onready var result_panel = get_node_or_null("Control/ResultOverlay/Center/ResultPanel")
|
||||
@onready var result_label = get_node_or_null("Control/ResultOverlay/Center/ResultPanel/VBox/ResultLabel")
|
||||
@onready var final_score_label = get_node_or_null("Control/ResultOverlay/Center/ResultPanel/VBox/FinalScoreLabel")
|
||||
@onready var impact_flash = get_node_or_null("Control/ImpactFlash")
|
||||
|
||||
@onready var heading_tape: HudHeadingTape = get_node_or_null("Control/Instruments/HeadingTape")
|
||||
@onready var attitude_indicator: HudAttitudeIndicator = get_node_or_null("Control/Instruments/Cluster/Dials/AttitudeIndicator")
|
||||
@@ -28,6 +29,7 @@ class_name HUDController
|
||||
|
||||
var ship: Node
|
||||
var _last_score := {0: 0, 1: 0}
|
||||
var _impact_flash_tween: Tween
|
||||
|
||||
func _ready():
|
||||
# Wait one frame to ensure ship is ready and added to group
|
||||
@@ -170,6 +172,18 @@ func _flash_score_label(label: Label) -> void:
|
||||
tween.tween_property(label, "scale", Vector2(1.4, 1.4), 0.1)
|
||||
tween.tween_property(label, "scale", Vector2(1.0, 1.0), 0.2)
|
||||
|
||||
|
||||
func flash_impact(intensity: float) -> void:
|
||||
if not impact_flash or not is_instance_valid(impact_flash):
|
||||
return
|
||||
if _impact_flash_tween and _impact_flash_tween.is_valid():
|
||||
_impact_flash_tween.kill()
|
||||
impact_flash.color = Color(0.72, 0.9, 1.0, lerpf(0.06, 0.24, intensity))
|
||||
impact_flash.visible = true
|
||||
_impact_flash_tween = create_tween()
|
||||
_impact_flash_tween.tween_property(impact_flash, "color:a", 0.0, lerpf(0.08, 0.18, intensity))
|
||||
_impact_flash_tween.tween_callback(func(): impact_flash.visible = false)
|
||||
|
||||
func _on_overtime_started():
|
||||
if timer_label and is_instance_valid(timer_label):
|
||||
timer_label.text = "OT"
|
||||
|
||||
Reference in New Issue
Block a user