Skip to content
Snippets Groups Projects
Commit 2781c397 authored by Guillaume IMHOFF's avatar Guillaume IMHOFF
Browse files

Remember the music value for the ui

parent 2a6ef0d3
Branches
Tags
No related merge requests found
......@@ -2,3 +2,4 @@ extends Node
var volume_value: float = -10.0 # Valeur par défaut du volume
var button_check=true
var music_check=true
[gd_scene load_steps=10 format=3 uid="uid://7mcc8557hsh8"]
[ext_resource type="Script" uid="uid://iwanh675f7xo" path="res://GameStarter/home_page.gd" id="1_ed3xu"]
[ext_resource type="Texture2D" uid="uid://cavhbnn0b3qoj" path="res://assets/ui/background.png" id="2_gu8ip"]
[ext_resource type="Texture2D" uid="uid://k232put81nvn" path="res://assets/ui/user button.png" id="3_q42id"]
[ext_resource type="Texture2D" uid="uid://dpf8x1ngdjwn4" path="res://assets/ui/RULES BUTTON.png" id="4_b1bmy"]
......
extends Node2D
@onready var slider = $"PopupSettings/vol bar"
@onready var musicbtn = $"PopupSettings/music btn"
@onready var soundbtn = $"PopupSettings/sound btn"
func _ready():
slider.value = Config.volume_value
musicbtn.toggle_mode = Config.music_check
soundbtn.toggle_mode = Config.button_check
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("BGMusic"), Config.volume_value)
......@@ -28,8 +34,10 @@ func _on_h_slider_value_changed(value: float) -> void:
func _on_check_button_music_toggled(toggled_on: bool) -> void:
if toggled_on==false:
AudioServer.set_bus_mute(AudioServer.get_bus_index("BGMusic"),true)
Config.music_check = false
else:
AudioServer.set_bus_mute(AudioServer.get_bus_index("BGMusic"),false)
Config.music_check = true
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment