Add hover interaction to pause menu

This commit is contained in:
Moe Poi ~ 2023-10-25 17:25:36 +07:00
parent e811a33464
commit 8a819611d6
2 changed files with 17 additions and 1 deletions

View file

@ -91,5 +91,9 @@ size_flags_vertical = 6
text = "Main Menu"
horizontal_alignment = 1
[connection signal="mouse_entered" from="Panel/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/Resume" to="." method="_on_resume_hold"]
[connection signal="mouse_exited" from="Panel/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/Resume" to="." method="_on_resume_release"]
[connection signal="pressed" from="Panel/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/Resume" to="." method="_on_resume_button_pressed"]
[connection signal="mouse_entered" from="Panel/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer2/MainMenu" to="." method="_on_main_menu_hold"]
[connection signal="mouse_exited" from="Panel/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer2/MainMenu" to="." method="_on_main_menu_release"]
[connection signal="pressed" from="Panel/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer2/MainMenu" to="." method="_on_main_menu_pressed"]

View file

@ -11,6 +11,18 @@ func hide_menu():
func _on_resume_button_pressed():
on_resume.emit()
func _on_resume_hold():
$Panel/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/Resume.modulate = Color(0.541176, 0.541176, 0.541176, 1)
func _on_resume_release():
$Panel/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/Resume.modulate = Color(1, 1, 1, 1)
func _on_main_menu_pressed():
on_resume.emit()
get_tree().change_scene_to_file("res://scenes/ui/main_menu.tscn")
get_tree().change_scene_to_file("res://scenes/ui/main_menu.tscn")
func _on_main_menu_hold():
$Panel/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer2/MainMenu.modulate = Color(0.541176, 0.541176, 0.541176, 1)
func _on_main_menu_release():
$Panel/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer2/MainMenu.modulate = Color(1, 1, 1, 1)