we're cooking now
This commit is contained in:
parent
f58fd81ec5
commit
da3dc64056
6 changed files with 86 additions and 15 deletions
23
time_system/clock.gd
Normal file
23
time_system/clock.gd
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
extends Control
|
||||
|
||||
@export var days_left : float = 7
|
||||
@export var time_left : int = 200
|
||||
var starting_time : int = 200
|
||||
@export var bar : TextureProgressBar
|
||||
@export var timer_text : Label
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
bar.value = (starting_time-time_left)/float(starting_time)
|
||||
timer_text.text = str(time_left)
|
||||
|
||||
func has_time(time : float) -> bool:
|
||||
return time_left >= time
|
||||
|
||||
func use_time(time : float):
|
||||
time_left -= time
|
||||
1
time_system/clock.gd.uid
Normal file
1
time_system/clock.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://c4y7w10si2q2p
|
||||
|
|
@ -1,19 +1,24 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://dpa3yvdrddtsh"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://dpa3yvdrddtsh"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cvsibrbtuqfww" path="res://assets/ready_time.png" id="1_chnjs"]
|
||||
[ext_resource type="Script" uid="uid://c4y7w10si2q2p" path="res://time_system/clock.gd" id="1_m6rn1"]
|
||||
[ext_resource type="Texture2D" uid="uid://bemb2moou1hkj" path="res://assets/timer_over.png" id="2_m6rn1"]
|
||||
[ext_resource type="Texture2D" uid="uid://dvxtm2ahjd55h" path="res://assets/used_time.png" id="3_uyb5s"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_r3ygl"]
|
||||
font_size = 32
|
||||
|
||||
[node name="Clock" type="Control"]
|
||||
[node name="Clock" type="Control" node_paths=PackedStringArray("bar", "timer_text")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
script = ExtResource("1_m6rn1")
|
||||
bar = NodePath("PanelContainer/HBoxContainer/TextureProgressBar")
|
||||
timer_text = NodePath("PanelContainer/HBoxContainer/TextureProgressBar/PanelContainer/Label")
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||
layout_mode = 1
|
||||
|
|
@ -45,6 +50,8 @@ text = "Days Left"
|
|||
[node name="TextureProgressBar" type="TextureProgressBar" parent="PanelContainer/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(150, 73)
|
||||
layout_mode = 2
|
||||
max_value = 1.0
|
||||
step = 0.0
|
||||
fill_mode = 4
|
||||
radial_initial_angle = 270.0
|
||||
radial_fill_degrees = 180.0
|
||||
|
|
@ -53,3 +60,23 @@ nine_patch_stretch = true
|
|||
texture_under = ExtResource("1_chnjs")
|
||||
texture_over = ExtResource("2_m6rn1")
|
||||
texture_progress = ExtResource("3_uyb5s")
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="PanelContainer/HBoxContainer/TextureProgressBar"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -16.0
|
||||
offset_top = -23.0
|
||||
offset_right = 16.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
|
||||
[node name="Label" type="Label" parent="PanelContainer/HBoxContainer/TextureProgressBar/PanelContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 8
|
||||
text = "200"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue