2024-09-15 02:50:11 +00:00
|
|
|
extends CanvasLayer
|
|
|
|
|
|
|
|
@onready var animation_player: AnimationPlayer = $AnimationPlayer
|
2024-09-15 07:29:19 +00:00
|
|
|
@onready var wood_count_label_2: Label = $UI/Background/Control3/WoodCountLabel2
|
|
|
|
|
|
|
|
var available_tween
|
2024-09-15 02:50:11 +00:00
|
|
|
|
2024-09-15 03:23:38 +00:00
|
|
|
func _ready() -> void:
|
2024-09-15 04:25:59 +00:00
|
|
|
Persister.persist_data("wood", 50)
|
|
|
|
Persister.persist_data("stone", 50)
|
2024-09-15 03:43:31 +00:00
|
|
|
Persister.persist_data("population", 3)
|
2024-09-15 07:29:19 +00:00
|
|
|
Persister.persist_data("avail_population", 3)
|
2024-09-15 07:43:45 +00:00
|
|
|
Persister.persist_data("food", 10)
|
|
|
|
Persister.persist_data("water", 10)
|
2024-09-15 03:43:31 +00:00
|
|
|
Persister.persist_data("max_population", 3)
|
2024-09-15 07:29:19 +00:00
|
|
|
Triggerer.listen("show_info", _on_show_info)
|
|
|
|
Triggerer.listen("hide_info", _on_hide_info)
|
2024-09-15 02:50:11 +00:00
|
|
|
|
|
|
|
func _process(delta: float) -> void:
|
|
|
|
if Input.is_action_just_pressed("lclick") and not Persister.get_value("game_started"):
|
|
|
|
Persister.persist_data("game_started", true)
|
|
|
|
animation_player.play("start")
|
2024-09-15 07:29:19 +00:00
|
|
|
|
|
|
|
wood_count_label_2.text = "%d available" % [Persister.get_value("avail_population")]
|
|
|
|
|
|
|
|
func _on_show_info(_data):
|
|
|
|
if available_tween:
|
|
|
|
available_tween.kill()
|
|
|
|
|
|
|
|
available_tween = create_tween()
|
|
|
|
available_tween.set_ease(Tween.EASE_OUT)
|
|
|
|
available_tween.set_trans(Tween.TRANS_BACK)
|
|
|
|
available_tween.tween_property(wood_count_label_2, "scale", Vector2.ONE, 0.5)
|
|
|
|
|
|
|
|
|
|
|
|
func _on_hide_info(_data):
|
|
|
|
if available_tween:
|
|
|
|
available_tween.kill()
|
|
|
|
|
|
|
|
available_tween = create_tween()
|
|
|
|
available_tween.set_ease(Tween.EASE_OUT)
|
|
|
|
available_tween.set_trans(Tween.TRANS_QUAD)
|
|
|
|
available_tween.tween_property(wood_count_label_2, "scale", Vector2.ZERO, 0.5)
|