summaryrefslogtreecommitdiff
path: root/Scripts/NumberNode.gd
diff options
context:
space:
mode:
authoraltaf-creator <dev@altafcreator.com>2024-04-14 23:00:45 +0700
committeraltaf-creator <dev@altafcreator.com>2024-04-14 23:00:45 +0700
commitf1b4d6034c937c89b2750bc209684a4e19896177 (patch)
treef91731656ff901e458ab504b8e8e33fb06e67c0b /Scripts/NumberNode.gd
parent21d3893b6b1c1ffb2d9611bce67568e713161b3d (diff)
Art overhaul
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()