From e811a33464c9762707b20c8d343b75adbc5b80f6 Mon Sep 17 00:00:00 2001 From: Moe Poi ~ Date: Wed, 25 Oct 2023 17:19:35 +0700 Subject: [PATCH] Add hover interaction to pause button --- scenes/ui/game_stats.tscn | 2 ++ scripts/ui/game_stats.gd | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/scenes/ui/game_stats.tscn b/scenes/ui/game_stats.tscn index 4cb894d..2b84bb8 100644 --- a/scenes/ui/game_stats.tscn +++ b/scenes/ui/game_stats.tscn @@ -104,4 +104,6 @@ texture = ExtResource("3_r1i66") layout_mode = 2 texture = ExtResource("3_r1i66") +[connection signal="mouse_entered" from="Pause/PauseButton" to="." method="_on_pause_button_hold"] +[connection signal="mouse_exited" from="Pause/PauseButton" to="." method="_on_pause_button_release"] [connection signal="pressed" from="Pause/PauseButton" to="." method="_on_pause_button_pressed"] diff --git a/scripts/ui/game_stats.gd b/scripts/ui/game_stats.gd index d28d6a3..30e91e5 100644 --- a/scripts/ui/game_stats.gd +++ b/scripts/ui/game_stats.gd @@ -14,4 +14,10 @@ func set_damage(value): health.pop_back() func _on_pause_button_pressed(): - on_paused.emit() \ No newline at end of file + on_paused.emit() + +func _on_pause_button_hold(): + $Pause/PauseButton.modulate = Color(0.615686, 0.615686, 0.615686, 1) + +func _on_pause_button_release(): + $Pause/PauseButton.modulate = Color(1, 1, 1, 1) \ No newline at end of file