Bug fixes

This commit is contained in:
Ategon 2024-09-15 04:02:55 -04:00
parent 60338da019
commit 30dcc356e8
6 changed files with 94 additions and 3 deletions

View file

@ -110,7 +110,7 @@ func _process(delta: float) -> void:
Persister.change_value(Data.data.buildings[building.key].resource, Data.data.buildings[building.key].amount)
var gain = RESOURCE_GAIN.instantiate()
gain.text = "[center]+1 %s" % [Data.data.buildings[building.key].resourcename]
gain.position = map_to_local(coords) + Vector2(-25, -5)
gain.position = map_to_local(coords) + Vector2(-50, -5)
add_sibling(gain)
building.progress -= Data.data.buildings[building.key].time

View file

@ -720,6 +720,61 @@ bbcode_enabled = true
text = "[center][smallwave]Press Left Click"
custom_effects = [SubResource("RichTextEffect_1jsuj")]
[node name="Restart" type="Control" parent="CanvasLayer"]
modulate = Color(1, 1, 1, 0)
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="ColorRect" type="ColorRect" parent="CanvasLayer/Restart"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0, 0, 0, 0.572549)
[node name="RichTextLabel" type="RichTextLabel" parent="CanvasLayer/Restart"]
self_modulate = Color(0.207843, 0.572549, 0.341176, 1)
clip_contents = false
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -146.0
offset_top = -31.0
offset_right = 146.0
offset_bottom = 51.0
grow_horizontal = 2
grow_vertical = 2
pivot_offset = Vector2(145, 9)
theme_override_constants/outline_size = 6
theme_override_font_sizes/normal_font_size = 16
bbcode_enabled = true
text = "[center]Restarting"
[node name="ColorRect2" type="ColorRect" parent="CanvasLayer/Restart"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -50.0
offset_top = -1.0
offset_right = 50.0
offset_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
scale = Vector2(1e-05, 1)
color = Color(0.321569, 0.639216, 0.352941, 1)
[node name="CanvasLayer2" type="CanvasLayer" parent="."]
layer = -1

View file

@ -79,6 +79,7 @@ func _process(delta: float) -> void:
if recent_data:
description_3.text = "[center]EFFICIENCY: %d%%" % [recent_data.efficiency]
rich_text_label_2.text = "[center]%d/%d" % [recent_data.workers, recent_data.max_workers]
func _hide_info_window(_data):

View file

@ -13,6 +13,10 @@ var timer = 0
var timer2 = 0
func _ready() -> void:
Triggerer.listen("game_started", _on_game_started)
func _on_game_started(_data):
if night_tween:
night_tween.kill()
@ -53,8 +57,8 @@ func _process(delta: float) -> void:
var pop_scale = ceil(pop / 5.0)
if Persister.get_value("food") > pop_scale and Persister.get_value("water") > pop_scale:
Persister.change_value("food", pop_scale)
Persister.change_value("water", pop_scale)
Persister.change_value("food", -pop_scale)
Persister.change_value("water", -pop_scale)
if Persister.get_value("population") < Persister.get_value("max_population"):
Persister.change_value("population", 1)
Persister.change_value("avail_population", 1)

View file

@ -46,6 +46,11 @@ rclick={
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":2,"position":Vector2(48, 14),"global_position":Vector2(57, 60),"factor":1.0,"button_index":2,"canceled":false,"pressed":true,"double_click":false,"script":null)
]
}
restart={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":82,"key_label":0,"unicode":114,"location":0,"echo":false,"script":null)
]
}
[rendering]

26
ui.gd
View file

@ -2,8 +2,11 @@ extends CanvasLayer
@onready var animation_player: AnimationPlayer = $AnimationPlayer
@onready var wood_count_label_2: Label = $UI/Background/Control3/WoodCountLabel2
@onready var restart: Control = $Restart
@onready var color_rect_2: ColorRect = $Restart/ColorRect2
var available_tween
var restart_tween
func _ready() -> void:
Persister.persist_data("wood", 50)
@ -22,6 +25,29 @@ func _process(delta: float) -> void:
animation_player.play("start")
wood_count_label_2.text = "%d available" % [Persister.get_value("avail_population")]
if Input.is_action_just_pressed("restart"):
if restart_tween:
restart_tween.kill()
restart_tween = create_tween()
restart_tween.set_parallel()
restart_tween.tween_property(restart, "modulate", Color.WHITE, 0.5)
restart_tween.tween_property(color_rect_2, "scale:x", 1, 1).set_delay(0.1)
restart_tween.chain()
restart_tween.tween_callback(func():
Persister.clear_category(PersisterEnums.Scope.RUN)
get_tree().change_scene_to_packed(preload("res://Main.tscn"))
)
if Input.is_action_just_released("restart"):
if restart_tween:
restart_tween.kill()
restart_tween = create_tween()
restart_tween.set_parallel()
restart_tween.tween_property(color_rect_2, "scale:x", 0, 1)
restart_tween.tween_property(restart, "modulate", Color.TRANSPARENT, 0.5)
func _on_show_info(_data):
if available_tween: