vol.gd 456 B

123456789101112131415
  1. extends HBoxContainer
  2. @export var bus: int = 0
  3. # Called when the node enters the scene tree for the first time.
  4. func _ready():
  5. find_child("Button").connect("value_changed", pls)
  6. func pls(val: float):
  7. if val < 50:
  8. AudioServer.set_bus_volume_db(bus, -5 + (100 - val) / 2 * -1)
  9. if val > 50:
  10. AudioServer.set_bus_volume_db(bus, -5 + (100 - val) / 10)
  11. #print(AudioServer.get_bus_volume_db(bus))
  12. #print(val, " ", 100 - val)