diff --git a/HUD.gd b/HUD.gd index e6855b1..cc41bfb 100644 --- a/HUD.gd +++ b/HUD.gd @@ -26,9 +26,12 @@ func _process(delta): var time_string = "%02d:%02d:%02d" % [hours, minutes, seconds] # Format time as H:M:S var fps = Engine.get_frames_per_second() # Get the current FPS $HBoxContainer/Debug.text = time_string+" "+str(fps) + " fps" # Combine FPS and runtime into one string - if %Map.controlling and is_instance_valid(%Map.controlling) and %Map.controlling==self: - $HBoxContainer/Debug.text += str(%Map.controlling.health) # Combine FPS and runtime into one string + if %Map.controlling and is_instance_valid(%Map.controlling): + $HBoxContainer/Debug.text += " [H:"+str(%Map.controlling.health)+"]" func _on_settings_window_close_requested(): print("close") $"../SettingsWindow".hide() + +func _on_control_stop_button_pressed(): + %Map.controlling=null diff --git a/Map.gd b/Map.gd index 242c021..274076c 100644 --- a/Map.gd +++ b/Map.gd @@ -52,7 +52,7 @@ func spawn(pos,vol): var results = space_state.intersect_point(query_params, 32) # Adjust max_results as needed for result in results: result.collider.queue_free() - if tool.name=="Control": + if tool.name=="Control Player": var closest_node = null var min_distance = INF # Infinite distance initially for node in %Map.get_children(): diff --git a/hud.tscn b/hud.tscn index 9b5baca..d23ae5b 100644 --- a/hud.tscn +++ b/hud.tscn @@ -117,9 +117,13 @@ layout_mode = 2 [node name="Delete" type="VBoxContainer" parent="HBoxContainer/ToolSelect/VBoxContainer"] layout_mode = 2 -[node name="Control" type="VBoxContainer" parent="HBoxContainer/ToolSelect/VBoxContainer"] +[node name="Control Player" type="VBoxContainer" parent="HBoxContainer/ToolSelect/VBoxContainer"] layout_mode = 2 +[node name="Button" type="Button" parent="HBoxContainer/ToolSelect/VBoxContainer/Control Player"] +layout_mode = 2 +text = "Stop" + [node name="Debug" type="Label" parent="HBoxContainer"] layout_mode = 2 size_flags_horizontal = 6 @@ -146,3 +150,4 @@ popup/item_4/text = "Settings..." popup/item_4/id = 4 [connection signal="item_selected" from="HBoxContainer/ToolSelect/VBoxContainer/OptionButton" to="HBoxContainer/ToolSelect" method="_on_option_button_item_selected"] +[connection signal="pressed" from="HBoxContainer/ToolSelect/VBoxContainer/Control Player/Button" to="." method="_on_control_stop_button_pressed"]