fuzzyworld

godot-shooter / commit

Fix mouse cursors across game and pause menu.

5dbe390e8a0588728d75c76a2b538e81be95a5ca · Pavel Safronov · 2023-11-05 18:41:06 -0800 · parents a6145696e1b6

Fix mouse cursors across game and pause menu.
 World.gd | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/World.gd b/World.gd
index b151944..4df1530 100644
--- a/World.gd
+++ b/World.gd
@@ -7,7 +7,6 @@ var destination: Vector2
 var is_destination_set = false
 
 func _ready() -> void:
-	# hide mouse
 	Input.mouse_mode = Input.MOUSE_MODE_HIDDEN
 	
 	# create enemies
@@ -51,6 +50,7 @@ func _process(_delta: float) -> void:
 		set_destination(pos)
 	if Input.is_action_just_pressed("pause"):
 		get_tree().paused = true
+		Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
 		$CanvasLayer/PauseMenu.show()
 
 	if is_destination_set:
@@ -103,3 +103,5 @@ func _on_ShootTimer_timeout() -> void:
 func _on_Button_pressed() -> void:
 	get_tree().paused = false
 	$CanvasLayer/PauseMenu.hide()
+	Input.mouse_mode = Input.MOUSE_MODE_HIDDEN
+