fuzzyworld

godot-shooter / commit

Stop hiding the mouse, and create enemies slightly farther off-screen.

da9d123af3b87f2dd7bbb12e4192bd9b8c298a90 · Pavel Safronov · 2023-11-07 09:35:32 -0800 · parents 0bfcffe29dd5

Stop hiding the mouse, and create enemies slightly farther off-screen.
 Player.gd | 1 -
 World.gd  | 7 +------
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/Player.gd b/Player.gd
index 2806aaa..da5163b 100644
--- a/Player.gd
+++ b/Player.gd
@@ -40,7 +40,6 @@ func kill():
 	$Graphics/Dead.show()
 	$Graphics/Alive.hide()
 	$CanvasLayer/CenterContainer/DeathScreen.show()
-	Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
 	z_index = -1
 	get_tree().paused = true
 
diff --git a/World.gd b/World.gd
index 6e5696c..8ed7929 100644
--- a/World.gd
+++ b/World.gd
@@ -36,8 +36,6 @@ func create_speed():
 	$Environment.call_deferred("add_child", speed)
 
 func _ready() -> void:
-	Input.mouse_mode = Input.MOUSE_MODE_HIDDEN
-	
 	# create items
 	for creator in min_items_dict:
 		var count = min_items_dict[creator]
@@ -50,7 +48,7 @@ func get_new_item_pos(dist_ratio: float = 1.0) -> Vector2:
 	var unit_vector = Vector2.UP.rotated(pos_angle)
 	var size = get_viewport().get_visible_rect().size
 	var max_side = max(size.x, size.y)
-	var screen_radius = max_side / 2 + 10
+	var screen_radius = max_side + 10
 	var enemy_spawn_dist = screen_radius * dist_ratio
 	var pos = unit_vector * enemy_spawn_dist + $Player.global_position
 	return pos
@@ -74,7 +72,6 @@ func _input(event: InputEvent) -> void:
 func _process(_delta: float) -> void:
 	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:
@@ -145,5 +142,3 @@ func _on_ShootTimer_timeout() -> void:
 func _on_Button_pressed() -> void:
 	get_tree().paused = false
 	$CanvasLayer/PauseMenu.hide()
-	Input.mouse_mode = Input.MOUSE_MODE_HIDDEN
-