aboutsummaryrefslogtreecommitdiff
path: root/client/map/progress.gd
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-09-04 22:12:02 +0200
committermetamuffin <metamuffin@disroot.org>2024-09-04 22:12:02 +0200
commit5fab354d37476f7339975311a0fe4d5a559065db (patch)
treed58a10d24c66291237d1bc4dc026b86f490881bf /client/map/progress.gd
parentc646336dc3bf470d4185eec995d00a89c420127b (diff)
parent9ed1d51ad4abaa114da36e3284c8e29dd07855ad (diff)
downloadhurrycurry-5fab354d37476f7339975311a0fe4d5a559065db.tar
hurrycurry-5fab354d37476f7339975311a0fe4d5a559065db.tar.bz2
hurrycurry-5fab354d37476f7339975311a0fe4d5a559065db.tar.zst
Merge branch 'master' of codeberg.org:hurrycurry/hurrycurry
Diffstat (limited to 'client/map/progress.gd')
-rw-r--r--client/map/progress.gd21
1 files changed, 17 insertions, 4 deletions
diff --git a/client/map/progress.gd b/client/map/progress.gd
index 94670651..1ca76287 100644
--- a/client/map/progress.gd
+++ b/client/map/progress.gd
@@ -1,6 +1,7 @@
# Hurry Curry! - a game about cooking
# Copyright 2024 metamuffin
# Copyright 2024 nokoe
+# Copyright 2024 tpart
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
@@ -17,7 +18,19 @@
class_name ProgressBar3D
extends MeshInstance3D
-func set_progress(progress: float, bad: bool):
- var mat: ShaderMaterial = self.get_active_material(0)
- mat.set_shader_parameter("progress", progress)
- mat.set_shader_parameter("bad", bad)
+var speed := 0.
+var position_ := 0.
+
+func update(new_position: float, new_speed: float, warn: bool):
+ speed = new_speed
+ position_ = new_position
+
+ var mat: ShaderMaterial = get_active_material(0)
+ mat.set_shader_parameter("progress", position_)
+ mat.set_shader_parameter("bad", warn)
+
+func _process(delta: float):
+ position_ += delta * speed
+
+ var mat: ShaderMaterial = get_active_material(0)
+ mat.set_shader_parameter("progress", position_)