mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 17:23:44 +00:00
feat(goals): add cinematic celebration sequence
This commit is contained in:
@@ -19,6 +19,9 @@ class_name HUDController
|
||||
@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 goal_celebration = get_node_or_null("Control/GoalCelebration")
|
||||
@onready var goal_tint = get_node_or_null("Control/GoalCelebration/Tint")
|
||||
@onready var goal_title = get_node_or_null("Control/GoalCelebration/Center/GoalTitle")
|
||||
|
||||
@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")
|
||||
@@ -30,6 +33,7 @@ class_name HUDController
|
||||
var ship: Node
|
||||
var _last_score := {0: 0, 1: 0}
|
||||
var _impact_flash_tween: Tween
|
||||
var _goal_tween: Tween
|
||||
|
||||
func _ready():
|
||||
# Wait one frame to ensure ship is ready and added to group
|
||||
@@ -184,6 +188,39 @@ func flash_impact(intensity: float) -> void:
|
||||
_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 show_goal_celebration(scoring_team: int) -> void:
|
||||
if not goal_celebration or not goal_title or not goal_tint:
|
||||
return
|
||||
if _goal_tween and _goal_tween.is_valid():
|
||||
_goal_tween.kill()
|
||||
var tint: Color = TeamColors.TEAM_COLORS[scoring_team]
|
||||
goal_tint.color = Color(tint.r, tint.g, tint.b, 0.34)
|
||||
goal_title.text = "%s GOAL!" % TeamColors.TEAM_NAMES[scoring_team].to_upper()
|
||||
goal_title.add_theme_color_override("font_color", tint.lightened(0.35))
|
||||
goal_title.scale = Vector2(0.55, 0.55)
|
||||
goal_title.modulate.a = 0.0
|
||||
goal_celebration.visible = true
|
||||
await get_tree().process_frame
|
||||
if not is_instance_valid(goal_title):
|
||||
return
|
||||
goal_title.pivot_offset = goal_title.size / 2.0
|
||||
_goal_tween = create_tween().set_parallel(true).set_ignore_time_scale(true)
|
||||
_goal_tween.tween_property(goal_title, "scale", Vector2.ONE, 0.32).set_trans(Tween.TRANS_BACK).set_ease(Tween.EASE_OUT)
|
||||
_goal_tween.tween_property(goal_title, "modulate:a", 1.0, 0.16)
|
||||
_goal_tween.tween_property(goal_tint, "color:a", 0.12, 0.7).set_delay(0.12)
|
||||
|
||||
|
||||
func hide_goal_celebration() -> void:
|
||||
if not goal_celebration or not is_instance_valid(goal_celebration):
|
||||
return
|
||||
if _goal_tween and _goal_tween.is_valid():
|
||||
_goal_tween.kill()
|
||||
_goal_tween = create_tween().set_parallel(true).set_ignore_time_scale(true)
|
||||
_goal_tween.tween_property(goal_title, "modulate:a", 0.0, 0.16)
|
||||
_goal_tween.tween_property(goal_tint, "color:a", 0.0, 0.2)
|
||||
_goal_tween.chain().tween_callback(func(): goal_celebration.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