godot-shooter / commit
Send out a "clear destination" event when the pause button is pushed. It's kind of a fix.
Player.gd | 1 + World.gd | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Player.gd b/Player.gd index c7f4a99..544befd 100644 --- a/Player.gd +++ b/Player.gd @@ -216,6 +216,7 @@ func show_message(message: String, duration_seconds: int = 2) -> void: func _on_HUD_paused() -> void: get_tree().paused = true $UI/PauseMenu.show() + emit_signal("destination_set", null) func _on_ResumeButton_pressed() -> void: get_tree().paused = false diff --git a/World.gd b/World.gd index a9accfe..9acd42d 100644 --- a/World.gd +++ b/World.gd @@ -149,7 +149,11 @@ func _process(_delta: float) -> void: player.update_radar(get_tree().get_nodes_in_group("gold"), Color.yellow) player.update_radar(filteredEnemies, Color.red) -func set_destination(event_pos: Vector2) -> void: +func set_destination(event_pos) -> void: + var is_vector = event_pos is Vector2 + if event_pos == null or not is_vector: + is_destination_set = false + return var mid = Vector2(width / 2.0, height / 2.0) var pos = event_pos + $Player.position - mid destination = pos