44 lines
1014 B
Plaintext
44 lines
1014 B
Plaintext
[gd_scene format=3 uid="uid://qrf08uiuhyqg"]
|
|
|
|
[ext_resource type="AudioStream" uid="uid://bdluyy5uodjb5" path="res://resources/thomastanks_new.mp3" id="1_ht1d5"]
|
|
|
|
[sub_resource type="GDScript" id="GDScript_ht1d5"]
|
|
script/source = "extends Node
|
|
|
|
@onready var AudioButton = $\"../HUD/audio_button\"
|
|
@onready var player = $AudioStreamPlayer2D
|
|
@export var icon_active: Texture2D
|
|
@export var icon_inactive: Texture2D
|
|
var isPlaying = true
|
|
|
|
|
|
func play_track():
|
|
player.play()
|
|
isPlaying = true
|
|
if AudioButton:
|
|
AudioButton.icon = icon_active
|
|
|
|
|
|
func stop():
|
|
player.stop()
|
|
isPlaying = false
|
|
if AudioButton:
|
|
AudioButton.icon = icon_inactive
|
|
|
|
|
|
func _on_audio_button_pressed() -> void:
|
|
if isPlaying:
|
|
stop()
|
|
else:
|
|
play_track()
|
|
"
|
|
|
|
[node name="MusicManager" type="Node" unique_id=1072287338]
|
|
script = SubResource("GDScript_ht1d5")
|
|
|
|
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="." unique_id=281982184]
|
|
stream = ExtResource("1_ht1d5")
|
|
volume_db = -5.0
|
|
autoplay = true
|
|
parameters/looping = false
|