2024-10-03 21:12:20 +02:00
|
|
|
extends TextureRect
|
|
|
|
|
2024-10-08 20:53:45 +02:00
|
|
|
var audio_bus_music = 1
|
|
|
|
var audio_bus_sounds = 2
|
|
|
|
var sound_button_on_of = {true:preload("res://assets/GUI/sound button.png"),false:preload("res://assets/GUI/sound button off.png")}
|
2024-11-04 19:10:10 +01:00
|
|
|
var sound_button_on_of_f = {true:preload("res://assets/GUI/buttons fucused/sound button f.png"),false:preload("res://assets/GUI/buttons fucused/sound button off f.png")}
|
2024-10-03 21:12:20 +02:00
|
|
|
|
2024-11-10 19:51:00 +01:00
|
|
|
|
2024-10-03 21:12:20 +02:00
|
|
|
func _ready() -> void:
|
2024-10-08 20:53:45 +02:00
|
|
|
#$"../../Audio/Duckrun".volume_db = linear_to_db(20*0.01)
|
2024-10-03 21:12:20 +02:00
|
|
|
$AnimationPlayer.play_backwards("out-in")
|
|
|
|
hide()
|
|
|
|
|
|
|
|
func _process(_delta: float) -> void:
|
|
|
|
global_position.x = get_viewport().get_visible_rect().size.x -100
|
|
|
|
#$Logo.global_position.x = 0
|
|
|
|
|
|
|
|
func open():
|
2024-11-10 19:51:00 +01:00
|
|
|
$AnimationPlayer.pop_in()
|
2024-11-04 19:10:10 +01:00
|
|
|
$BackButton.grab_focus()
|
2024-10-03 21:12:20 +02:00
|
|
|
|
|
|
|
func _on_back_pressed() -> void:
|
2024-11-10 19:51:00 +01:00
|
|
|
$AnimationPlayer.pop_out()
|
2024-10-03 21:12:20 +02:00
|
|
|
$"../StartSchild"._ready()
|
2024-10-08 20:53:45 +02:00
|
|
|
|
|
|
|
func _volume_slider_changed(value: float) -> void:
|
|
|
|
AudioServer.set_bus_volume_db(audio_bus_music,linear_to_db(value*0.01))
|
|
|
|
|
|
|
|
|
2024-11-10 19:51:00 +01:00
|
|
|
func _on_sound_button_toggled(_toggled_on: bool) -> void:
|
2024-10-08 20:53:45 +02:00
|
|
|
$SoundToggleButton.texture_normal = sound_button_on_of[AudioServer.is_bus_mute(audio_bus_sounds)]
|
2024-11-04 19:10:10 +01:00
|
|
|
$SoundToggleButton.texture_focused = sound_button_on_of_f[AudioServer.is_bus_mute(audio_bus_sounds)]
|
2024-10-08 20:53:45 +02:00
|
|
|
AudioServer.set_bus_mute(audio_bus_sounds,not AudioServer.is_bus_mute(audio_bus_sounds))
|