diff --git a/src/Data.gd b/src/Data.gd index 39ad726..1896d91 100644 --- a/src/Data.gd +++ b/src/Data.gd @@ -64,7 +64,10 @@ func start() -> void: # Loads starting loader if _data["version"] == "v0.6.0": _data["performance"] = {"Simulate" : 75, "Show" : 100, "Ball" : 9.5} _data["version"] = "v0.6.1" - if _data["version"] == "v0.6.1": # Loads the save + if _data["version"] == "v0.6.1": + _data["performance"]["CheckButton"] = false + _data["version"] = "v0.6.2" + if _data["version"] == "v0.6.2": # Loads the save goldenLength = _data["goldenLength"] goldenMagnitude = _data["goldenMagnitude"] goldenChance = _data["goldenChance"] @@ -88,7 +91,10 @@ func start() -> void: # Loads starting loader get_node("/root/Main/Game Field").call_deferred("add_child", _instance) # Loads performance settings for x in _data["performance"]: - get_node("/root/Main/TabContainer/Performance/" + x).value = _data["performance"][x] + if x == "CheckButton": + get_node("/root/Main/TabContainer/Performance/" + x).pressed = _data["performance"][x] + else: + get_node("/root/Main/TabContainer/Performance/" + x).value = _data["performance"][x] else: # Runs info for when no save is found goldenLength = 1 goldenMagnitude = 1 @@ -143,8 +149,8 @@ func save() -> void: # Used to save the game "goldenChance" : goldenChance, "goldenLength" : goldenLength, "goldenMagnitude" : goldenMagnitude, - "performance" : {"Simulate" : get_node("/root/Main/TabContainer/Performance/Simulate").value, "Show" : get_node("/root/Main/TabContainer/Performance/Show").value, "Ball" : get_node("/root/Main/TabContainer/Performance/Ball").value}, - "version" : "v0.6.1" + "performance" : {"Simulate" : get_node("/root/Main/TabContainer/Performance/Simulate").value, "Show" : get_node("/root/Main/TabContainer/Performance/Show").value, "Ball" : get_node("/root/Main/TabContainer/Performance/Ball").value, "CheckButton" : get_node("/root/Main/TabContainer/Performance/CheckButton").pressed}, + "version" : "v0.6.2" }) file.store_string(_save_data) file.close() diff --git a/src/Game Field.gd b/src/Game Field.gd index d88a5fa..45f90db 100644 --- a/src/Game Field.gd +++ b/src/Game Field.gd @@ -5,6 +5,7 @@ var visibly = 0.0 var enabled = 0.0 var total = 0.0 setget changed var disabledTotal = 0.0 +var onlySimulate = false signal update @@ -12,7 +13,9 @@ func changed(value): total = value emit_signal("update") -func _on_Timer_timeout() -> void: +func _on_change() -> void: simulate = get_node("/root/Main/TabContainer/Performance/Simulate").value / 100.0 + onlySimulate = get_node("/root/Main/TabContainer/Performance/CheckButton").pressed + get_node("/root/Main/TabContainer/Performance/Show").editable = not onlySimulate show = get_node("/root/Main/TabContainer/Performance/Show").value / 100.0 emit_signal("update") diff --git a/src/Loading.gd b/src/Loading.gd index d786f85..5c51dac 100644 --- a/src/Loading.gd +++ b/src/Loading.gd @@ -7,7 +7,7 @@ func _ready() -> void: file.open(Data.save_file, File.READ) if validate_json(file.get_as_text()) == "": var _data = parse_json(file.get_as_text()) - if _data["version"] in ["v0.5.0", "v0.5.1", "v0.5.2", "v0.6.0", "v0.6.1"]: + if _data["version"] in ["v0.5.0", "v0.5.1", "v0.5.2", "v0.6.0", "v0.6.1", "v0.6.2"]: $Save.visible = true $Timer.start() else: diff --git a/src/Main.gd b/src/Main.gd index 80e62bc..bfc67de 100644 --- a/src/Main.gd +++ b/src/Main.gd @@ -5,6 +5,7 @@ onready var _tab: TabContainer = $TabContainer # Called when the node enters the scene tree for the first time. func _ready() -> void: Data.start() + _tab.current_tab = 1 update_interface() Data.connect("update_game_interface", self, "update_interface") Data.connect("ball_upgrades", self, "ball_upgrades") @@ -59,3 +60,4 @@ func _process(delta: float) -> void: # Checks if a button is pressed to change m func _on_Export_button_up() -> void: Data.save() get_tree().change_scene("res://src/Export.tscn") + diff --git a/src/Main.tscn b/src/Main.tscn index 5b8187f..01f0507 100644 --- a/src/Main.tscn +++ b/src/Main.tscn @@ -64,12 +64,12 @@ margin_top = 65.0 margin_right = 468.0 margin_bottom = 600.0 theme = ExtResource( 5 ) +drag_to_rearrange_enabled = true __meta__ = { "_edit_use_anchors_": false } [node name="Performance" type="Control" parent="TabContainer"] -visible = false anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 4.0 @@ -124,11 +124,29 @@ __meta__ = { "_edit_use_anchors_": false } +[node name="Label5" type="Label" parent="TabContainer/Performance"] +margin_top = 119.0 +margin_right = 40.0 +margin_bottom = 150.0 +text = "Only show simulated boxes" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="CheckButton" type="CheckButton" parent="TabContainer/Performance"] +margin_left = 383.0 +margin_top = 118.0 +margin_right = 459.0 +margin_bottom = 158.0 +__meta__ = { +"_edit_use_anchors_": false +} + [node name="Ball" type="HSlider" parent="TabContainer/Performance"] margin_left = 259.0 -margin_top = 127.0 +margin_top = 161.0 margin_right = 459.0 -margin_bottom = 147.0 +margin_bottom = 181.0 max_value = 17.0 step = 0.5 value = 9.5 @@ -137,15 +155,16 @@ __meta__ = { } [node name="Label4" type="Label" parent="TabContainer/Performance"] -margin_top = 119.0 -margin_right = 40.0 -margin_bottom = 150.0 +margin_top = 153.0 +margin_right = 103.0 +margin_bottom = 184.0 text = "Ball Limit" __meta__ = { "_edit_use_anchors_": false } [node name="Boxes" type="Control" parent="TabContainer"] +visible = false anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 4.0 @@ -291,10 +310,11 @@ wait_time = 0.25 autostart = true script = ExtResource( 4 ) +[connection signal="button_up" from="TabContainer/Performance/CheckButton" to="Game Field" method="_on_change"] [connection signal="button_up" from="TabContainer/Boxes/Box Number/Buy" to="TabContainer/Boxes/Box Number" method="_on_Buy_button_up"] [connection signal="mouse_entered" from="TabContainer/Boxes/Box Number/Buy" to="TabContainer/Boxes/Box Number" method="_on_Buy_mouse_entered"] [connection signal="mouse_exited" from="TabContainer/Boxes/Box Number/Buy" to="TabContainer/Boxes/Box Number" method="_on_Buy_mouse_exited"] -[connection signal="timeout" from="Game Field/Timer" to="Game Field" method="_on_Timer_timeout"] +[connection signal="timeout" from="Game Field/Timer" to="Game Field" method="_on_change"] [connection signal="button_up" from="Save Button" to="." method="_on_Save_Button_button_up"] [connection signal="button_up" from="Export" to="." method="_on_Export_button_up"] [connection signal="button_up" from="Reset" to="." method="_on_Reset_button_up"] diff --git a/src/box.gd b/src/box.gd index 2a0bc9a..f7516a6 100644 --- a/src/box.gd +++ b/src/box.gd @@ -62,7 +62,7 @@ func delete() -> void: # Used to delete the box self.queue_free() func update() -> void: # Does all the neccessaary hiding and disabling of physics. - if disabled: + if disabled: # Sets physics if game.enabled / game.total < game.simulate or game.simulate == 1: game.enabled += 1 game.disabledTotal -= Data.earnings[level] @@ -74,13 +74,21 @@ func update() -> void: # Does all the neccessaary hiding and disabling of physic game.disabledTotal += Data.earnings[level] disabled = true $Node2D/Area2D.collision_mask = 0 - if invisible: + if invisible: # Sets visibility if (game.visibly + 1) / game.total < game.show or game.show == 1: game.visibly += 1 invisible = false - self.show() else: if game.visibly / game.total > game.show: game.visibly -= 1 invisible = true - self.hide() + var _visibilty = true + # Makes sure to set the visibilty according to the right setting + if game.onlySimulate: + _visibilty = not disabled + else: + _visibilty = not invisible + if _visibilty: + self.show() + else: + self.hide()