24 lines
701 B
GDScript
24 lines
701 B
GDScript
extends TextureButton
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
pressed.connect(self._button_pressed)
|
|
|
|
var was_hovered = false
|
|
func _process(delta):
|
|
|
|
if is_hovered() && !was_hovered:
|
|
Sounds.get_node("hover").play()
|
|
was_hovered = is_hovered()
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _button_pressed():
|
|
|
|
if (Input.mouse_mode != Input.MOUSE_MODE_CAPTURED):
|
|
Sounds.get_node("click").play()
|
|
get_node("../../..").opaque = !get_node("../../..").opaque
|
|
|
|
if LevelLoader.current_index == 0 :
|
|
if (Input.mouse_mode != Input.MOUSE_MODE_CAPTURED):
|
|
Globals.restart = true
|
|
get_node("../../..").opaque = false
|