1
Fork 0
mirror of https://github.com/Cookie-CHR/OfficeMadness-LD51.git synced 2024-11-23 15:14:18 +00:00
office-madness/Scripts/Play.gd

43 lines
1 KiB
GDScript3
Raw Normal View History

2022-10-02 22:44:58 +00:00
extends Panel
var muted = preload("res://Sprites/Music_Off.png")
var unmuted = preload("res://Sprites/Music_On.png")
# Called when the node enters the scene tree for the first time.
func _ready():
2022-10-04 10:03:41 +00:00
GlobalTimer._stop()
2022-10-02 22:44:58 +00:00
for child in get_children():
if child.name == "Play":
child.connect("pressed", self, "_play")
elif child.name == "Instructions":
child.connect("pressed", self, "_instructions")
elif child.name == "Menu":
child.connect("pressed", self, "_menu")
elif child.name == "Mute":
child.icon = muted if Muter.mute else unmuted
if Muter.mute:
child.icon = muted
else:
child.icon = unmuted
child.connect("pressed", self, "mute_unmute", [child])
func mute_unmute(child):
Muter.mute_unmute()
child.icon = muted if Muter.mute else unmuted
func _play():
if get_tree().change_scene("res://Scenes/Main.tscn"):
print("Error!")
func _instructions():
if get_tree().change_scene("res://Scenes/Instructions.tscn"):
print("Error!")
func _menu():
if get_tree().change_scene("res://Scenes/Title.tscn"):
print("Error!")