mirror of
https://github.com/kodzukye/scrap-signal.git
synced 2026-04-26 19:17:35 +00:00
- Add AudioManager autoload with music and sfx players - Add ambiance tracks for entrepot, atelier and cour zones - Add SFX for footstep, item_pickup, interact, door_unlock, repair_success, vrac_talking, iris_talking - Add crossfade transition between ambiance zones - Add loop via finished signal on music_player - Set ambiance volume to -12dB to balance with SFX - Set PROCESS_MODE_ALWAYS to prevent audio cut during dialogues - Add stop_ambiance() call on main_menu to reset music after credits
42 lines
1.2 KiB
GDScript
42 lines
1.2 KiB
GDScript
extends Control
|
|
|
|
@onready var press_label := $CenterContainer/VBoxContainer/PressLabel
|
|
@onready var fade_rect := $FadeRect
|
|
|
|
var _can_start := false
|
|
|
|
func _ready() -> void:
|
|
AudioManager.stop_ambiance()
|
|
modulate.a = 1.0
|
|
fade_rect.color = Color(0, 0, 0, 1)
|
|
fade_rect.modulate = Color(1, 1, 1, 1)
|
|
fade_rect.modulate.a = 1.0
|
|
fade_rect.modulate.a = 1.0
|
|
var tween := create_tween()
|
|
tween.tween_property(fade_rect, "modulate:a", 0.0, 1.2)
|
|
tween.tween_callback(func(): _can_start = true)
|
|
_blink_prompt()
|
|
|
|
func _blink_prompt() -> void:
|
|
var tween := create_tween().set_loops()
|
|
tween.tween_property(press_label, "modulate:a", 0.0, 0.6)
|
|
tween.tween_interval(0.1)
|
|
tween.tween_property(press_label, "modulate:a", 1.0, 0.6)
|
|
tween.tween_interval(0.2)
|
|
|
|
func _unhandled_input(event: InputEvent) -> void:
|
|
if not _can_start:
|
|
return
|
|
if event is InputEventKey and event.pressed and not event.echo:
|
|
_go_to_intro()
|
|
if event is InputEventJoypadButton and event.pressed:
|
|
_go_to_intro()
|
|
|
|
func _go_to_intro() -> void:
|
|
_can_start = false
|
|
var tween := create_tween()
|
|
tween.tween_property(fade_rect, "modulate:a", 1.0, 0.8)
|
|
tween.tween_callback(func():
|
|
get_tree().change_scene_to_file("res://levels/intro.tscn")
|
|
)
|