tidy + fixes

This commit is contained in:
James 2023-12-11 09:10:25 +00:00
parent 8a1b5c647c
commit e8c964662f
3 changed files with 12 additions and 4 deletions

7
HUD.gd
View File

@ -26,9 +26,12 @@ func _process(delta):
var time_string = "%02d:%02d:%02d" % [hours, minutes, seconds] # Format time as H:M:S 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 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 $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: if %Map.controlling and is_instance_valid(%Map.controlling):
$HBoxContainer/Debug.text += str(%Map.controlling.health) # Combine FPS and runtime into one string $HBoxContainer/Debug.text += " [H:"+str(%Map.controlling.health)+"]"
func _on_settings_window_close_requested(): func _on_settings_window_close_requested():
print("close") print("close")
$"../SettingsWindow".hide() $"../SettingsWindow".hide()
func _on_control_stop_button_pressed():
%Map.controlling=null

2
Map.gd
View File

@ -52,7 +52,7 @@ func spawn(pos,vol):
var results = space_state.intersect_point(query_params, 32) # Adjust max_results as needed var results = space_state.intersect_point(query_params, 32) # Adjust max_results as needed
for result in results: for result in results:
result.collider.queue_free() result.collider.queue_free()
if tool.name=="Control": if tool.name=="Control Player":
var closest_node = null var closest_node = null
var min_distance = INF # Infinite distance initially var min_distance = INF # Infinite distance initially
for node in %Map.get_children(): for node in %Map.get_children():

View File

@ -117,9 +117,13 @@ layout_mode = 2
[node name="Delete" type="VBoxContainer" parent="HBoxContainer/ToolSelect/VBoxContainer"] [node name="Delete" type="VBoxContainer" parent="HBoxContainer/ToolSelect/VBoxContainer"]
layout_mode = 2 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 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"] [node name="Debug" type="Label" parent="HBoxContainer"]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 6 size_flags_horizontal = 6
@ -146,3 +150,4 @@ popup/item_4/text = "Settings..."
popup/item_4/id = 4 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="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"]