tidy menus
This commit is contained in:
parent
1e2c549df0
commit
7d1a079ec8
22
HUD.gd
22
HUD.gd
@ -4,7 +4,19 @@ var elapsed_time = 0.0 # Initialize a variable to keep track of elapsed time
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
var popup_menu = $HBoxContainer/Right/File.get_popup()
|
||||
popup_menu.connect("id_pressed", self._on_PopupMenu_id_pressed)
|
||||
|
||||
func _on_PopupMenu_id_pressed(id):
|
||||
match id:
|
||||
0:
|
||||
$"../NewDialog".popup_centered()
|
||||
1:
|
||||
$"../LoadDialog".popup_centered()
|
||||
2:
|
||||
$"../SaveDialog".popup_centered()
|
||||
4:
|
||||
$"../SettingsWindow".popup_centered()
|
||||
|
||||
func _process(delta):
|
||||
elapsed_time += delta # Increment the elapsed time by the frame's delta time
|
||||
@ -17,8 +29,6 @@ func _process(delta):
|
||||
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
|
||||
|
||||
func _on_save_pressed():
|
||||
$"../SaveDialog".popup_centered()
|
||||
|
||||
func _on_load_pressed():
|
||||
$"../LoadDialog".popup_centered()
|
||||
func _on_settings_window_close_requested():
|
||||
print("close")
|
||||
$"../SettingsWindow".hide()
|
||||
|
7
Map.gd
7
Map.gd
@ -189,3 +189,10 @@ func load_map(filename):
|
||||
continue
|
||||
new_object.load_data(node_data)
|
||||
add_child(new_object)
|
||||
|
||||
func _on_new_dialog_confirmed():
|
||||
var save_nodes = get_tree().get_nodes_in_group("Persist")
|
||||
for i in save_nodes:
|
||||
i.queue_free()
|
||||
$Camera2D.position=Vector2(0,0)
|
||||
$Camera2D.zoom=Vector2(1,1)
|
||||
|
@ -145,7 +145,7 @@ func load_data(data):
|
||||
carrying_b=data["b"]
|
||||
|
||||
func _on_health_timer_timeout():
|
||||
if not get_tree().root.get_node("Sim/ScreenOverlay/HUD/HBoxContainer/Right/Health").is_pressed():
|
||||
if not get_tree().root.get_node("Sim/ScreenOverlay/SettingsWindow/VBoxContainer/Health").is_pressed():
|
||||
return
|
||||
|
||||
if is_carrying():
|
||||
|
2
Pool.gd
2
Pool.gd
@ -69,7 +69,7 @@ func load_data(data):
|
||||
mana_b=data["b"]
|
||||
|
||||
func _on_decay_timer_timeout():
|
||||
if not get_tree().root.get_node("Sim/ScreenOverlay/HUD/HBoxContainer/Right/Decay").is_pressed():
|
||||
if not get_tree().root.get_node("Sim/ScreenOverlay/SettingsWindow/VBoxContainer/Decay").is_pressed():
|
||||
return
|
||||
if (mana_r+mana_g+mana_b)>randf_range(0,99999):
|
||||
decay()
|
||||
|
@ -24,9 +24,6 @@ func _ready():
|
||||
else:
|
||||
print("An error occurred when trying to access the path.")
|
||||
|
||||
func _on_about_to_popup():
|
||||
pass # Replace with function body.
|
||||
|
||||
func _on_confirmed():
|
||||
var filename=base_path+$LineEdit.text
|
||||
print("Save: "+filename)
|
||||
@ -54,9 +51,3 @@ func _on_confirmed():
|
||||
|
||||
$"../HUD/HBoxContainer/ToolSelect".populate_paste()
|
||||
|
||||
func set_owner_recursive(node: Node, new_owner: Node):
|
||||
if node != new_owner:
|
||||
node.owner = new_owner
|
||||
print("chown ",node.name)
|
||||
for child in node.get_children():
|
||||
set_owner_recursive(child, new_owner)
|
||||
|
@ -8,7 +8,7 @@ custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path=""
|
||||
export_path="bin/alpha10.apk"
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
encrypt_pck=false
|
||||
@ -28,9 +28,9 @@ architectures/x86=false
|
||||
architectures/x86_64=false
|
||||
version/code=1
|
||||
version/name="1.0"
|
||||
package/unique_name="org.godotengine.$genname"
|
||||
package/unique_name="uk.co.jhodges.jhrgb"
|
||||
package/name=""
|
||||
package/signed=true
|
||||
package/signed=false
|
||||
package/app_category=2
|
||||
package/retain_data_on_uninstall=false
|
||||
package/exclude_from_recents=false
|
||||
|
30
hud.tscn
30
hud.tscn
@ -129,22 +129,20 @@ text = "debug"
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 10
|
||||
|
||||
[node name="Decay" type="CheckBox" parent="HBoxContainer/Right"]
|
||||
[node name="File" type="MenuButton" parent="HBoxContainer/Right"]
|
||||
layout_mode = 2
|
||||
text = "Decay"
|
||||
|
||||
[node name="Health" type="CheckBox" parent="HBoxContainer/Right"]
|
||||
layout_mode = 2
|
||||
text = "Health"
|
||||
|
||||
[node name="Load" type="Button" parent="HBoxContainer/Right"]
|
||||
layout_mode = 2
|
||||
text = "Load..."
|
||||
|
||||
[node name="Save" type="Button" parent="HBoxContainer/Right"]
|
||||
layout_mode = 2
|
||||
text = "Save..."
|
||||
text = "File..."
|
||||
item_count = 5
|
||||
popup/item_0/text = "New..."
|
||||
popup/item_0/id = 0
|
||||
popup/item_1/text = "Load..."
|
||||
popup/item_1/id = 1
|
||||
popup/item_2/text = "Save..."
|
||||
popup/item_2/id = 2
|
||||
popup/item_3/text = ""
|
||||
popup/item_3/id = 3
|
||||
popup/item_3/separator = true
|
||||
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/Right/Load" to="." method="_on_load_pressed"]
|
||||
[connection signal="pressed" from="HBoxContainer/Right/Save" to="." method="_on_save_pressed"]
|
||||
|
@ -64,3 +64,7 @@ escape={
|
||||
2d/default_gravity=0.0
|
||||
2d/default_linear_damp=0.0
|
||||
2d/default_angular_damp=0.0
|
||||
|
||||
[rendering]
|
||||
|
||||
textures/vram_compression/import_etc2_astc=true
|
||||
|
24
sim.tscn
24
sim.tscn
@ -52,6 +52,29 @@ offset_bottom = 51.0
|
||||
placeholder_text = "Filename"
|
||||
|
||||
[node name="NewDialog" type="ConfirmationDialog" parent="ScreenOverlay"]
|
||||
dialog_text = "Clear current map?"
|
||||
|
||||
[node name="SettingsWindow" type="Window" parent="ScreenOverlay"]
|
||||
title = "Settings"
|
||||
position = Vector2i(18, 50)
|
||||
size = Vector2i(300, 200)
|
||||
visible = false
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="ScreenOverlay/SettingsWindow"]
|
||||
offset_right = 123.0
|
||||
offset_bottom = 101.0
|
||||
|
||||
[node name="Decay" type="CheckBox" parent="ScreenOverlay/SettingsWindow/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Decay"
|
||||
|
||||
[node name="Health" type="CheckBox" parent="ScreenOverlay/SettingsWindow/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Health"
|
||||
|
||||
[node name="Screenshots" type="CheckBox" parent="ScreenOverlay/SettingsWindow/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Screenshots"
|
||||
|
||||
[node name="ScreenShots" type="Timer" parent="."]
|
||||
wait_time = 60.0
|
||||
@ -63,4 +86,5 @@ script = ExtResource("3_7b3mn")
|
||||
[connection signal="about_to_popup" from="ScreenOverlay/SaveDialog" to="ScreenOverlay/SaveDialog" method="_on_about_to_popup"]
|
||||
[connection signal="confirmed" from="ScreenOverlay/SaveDialog" to="ScreenOverlay/SaveDialog" method="_on_confirmed"]
|
||||
[connection signal="confirmed" from="ScreenOverlay/NewDialog" to="Map" method="_on_new_dialog_confirmed"]
|
||||
[connection signal="close_requested" from="ScreenOverlay/SettingsWindow" to="ScreenOverlay/HUD" method="_on_settings_window_close_requested"]
|
||||
[connection signal="timeout" from="ScreenShots" to="ScreenShots" method="_on_timeout"]
|
||||
|
Loading…
Reference in New Issue
Block a user