summaryrefslogtreecommitdiff
path: root/Scripts/NumberNode.gd
diff options
context:
space:
mode:
Diffstat (limited to 'Scripts/NumberNode.gd')
-rw-r--r--Scripts/NumberNode.gd14
1 files changed, 12 insertions, 2 deletions
diff --git a/Scripts/NumberNode.gd b/Scripts/NumberNode.gd
index b566781..016a83c 100644
--- a/Scripts/NumberNode.gd
+++ b/Scripts/NumberNode.gd
@@ -19,17 +19,27 @@ enum Operations {
@export_subgroup("Visual Nodes")
@export var label : Label
@export var sprite : Sprite2D
+@export var shadow_sprite : Sprite2D
@export var sprite_modifier : Sprite2D
@export_subgroup("Visual Values")
@export var color : Color = Color.BLACK
@export var min_scale : float
@export var max_scale : float
+@export var target_pos : Vector2
+
+var size : float = 1
func _ready():
+ size = sprite.scale.x
+ target_pos = position
update_visuals()
func _process(_delta):
- pass
+ sprite.scale = Vector2(size, size)
+ shadow_sprite.scale = sprite.scale
+
+func _physics_process(_delta):
+ position = position.lerp(target_pos, 0.2)
func join_from(node : NumberNode):
node.value += self.value
@@ -49,7 +59,7 @@ func join_from(node : NumberNode):
node.value = roundi(float(node.value) / float(self.modifier))
if modifier_label: modifier_label.pop("/ " + str(self.modifier))
- node.position = self.position
+ node.target_pos = self.position
node.update_visuals()
queue_free()